首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >任务执行失败“:react本机-图标:当运行react本机运行-android时编译器react”

任务执行失败“:react本机-图标:当运行react本机运行-android时编译器react”
EN

Stack Overflow用户
提问于 2017-07-25 08:59:54
回答 1查看 214关注 0票数 0

在我的项目中,我很难执行react-原生运行-android。我读过其他的几页,但它们似乎解决不了我的问题,我真的很感激你的帮助

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

代码语言:javascript
复制
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看起来是这样的:

代码语言:javascript
复制
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 --列表:“sdkmanager -列表结果的结果。

错误消息如下:反应-本机错误

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-07-25 11:10:36

也许你可以试试这个:

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

我希望我的回答能帮助你解决问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45298538

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档