ui
ui copied to clipboard
Android Build fails with new version of RN and @shoutem/ui (and react-native-linear-gradient)
hi, My android build fails when :
gradlew assembleRelease
with error :
Execution failed for task ':react-native-linear-gradient:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
package.js :
"dependencies": {
"@babel/runtime": "^7.1.2",
"@shoutem/ui": "^0.23.6",
"react": "16.5.0",
"react-native": "0.57.1",
"react-navigation": "^2.17.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.47.0",
"react-test-renderer": "16.5.0"
},
build.gradle :
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
hi,
i finally made it working by :
changing file *node_modules\react-native-linear-gradient\android\build.gradle file :
def DEFAULT_COMPILE_SDK_VERSION = 26
def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3" // only this line changed from 26.0.3 to 27.0.3
def DEFAULT_MIN_SDK_VERSION = 16
def DEFAULT_TARGET_SDK_VERSION = 26
and re ran :
npm install
npm update
react-native link
now after running :
gradlew assembleRelease
react-native run-android --variant=release
build gives success
please follow below method
@9paradox Have you tried adding this on your build.gradle
, instead of manually updating the package's build.gradle
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
@karlmarxlopez thanks 👍
//
//
// in your android/build.gradle
//
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"
}
google()
}
}
// add this lines
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
//
//
Can't solve anything