繁体   English   中英

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

[英]Running react-native project on Android emulator doesn't work

由于我想在我的应用程序上使用蓝牙,我下载并链接react-native-ble-plx。 当我尝试react-native run-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项目?

正如你在这里看到的那样https://github.com/Polidea/react-native-ble-plx/blob/master/android/build.gradle“react-native-ble-plx ”的min-sdk为18,但你的project的min-sdk为16.所以你没有资格使用该库。 到目前为止,您可以做的最简单的事情是转到“project / android / app / build.gradle”文件并将自己的min-sdk增加到18

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

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM