尝试使用“ 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.
答案 0 :(得分:3)
几个月前,我遇到了同样的问题。 Android SDK 存在区别。 尝试在build.gradle中找到SDK的定位版本。 Android SDK的版本和应用的定位版本应相同。 希望对您有帮助。