react-native-settings icon indicating copy to clipboard operation
react-native-settings copied to clipboard

A problem occurred configuring project ':react-native-settings'. when use in (react-native: 0.70.4)

Open nisharafic001 opened this issue 3 years ago • 11 comments

"react-native-settings": "^1.0.0", "react-native": "0.70.4",

when I install this package above mentioned version following error occurred. could you help.

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':react-native-settings'.

Could not determine the dependencies of null. Could not resolve all task dependencies for configuration ':react-native-settings:classpath'. > Could not find com.android.tools.build:gradle:1.3.1. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/1.3.1/gradle-1.3.1.pom If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration. Required by: project :react-native-settings

nisharafic001 avatar Nov 06 '22 09:11 nisharafic001

yarn add react-native-settings@^0.2.3

nurassyl avatar Nov 12 '22 11:11 nurassyl

Same, any solution?

ahmettopal avatar Jan 21 '23 19:01 ahmettopal

add the maven central repository in build.gradlle file in the buildscript section, google repository does not have the 1.3.1 version (it starts with 3,x,x as you can see here) https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google maven central has the older versions, alternatively I think you can increment to gradle 3.1.1. to make the code permanent in your RN app you can use the patch-package library https://github.com/ds300/patch-package#readme

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.1'
    }
}

FelixKLabs avatar Jan 27 '23 20:01 FelixKLabs

any solution in react native 71?

peyman-hakemi avatar Feb 07 '23 16:02 peyman-hakemi

I have a solution using patches. Here it is.

diff --git a/node_modules/react-native-settings/android/build.gradle b/node_modules/react-native-settings/android/build.gradle
index 6f8e7d0..9c98885 100644
--- a/node_modules/react-native-settings/android/build.gradle
+++ b/node_modules/react-native-settings/android/build.gradle
@@ -1,14 +1,17 @@
 buildscript {
     repositories {
         google()
+        jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:1.3.1'
+        classpath "com.android.tools.build:gradle:3.4.1"
     }
 }
 
 apply plugin: 'com.android.library'
 
+apply plugin: 'com.android.library'
+
 def projectVar(name, fallback) {
     return project.findProperty(name) ?: fallback
 }
@@ -18,7 +21,7 @@ android {
     buildToolsVersion projectVar('buildToolsVersion', '23.0.1')
 
     defaultConfig {
-        minSdkVersion 16
+        minSdkVersion projectVar('minSdkVersion', 16)
         targetSdkVersion projectVar('targetSdkVersion', 22)
         versionCode 1
         versionName "1.0"
@@ -29,7 +32,8 @@ android {
 }
 
 repositories {
-    mavenCentral()
+    google()
+    jcenter()
 }
 
 dependencies {

Essentially, add jcenter() and google() to the repositories and bump the gradle version

prog-24 avatar Mar 12 '23 20:03 prog-24

I have a solution using patches. Here it is.

diff --git a/node_modules/react-native-settings/android/build.gradle b/node_modules/react-native-settings/android/build.gradle
index 6f8e7d0..9c98885 100644
--- a/node_modules/react-native-settings/android/build.gradle
+++ b/node_modules/react-native-settings/android/build.gradle
@@ -1,14 +1,17 @@
 buildscript {
     repositories {
         google()
+        jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:1.3.1'
+        classpath "com.android.tools.build:gradle:3.4.1"
     }
 }
 
 apply plugin: 'com.android.library'
 
+apply plugin: 'com.android.library'
+
 def projectVar(name, fallback) {
     return project.findProperty(name) ?: fallback
 }
@@ -18,7 +21,7 @@ android {
     buildToolsVersion projectVar('buildToolsVersion', '23.0.1')
 
     defaultConfig {
-        minSdkVersion 16
+        minSdkVersion projectVar('minSdkVersion', 16)
         targetSdkVersion projectVar('targetSdkVersion', 22)
         versionCode 1
         versionName "1.0"
@@ -29,7 +32,8 @@ android {
 }
 
 repositories {
-    mavenCentral()
+    google()
+    jcenter()
 }
 
 dependencies {

Essentially, add jcenter() and google() to the repositories and bump the gradle version

This is a workaround, not a solution. Maintainers should upgrade this project dependencies.

azuken avatar Mar 13 '23 08:03 azuken

Hi all 👋 I'd be happy to accept a PR for this and ship a new version is this is working for people

erezrokah avatar Mar 13 '23 08:03 erezrokah

Hi all 👋 I'd be happy to accept a PR for this and ship a new version is this is working for people

Happy to open a PR

prog-24 avatar Mar 13 '23 09:03 prog-24

I have a solution using patches. Here it is.

diff --git a/node_modules/react-native-settings/android/build.gradle b/node_modules/react-native-settings/android/build.gradle
index 6f8e7d0..9c98885 100644
--- a/node_modules/react-native-settings/android/build.gradle
+++ b/node_modules/react-native-settings/android/build.gradle
@@ -1,14 +1,17 @@
 buildscript {
     repositories {
         google()
+        jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:1.3.1'
+        classpath "com.android.tools.build:gradle:3.4.1"
     }
 }
 
 apply plugin: 'com.android.library'
 
+apply plugin: 'com.android.library'
+
 def projectVar(name, fallback) {
     return project.findProperty(name) ?: fallback
 }
@@ -18,7 +21,7 @@ android {
     buildToolsVersion projectVar('buildToolsVersion', '23.0.1')
 
     defaultConfig {
-        minSdkVersion 16
+        minSdkVersion projectVar('minSdkVersion', 16)
         targetSdkVersion projectVar('targetSdkVersion', 22)
         versionCode 1
         versionName "1.0"
@@ -29,7 +32,8 @@ android {
 }
 
 repositories {
-    mavenCentral()
+    google()
+    jcenter()
 }
 
 dependencies {

Essentially, add jcenter() and google() to the repositories and bump the gradle version

This is a workaround, not a solution. Maintainers should upgrade this project dependencies.

Semantics :D

prog-24 avatar Mar 13 '23 09:03 prog-24

So? any other solution ? its not working for me

YasarKantarcilar avatar May 29 '23 10:05 YasarKantarcilar

Still working for me with react native 0.70.9

x7Michi10x avatar Jul 06 '23 07:07 x7Michi10x

v1.0.2 fixed both things (minsdk & maven) mentioned in this thread.

For a little soap box talk - no one gave a PR to fix 2 lines of code for years. Granted no one has also responded in years so maybe I'm only one of a few left on this package.

We have to work together for open source packages - all it takes it one person to do a PR and its a few button clicks away from a release and fix.

iBotPeaches avatar Jun 10 '25 15:06 iBotPeaches