【问题标题】:Execution failed for task ':react-native-icons:compileReleaseAidl' when running react-native run-android运行 react-native run-android 时任务“:react-native-icons:compileReleaseAidl”执行失败
【发布时间】:2017-07-25 08:59:54
【问题描述】:

我在我的项目中执行 react-native run-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

【问题讨论】:

    标签: javascript android mobile react-native macos-sierra


    【解决方案1】:

    也许你可以试试这个:

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

    希望我的回答能帮到你。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-14
      • 2022-11-05
      • 1970-01-01
      • 2022-11-08
      • 1970-01-01
      • 2021-05-03
      • 1970-01-01
      • 2019-11-08
      相关资源
      最近更新 更多