简体   繁体   中英

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

Since I want to use Bluetooth on my application, I downloaded, and linked react-native-ble-plx. When I try react-native run-Android I have the following error:

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)

And I understand I have wrong SDK version but I have no idea how to update it

How to update it?

Do I have to create a new React Native project after updating it?

As you can see here https://github.com/Polidea/react-native-ble-plx/blob/master/android/build.gradle the "react-native-ble-plx" has min-sdk of 18 but your project has min-sdk of 16. So you are not eligible to use that library. By far the easiest thing that you can do is to go to your "project/android/app/build.gradle" file and increase your own min-sdk to 18

Update minimum sdk version in app/build.gradle as.

android {
    compileSdkVersion 28

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

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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