Android Gradle error with react-native 0.68.0
mfellner opened this issue ยท 12 comments
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch react-native-securerandom@1.0.0
for the project I'm working on.
In the latest version of react-native, a newer Gradle version is used that is incompatible with the build.gradle file used by react-native-securerandom (https://docs.gradle.org/current/userguide/upgrading_version_6.html#sec:configuration_removal).
The library should probably be updated to the latest react-native version, however here is the diff that solved my problem:
diff --git a/node_modules/react-native-securerandom/android/build.gradle b/node_modules/react-native-securerandom/android/build.gradle
index e21cdf0..21d7519 100644
--- a/node_modules/react-native-securerandom/android/build.gradle
+++ b/node_modules/react-native-securerandom/android/build.gradle
@@ -16,7 +16,7 @@ buildscript {
}
apply plugin: 'com.android.library'
-apply plugin: 'maven'
+apply plugin: 'maven-publish'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
@@ -87,17 +87,17 @@ def configureReactNativePom(def pom) {
afterEvaluate { project ->
- task androidJavadoc(type: Javadoc) {
- source = android.sourceSets.main.java.srcDirs
- classpath += files(android.bootClasspath)
- classpath += files(project.getConfigurations().getByName('compile').asList())
- include '**/*.java'
- }
+ // task androidJavadoc(type: Javadoc) {
+ // source = android.sourceSets.main.java.srcDirs
+ // classpath += files(android.bootClasspath)
+ // classpath += files(project.getConfigurations().getByName('compile').asList())
+ // include '**/*.java'
+ // }
- task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
- classifier = 'javadoc'
- from androidJavadoc.destinationDir
- }
+ // task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
+ // classifier = 'javadoc'
+ // from androidJavadoc.destinationDir
+ // }
task androidSourcesJar(type: Jar) {
classifier = 'sources'
@@ -114,16 +114,16 @@ afterEvaluate { project ->
artifacts {
archives androidSourcesJar
- archives androidJavadocJar
+ // archives androidJavadocJar
}
task installArchives(type: Upload) {
configuration = configurations.archives
- repositories.mavenDeployer {
- // Deploy to react-native-event-bridge/maven, ready to publish to npm
- repository url: "file://${projectDir}/../android/maven"
+ // repositories.mavenDeployer {
+ // // Deploy to react-native-event-bridge/maven, ready to publish to npm
+ // repository url: "file://${projectDir}/../android/maven"
- configureReactNativePom pom
- }
+ // configureReactNativePom pom
+ // }
}
}
This issue body was partially generated by patch-package.
On RN 0.68.0, changed maven
to maven publish
in android/build.gradle. But still has the error.
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/macair/Documents/code/js/xyz_app6/node_modules/react-native-securerandom/android/build.gradle' line: 93
* What went wrong:
A problem occurred configuring project ':react-native-securerandom'.
> Configuration with name 'compile' not found.
Here is the line: 93:
` classpath += files(project.getConfigurations().getByName('compile').asList())`
Hi mfellner
, I am having the similar problem. do you have the list of changes you have made with the android/build.gradle? Many thanks. The gradle used is 7.0.x
Is this library still maintained? Also experiencing this issue.
I updated this package's build.gradle to use gradle 7.0.0 (https://github.com/HwangTaehyun/react-native-securerandom)
Also, It didn't seem to be maintained, so I re-deployed it. (react-native-awesome-secure-random)
I'm glad people have found this library useful but to be truthful I haven't used or worked on it in a while, and don't plan to.
@HwangTaehyun would you be interested in being added as a maintainer here?
Oh, hi @robhogan! I've recently been interested and would like to be a maintainer of this project!
Oh, hi @robhogan! I've recently been interested and would like to be a maintainer of this project!
Welcome on board :)
I should add - because this is a particularly security-sensitive project by nature, I'll continue to take responsibility for pushing to NPM for the time being. Let's also retain the spirit of this lib as small and single-purpose.
Otherwise @HwangTaehyun please feel free to merge as you see fit. If you want to release, ping me in a version bump PR and I'll take it from there.
And thanks for your contribution and help!
Thanks @HwangTaehyun, Gradle 7 is now supported since merge of pull #40. @robhogan, are we able to get this published please, I'd love to upgrade my app to gradle 7
thanks @HwangTaehyun for the update, waiting for a new release now, until then
yarn add ssh://git@github.com:robhogan/react-native-securerandom.git
is our friend
I would also like to request a new release.
Apologies folks, I've only just seen these release requests. I'll prepare a changelog and publish tomorrow. At a glance it looks like it's safest to assume the Gradle updates are breaking (for users on very old RN versions) so I'm inclined to publish as v2. @HwangTaehyun, sound good to you?
On second look, I don't think any of these changes are breaking, so I've released as 1.0.1. Thanks everyone, closing!