gpt4 book ai didi

android - React native android 不使用 react-native-device-info 编译

转载 作者:行者123 更新时间:2023-12-05 00:04:44 30 4
gpt4 key购买 nike

当我尝试使用 $ 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 页面但没有成功:/任何帮助表示赞赏!

其他信息:

native react :0.59.10

react native 设备信息:5.6.1

最佳答案

我遇到了和你一样的问题!

但我设法通过添加依赖项来解决它。

yarn add react-native-device-info

沃拉!该应用程序正在运行。

关于android - React native android 不使用 react-native-device-info 编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62419195/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com