react-native run-android与react-native-ble-plx链接后失败
Task :react-native-ble-plx:compileDebugJavaWithJavac FAILED
这是一个带有react-native init的新创建的应用程序,除了min sdk之外没有任何更改。 已经尝试清理项目,将min sdk设置为18,尝试使用android studio进行构建以获取更多具体错误,但仍然无法理解问题的出处。
我得到的错误:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
12 actionable tasks: 2 executed, 10 up-to-date
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
/Users/oriamd/Documents/MyDev/DudeWheresMyCar/node_modules/react-native-ble-plx/android/src/main/java/com/polidea/reactnativeble/converter/RxBleScanResultConverter.java:3: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
/Users/oriamd/Documents/MyDev/DudeWheresMyCar/node_modules/react-native-ble-plx/android/src/main/java/com/polidea/reactnativeble/wrapper/Characteristic.java:5: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
完整日志在这里: https://pastebin.com/NJAmjUJm
可以根据需要提供更多信息。 谢谢
答案 0 :(得分:2)
此问题类似于此issue。
如@Kreator答案中所述,它与某些未转换为AndroidX的软件包有关。
要解决此问题,您可以使用jetifier。
我有问题中提到的相同问题,这些步骤解决了该问题,应用程序再次运行。
npm install --save-dev jetifier
npx jetify
npx react-native run-android
(您的应用程序应正确编译和运行)npx jetify
在package.json的安装后目标中运行(每当您的依赖项更新时,您都必须再次进行喷射)答案 1 :(得分:1)
问题是我使用的是Android Studio Preview,并且使用了AndroidX和更多不受支持的软件包。