Android: unable to build with React native 0.69
Closed this issue · 2 comments
squio commented
Running the Android build command: npx react-native run-android
Output:
> Configure project :klippa_react-native-klippa-scanner-sdk
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* Where:
Build file '[...]/app/node_modules/@klippa/react-native-klippa-scanner-sdk/android/build.gradle' line: 119
* What went wrong:
A problem occurred configuring project ':klippa_react-native-klippa-scanner-sdk'.
> Could not resolve all files for configuration ':klippa_react-native-klippa-scanner-sdk:klippaConfig'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :klippa_react-native-klippa-scanner-sdk
> Cannot choose between the following variants of com.facebook.react:react-native:0.69.0:
- debugVariantDefaultRuntimePublication
- releaseVariantDefaultRuntimePublication
All of them match the consumer attributes:
- Variant 'debugVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.69.0:
- Unmatched attributes:
- Provides com.android.build.api.attributes.BuildTypeAttr 'debug' but the consumer didn't ask for it
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'aar' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
- Variant 'releaseVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.69.0:
- Unmatched attributes:
- Provides com.android.build.api.attributes.BuildTypeAttr 'release' but the consumer didn't ask for it
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'aar' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
Using latest release "@klippa/react-native-klippa-scanner-sdk": "^0.2.5"
squio commented
Checked the following config for gradle 7.x:
If you're using gradle 7+ you will need to change copyDownloadableDepsToLibs in the app/build.gradle. It should now look like:
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.implementation
into 'libs'
}
This was already the case and upgrading to 0.2.6 didn't fix the build error either.
Noticed that the error is only related to the JavaDoc so I commented out all related build steps in the klippa build.gradle file:
// ...line 113:
afterEvaluate { project ->
// some Gradle build hooks ref:
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
// task androidJavadoc(type: Javadoc) {
// source = android.sourceSets.main.java.srcDirs
// classpath += files(android.bootClasspath)
// classpath += files(project.getConfigurations().getByName('klippaConfig').asList())
// include '**/*.java'
// }
// task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
// classifier = 'javadoc'
// from androidJavadoc.destinationDir
// }
// ... stuff omitted
artifacts {
archives androidSourcesJar
// archives androidJavadocJar
}
So this is not really a solution but a work around to make the project build.
squio commented
Closing as this is no longer an issue when building with RN 0.70 in a clean project 👍