在Android模拟器上运行react-native项目不起作用

时间:2019-04-26 10:52:09

标签: android react-native cmd sdk android-gradle

由于我想在应用程序上使用蓝牙,因此我下载并链接了react-native-ble-plx。 当我尝试运行本机运行Android时,出现以下错误:

Task :app:processDebugManifest FAILED
C:\Users\Aurelien\Desktop\Leroy-Somer\AMJE nativ\AMJE\android\app\src\debug\AndroidManifest.xml Error:
    uses-sdk:minSdkVersion 16 cannot be smaller than version 18 declared in library [:react-native-ble-plx] C:\Users\Aurelien\Desktop\Leroy-Somer\AMJE nativ\AMJE\node_modules\react-native-ble-plx\android\build\intermediates\library_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 16
    Suggestion: use a compatible library with a minSdk of at most 16,
            or increase this project's minSdk version to at least 18,
            or use tools:overrideLibrary="com.polidea.reactnativeble" to force usage (may lead to runtime failures)

我知道我的SDK版本错误,但是我不知道如何更新

如何更新?

更新后我是否必须创建一个新的React Native项目?

2 个答案:

答案 0 :(得分:0)

如您在https://github.com/Polidea/react-native-ble-plx/blob/master/android/build.gradle所示,“ react-native-ble-plx”的min-sdk为18,但是您的项目的min-sdk为16。到目前为止,最简单的操作是转到“ project / android / app / build.gradle”文件,并将自己的min-sdk增加到18

答案 1 :(得分:0)

将app / build.gradle中的sdk最低版本更新为。

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

}
相关问题