当 运行ning react-native 运行-android 时,任务 ':react-native-icons:compileReleaseAidl' 执行失败

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

我在项目中执行本机反应 运行-android 时遇到问题。 我已经阅读了其他页面,但它们似乎并没有解决我的问题;非常感谢您的帮助

我的 android/build.gradle 看起来像这样:

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

我的 android/app/build.gradle 看起来像:

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'

这是"sdkmanager --list:"的结果 sdkmanager --list result

报错信息如下: react-native error

也许你可以试试这个:

  1. 从您的目录项目中移除文件夹 node_module
  2. 运行 npm install 在您的终端中。
  3. 安装库 react-native-iconsnpm install react-native-icons@latest --save
  4. 再试一次 运行 react-native run-android 您的项目。

希望我的回答能对您的问题有所帮助