Search code examples
javascriptandroidmobilereact-nativemacos-sierra

Execution failed for task ':react-native-icons:compileReleaseAidl' when running react-native run-android


I'm having trouble performing react-native run-android in my project. I've read other pages but they don't seem to resolve my problems; I really appreciate the help

My android/build.gradle looks like this:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'

        // 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"
        }
    }
}

and my android/app/build.gradle looks like:

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-sentry/sentry.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

def enableSeparateBuildPerCPUArchitecture = true

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 2
        versionName "1.2.1"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk true  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
    buildTypes {
        debug{
            manifestPlaceholders = [permissionName:"android.permission.VIBRATE"]
        }
        release {
	        manifestPlaceholders = [permissionName:"android.permission.SYSTEM_ALERT_WINDOW"]
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
	    signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-maps')
    compile project(':react-native-sentry')
    compile project(':react-native-fcm')
    compile 'com.google.firebase:firebase-core:10.2.4'
    compile project(':react-native-image-picker')
    compile project(':react-native-smart-splash-screen')
    compile project(':react-native-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile 'com.amplitude:android-sdk:2.13.4'
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    // compile project(':react-native-smart-splashscreen')  // From node_modules
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.google.gms.google-services'

This is the result of "sdkmanager --list:" sdkmanager --list result

The error message is as follows: react-native error


Solution

  • maybe you can try this :

    1. Romove folder node_module from your directory project.
    2. Run npm install in your terminal.
    3. Install library react-native-icons with npm install react-native-icons@latest --save.
    4. Try again to Run react-native run-android on your project.

    i hope my answer can helping your problem.