android - React Native android 不使用 react-native-device-info 编译
问题描述
当我尝试使用$ react-native run-android
.
> Task :react-native-device-info:compileDebugJavaWithJavac FAILED
/Users/user/Desktop/mobile/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:31: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
/Users/user/Desktop/mobile/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:838: error: cannot find symbol
@Nullable Object data) {
^
symbol: class Nullable
location: class RNDeviceModule
Note: /Users/ammiel/Desktop/mobile/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILURE: Build failed with an exception.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-device-info:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
我已经 jetify 运行 postinstall 并且有
android.useAndroidX=true
android.enableJetifier=true
在我的 gradle.properties 中。
潜伏在许多页面/ github页面但没有成功:/任何帮助表示赞赏!
其他信息:
反应原生:0.59.10
反应本机设备信息:5.6.1
解决方案
我遇到了和你一样的问题!
但我设法通过添加依赖项来解决它。
yarn add react-native-device-info
哇!该应用程序现在正在运行。
推荐阅读
- sockets - NameError:名称“SOCKETS”未定义
- javascript - 如何使用 jsdom 在 input[text] 元素上创建 `oninput` 事件?
- c# - C# 进程无法使用特殊的 exe 获得输出
- django - Django,修改模型管理器的初始查询集有什么好处?
- angular - md-tab中的Angular SlickGrid动态网格未加载定义
- r - 删除主要 y 轴标签和刻度,同时保留辅助 y 轴的标签和刻度
- c# - 为什么我的重置高分的重置代码不起作用?
- sql - 在表“Y”上引入 FOREIGN KEY 约束“X”可能会导致循环或多个级联路径
- php - 检测 PHP 生成器是否接受 send()?
- flutter - 如何在不显示所选值的情况下创建下拉按钮