当您尝试运行命令时:
react-native run-android
发生以下错误:
> Task :react-native-gesture-handler:compileDebugJavaWithJavac
Note: C:\Users\jefer\Desktop\react\new\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :app:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Package 'com.new' from AndroidManifest.xml is not a valid Java package name as 'new' is a Java keyword.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 23s
23 actionable tasks: 21 executed, 2 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug
我尝试使用:
cd android && gradlew clean
但是它并不能解决问题...我还删除了android和iOS文件夹,并使用了以下命令:
react-native eject
react-native link
但是没有用。
答案 0 :(得分:0)
您的应用程序包名称存在问题
您在AndroifManifest.xml中将应用程序包名称设置为 com.new 无效。更改应用程序包名称,因为新是Java中的保留关键字