react native 0.55.2上的Android构建错误
Posted
技术标签:
【中文标题】react native 0.55.2上的Android构建错误【英文标题】:Android build error on react native 0.55.2 【发布时间】:2020-06-28 10:16:06 【问题描述】:尝试使用“react-native run-android”在 react-native 0.55.2 上运行项目,但出现以下错误
Configure project :rn-fetch-blob
WARNING: The following project options are deprecated and have been removed:
android.useDeprecatedNdk
NdkCompile is no longer supported
> Task :react-native-ble-manager:compileDebugJavaWithJavac FAILED
E:\premisehq-mobile-react-native\node_modules\react-native-ble-manager\android\src\main\java\it\innove\LollipopPeripheral.java:7: error: cannot find symbol
import android.support.annotation.RequiresApi;
^
symbol: class RequiresApi
location: package android.support.annotation
E:\premisehq-mobile-react-native\node_modules\react-native-ble-manager\android\src\main\java\it\innove\LollipopPeripheral.java:17: error: cannot find symbol
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
^
symbol: class RequiresApi
E:\premisehq-mobile-react-native\node_modules\react-native-ble-manager\android\src\main\java\it\innove\LollipopScanManager.java:11: error: cannot find symbol
import android.support.annotation.RequiresApi;
^
symbol: class RequiresApi
location: package android.support.annotation
E:\premisehq-mobile-react-native\node_modules\react-native-ble-manager\android\src\main\java\it\innove\LollipopScanManager.java:20: error: cannot find symbol
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
^
symbol: class RequiresApi
Note: E:\premisehq-mobile-react-native\node_modules\react-native-ble-manager\android\src\main\java\it\innove\LegacyScanManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 errors
FAILURE: Build failed with an exception.
【问题讨论】:
【参考方案1】:几个月前我遇到了同样的问题。 Android SDK 有所不同。 尝试在 build.gradle 中找出 SDK 的目标版本。 Android SDK 的版本和应用的目标版本应该相同。 希望这会对你有所帮助。
【讨论】:
以上是关于react native 0.55.2上的Android构建错误的主要内容,如果未能解决你的问题,请参考以下文章
更新 react-native-maps 以使用 create-react-native-app