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
如果需要,可以提供更多信息。谢谢
发布于 2019-07-12 00:23:50
此问题与此issue类似。
正如@Kreator answer中提到的,它与一些未转换为AndroidX的包有关。
要解决此问题,您可以使用jetifier。
我在问题中提到了同样的问题,这些步骤解决了它,然后应用程序再次运行。
运行首先,使用Android Studio的重构工具来转换你的应用re:Android developer docs
npm install --save-dev jetifier
npx jetify
npx react-native run-android (你的应用应该能正确编译和工作)
npx jetify运行在你的package.json的安装后目标中(任何时候你的依赖更新你必须再次jetify )发布于 2019-07-08 16:33:03
问题是我使用的是Android Studio Preview,以及AndroidX和更多不支持的软件包。
https://stackoverflow.com/questions/56926169
复制相似问题