运行sdkmanager.bat --licenses - Android SDK后,您尚未接受许可证参数

时间:2018-01-11 07:05:58

标签: android react-native

这个问题在 S.O 中多次询问,但是,他们都没有帮助我,因为我在命令行中接受了许可。

我是反应和android的新手。我已经安装了android studio及其软件包。我发起反应,但它抱怨许可证。

的build.gradle:

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 enableProguardInReleaseBuilds = false

android {
     compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com...."
         minSdkVersion 25
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            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 fileTree(dir: "libs", include: ["*.jar"])
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile "com.facebook.react:react-native:+"  // From node_modules
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

当我跑步时

react-native run-android

结果是:

You have not accepted the licenses arguments

我使用了命令行并接受了许可证(S.O

All SDK package licenses accepted.

然而,它再次抱怨许可证。

1 个答案:

答案 0 :(得分:0)

JAVA_PATH 错误也会导致此错误。我在环境变量中注册了一个错误的java_path。将它改成正确的道路后,一切都像魅力一样。