简体   繁体   English

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

[英]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. 由于我想在我的应用程序上使用蓝牙,我下载并链接react-native-ble-plx。 When I try react-native run-Android I have the following error: 当我尝试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)

And I understand I have wrong SDK version but I have no idea how to update it 我知道我有错误的SDK版本,但我不知道如何更新它

How to update it? 如何更新?

Do I have to create a new React Native project after updating it? 更新后我是否必须创建一个新的React Native项目?

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

Update minimum sdk version in app/build.gradle as. 将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.

相关问题 npx react-native run-android 不启动模拟器,如果模拟器正在运行则不运行 - npx react-native run-android doesn't start emulator and doesn't run if emulator is running 无法在Android模拟器上运行现有的react-native项目 - Trouble running existing react-native project on Android emulator 在android模拟器中运行react-native - running react-native in android emulator 为什么滑动不适用于 Android [React-Native] 上的 appium? - Why swipe doesn't work with appium on Android[React-Native]? 在 Android 模拟器中运行 npx react-native CLI 时出错 - Error in running npx react-native CLI in Android emulator 带有react-native的Android应用程序可以在模拟器上运行,但不能在物理设备上运行 - Android app with react-native works on emulator but doesn't on physical device 运行 react-native run-android 时,React Native 发布 apk 与应用程序不匹配 - React Native release apk doesn't match app when running react-native run-android 如何使警报在 android/emulator 上工作? (反应原生) - How to make Alert work on android/emulator? (react-native) 无法在模拟器上运行 react-native android(Androidx 问题) - Can't run react-native android on emulator (Androidx problem) 无法在 react-native 故事书的 android 模拟器上看到故事 - Can't see stories on android emulator for react-native storybook
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM