0

I have clone a react-native project and install yarn and run npm install command. But when i am running react-native run-android, terminal give me error.

:app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Below is my app/build.gradle file

    apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
    entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "com.granite"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}
dependencies {
    compile project(':react-native-blur')
    compile project(':react-native-image-picker')
    compile project(':instabug-reactnative')
    compile project(':appcenter-crashes')
    compile project(':appcenter-analytics')
    compile project(':appcenter')
    compile project(':react-native-text-input-mask')
    compile project(':react-native-i18n')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

My npm and yarn installations were successful. and buildtools version 23.0.1 i have also change it to 26.0.1 but this not resolve error.

How can i resolve this issue??

GAURAV
  • 647
  • 6
  • 18

1 Answers1

0

so assuming the npm and yarn installations were succesfull (resole problems here first)

this tool is sometimes tricky or better to say a little fragile. in the most cases its enough to re-run the "react-native run-android" command or reboot and run it then again

alternativly check the version of buildTools:

see related question here

edit 1 (see comment)

and do you checked it if its the right version? you can see what you have under your android sdk folder

check it in Powershell 
cd $ENV:Android_home\build-tools
ls

(or navigate maually to your android folder (Android\Sdk\build-tools))

so your buildToolsVersion have to match one of the folders names

for "23.0.1" the file ([projectname]/android/app/build.gradle) should look like this

android {
  compileSdkVersion 23
  buildToolsVersion "23.0.1"

 defaultConfig {......
  • My npm and yarn installations were successful. and buildtools version 23.0.1 i have also change it to 26.0.1 but this not resolve error – GAURAV Jun 05 '18 at 08:08
  • and do you checked it if its the right version? you can see what you have under your android sdk folder check it in Powershell cd $ENV:Android_home\build-tools ls (or navigate maually to your android folder (Android\Sdk\build-tools)) so your buildToolsVersion have to match one of the folders names for "23.0.1" the file ([projectname]/android/app/build.gradle) should look like this android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { – PrinzAndreVonLandmann Jun 06 '18 at 06:11
  • Yes i have check in sdk, i have many folders like 23.0.1 , 26.0.1 and many more. but my problem is solved by adding " multiDexEnabled true " in app/build.gradle...but i don't know what was the problem – GAURAV Jun 06 '18 at 06:31
  • that just should be a problem if you have more than 64k methods according to: https://stackoverflow.com/questions/36856068 – PrinzAndreVonLandmann Jun 06 '18 at 07:19
  • I´d appreciate a rate up or an mark as Answer if I could help you with your problem – PrinzAndreVonLandmann Jun 07 '18 at 08:43