I try to build using android studio but it fails resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found. pointing to the react-native-config. I know that it has to do with the fact that colorError i ssupported in android 26 or higher and this package is on 23, how could I fix this without downgrading?
By forcing other packages to use 27
Set this code in android/build.gradle
subprojects {
afterEvaluate {
project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion = 27
buildToolsVersion = "27.0.3"
}
}
}
}
And for react native v0.59+ update buildToolsVersion to 28
subprojects {
afterEvaluate {
project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion = 28
buildToolsVersion = "28.0.3"
}
}
}
}
Just to ask: is there any possibility of a new release for this problem? I have tried to upgrade a forked version and it seems to not create any problem...or would that bring compatibility problems?
Thanks @Summys
Formatted code, place this inside allprojects {
// force libs to use recent buildtools
// https://github.com/luggit/react-native-config/issues/299
subprojects {
afterEvaluate {
project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion = 27
buildToolsVersion = "27.0.3"
}
}
}
}
@Tommos0 @Summys This worked for me, but I would like to understand it. For every project, like react-native-config that I am implementing, it forces them to take the applied version? Presumably I could tell it to only apply to react-native-config? Or am I off?
Much appreciated.
@Tommos0 and @Summys answer worked liked charm with me
@Tommos0 you saved me!!!!
@Tommos0 BUILD SUCCESSFUL in 1m 54s
Thank you for structured version of that piece of config.
God bless you!
In gradle-wrapper.properties
change distributionUrl version to 4.1
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip
If you are using RN 59 you need an updated version of @Summys and @Tommos0 's answers inside allprojects in build.gradle:
subprojects {
afterEvaluate {
project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion = 28
buildToolsVersion = "28.0.3"
}
}
}
}
@AdamZaczek 我使用了这种方式。解决了我的问题!
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven { url "https://jitpack.io" }
google()
maven { url 'https://maven.google.com'
name 'Google'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
subprojects {
afterEvaluate {
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
targetSdkVersion 28
}
}
}
// project.configurations.all {
// resolutionStrategy.eachDependency { details ->
// if (details.requested.group == 'com.android.support'
// && !details.requested.name.contains('multidex') ) {
// details.useVersion "27.0.3"
// }
// }
// afterEvaluate {
// android {
// compileSdkVersion 28
// buildToolsVersion "28.0.3"
// defaultConfig {
// targetSdkVersion 28
// }
// }
// }
// }
}
}
thank @Tommos0 ....God Bless You...
Thanks @Summys
If you are using RN 59 you need an updated version of @Summys and @Tommos0 's answers inside allprojects in build.gradle:
subprojects { afterEvaluate { project -> if (project.hasProperty("android")) { android { compileSdkVersion = 28 buildToolsVersion = "28.0.3" } } } }
It's work. My build.gradle here
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.5.3.
what to do?
Most helpful comment
Thanks @Summys
Formatted code, place this inside
allprojects {