ui icon indicating copy to clipboard operation
ui copied to clipboard

Android Build fails with new version of RN and @shoutem/ui (and react-native-linear-gradient)

Open 9paradox opened this issue 5 years ago • 4 comments

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"

9paradox avatar Sep 30 '18 09:09 9paradox

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 avatar Sep 30 '18 09:09 9paradox

@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
            }
        }
    }
}

SpaghettiC0des avatar Oct 01 '18 05:10 SpaghettiC0des

@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
            }
        }
    }
}

//
//

9paradox avatar Oct 02 '18 04:10 9paradox

Can't solve anything

alanyong91 avatar Mar 31 '19 04:03 alanyong91