Hey there,
that might be a noobish question but I get the following error:
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-keychain'.
> The SDK Build Tools revision (23.0.1) is too low for project ':react-native-keychain'. Minimum required is 25.0.0
app/build.gradle
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId 'com.blablaapp.app.android'
minSdkVersion 16
targetSdkVersion 22
ndk {
abiFilters "armeabi-v7a", "x86"
}
renderscriptTargetApi 20
renderscriptSupportModeEnabled true
}
...
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.facebook.react:react-native:+'
// From node_modules
compile project(':react-native-background-timer')
compile project(':react-native-i18n')
compile project(':react-native-keychain')
compile project(':react-native-navigation')
compile project(':react-native-vector-icons')
compile project(':react-native-orientation')
compile project(':react-native-linear-gradient')
compile project(':bugsnag-react-native')
compile project(':react-native-blur')
compile project(':react-native-picker')
compile project(':react-native-svg')
compile project(':react-native-wheel-picker')
compile project(':react-native-code-push')
compile project(':instabug-reactnative')
compile project(':react-native-maps')
compile project(':react-native-firebase')
}
Any ideas what might have went wrong?
Thank you!
@SudoPlz Check your android/build.gradle I moved files from a project to an older and I haved to downgrade my build gradle version from 2.3.2 to 2.2.3
dependencies {
// classpath 'com.android.tools.build:gradle:2.3.2' //before
classpath 'com.android.tools.build:gradle:2.2.3' //to solve problem
}
Ok I found a solution to this.
For people facing the same problem in the future, here's what I did:
I added the following to my root build gradle android/build.gradle
(Not the android/app/build.gradle)
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
}
}
}
}
That forces all the submodules to use the specified compileSdkVersion and buildToolsVersion.
Problem gone now.
saved the day ! Thanks.
Thank you very much @SudoPlz
@SudoPlz after I have added the lines to force the submodules to use the specified compileSdkVersion , the build problem is gone. But the application is showing message "unfortunately app has stopped". how would I solve it, has anyone faced this issue?
Hmm, no, I didn't have any problems.
It could be that one of your modules requires an sdk version higher than 25.
@SudoPlz thanks for your quick reply.
Here are my dependencies:
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.45.1",
"react-native-blur": "^3.1.2",
"react-native-google-places": "^2.1.0",
"react-native-keyboard-aware-scroll-view": "^0.2.9",
"react-native-vector-icons": "^4.2.0",
"react-navigation": "^1.0.0-beta.11"
},
So what can i do to ?
Well I'd check each of those projects dependencies to see the minimum sdk they support.
i.e react-native-blur requires version 16 or higher so that's not the problem.
Just a suggestion.
@SudoPlz you are a godsend
No probs @tomauty I hope that helped :)
We've been clicking "Update build tools and rebuild" for like 15 libs on android studio for months now...haha. So, yes.
Will the future code look like this? The file path is android/build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
}
}
}
}
If you have Android Studio, just import your project into the IDE, and then a warning about this error will be showed. Just click on the link "Update SDK". And it is solved without forcing any library to use a downgraded version of the SDK.
@flaviocolonna That works if you're building locally, but not if your build is on a CI.
@SudoPlz Simply Awesome. You are a life saver for all
No problem man, I'm glad this works for you.
@SudoPlz Thank you for sharing this solution for us
but I have a question if you don't mind. by following your solution, all packages which use compileSdkVersion lower than 25 will be forced to use 25. What if some packages are not compatible with the newer version? For instance, Facebook-login. Thank you.
That's a good question @gungungun93.
The solution above is not ideal, but works.
Everyone should take a look at the libraries they're using, and find the lowest common denominator version to use for all projects.
It would be cool if someone wrote a script that checks the module name with a simple if clause, and allows people to manually define the version of each and every dependency individually.
I might do that myself, but I have zero time at the moment.
after i upgrade version to 25.0.2 , DEX error is coming ,
Ok I found a solution to this.
For so many peoples facing the same problem in the future, here's what I did:
I added the following to my root build gradle android/build.gradle
(Not the android/app/build.gradle)
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 25 0r 26
buildToolsVersion '25.0.0'
}
}
}
}
its working good
Most helpful comment
Ok I found a solution to this.
For people facing the same problem in the future, here's what I did:
I added the following to my root build gradle
android/build.gradle(Not the android/app/build.gradle)
That forces all the submodules to use the specified
compileSdkVersionandbuildToolsVersion.Problem gone now.