android - 在 Android 模拟器上运行 react-native 项目不起作用
问题描述
因为我想在我的应用程序上使用蓝牙,所以我下载并链接了 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 项目?
解决方案
将 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"
}
}
推荐阅读
- java - 翻译 Func Java -> 节点(使用 nextBytes)
- javascript - 仅使用 RSS 而不是使用堆的 Nodejs 内存泄漏
- python - 如何在 xarray 中拆分单个月份?
- java - AWS SES 在本地主机上工作,但在我的托管网站上不工作
- javascript - 为什么three.module.js的AnimationMixer与three.min.js的工作方式不同
- javascript - 有没有办法避免在 Pixi.js 中的同一位置绘制多个点?
- jquery - jQuery一个接一个地选择一个元素
- python - 如何验证包含浮点类型字符串元组的字段?
- bash - awk/sed -- 打印 c 文件中的所有 printfs
- python - 用不同的颜色设置散点图的 1 个点