React Native运行问题:Warning: License for package Android SDK Platform 28 not accepted.

这个问题是我在安装RN环境成功、创建项目成功项目之后,准备安装项目的时候出现的问题

运行的命令行为:

react-native run-android

在排除了Android环境变量 Android/Gradlew运行权限命令行所在目录的问题之后,我找到了问题所在:

SDK Platform的协议没有被允许/换句话说,没权限

解决方法:

1.用cmd命令行,进入sdk/tools/bin目录下

2.输入

sdkmanager --licenses

接下来稍等片刻,会弹出一大堆协议内容,然后让你选同不同意:[y/N]

废话当然同意!

但是别急,接下来还有好几个协议,一路输入yyyyyyyy.....

OK了,开始安装吧!

react-native run-android

 

第一次安装需要等环境编译成功才会安装,所以读条较久,大概花了五分钟结束

我安装成功了~

=========----> 73% EXECUTING [4m 11s]id SDK Platform 23 in D:\AndroidDev\SDK\licenses License for package Android SDK Platform 23 accepted. Preparing "Install Android SDK Platform 23 (revision: 3)". "Install Android SDK Platform 23 (revision: 3)" ready. Installing Android SDK Platform 23 in D:\AndroidDev\SDK\platforms\android-23 > Task :react-native-mqtt:compileDebugJavaWithJavacished. > Task :react-native-mqtt:compileDebugJavaWithJavac FAILED Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.f :app:debugRuntimeClasspath > bcprov-jdk15on-1.54.jar > 815.3 KiB/3.1 MiB downloaded See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings 443 actionable tasks: 18 executed, 425 up-to-date Warning: This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times. D:\AwesomeProject\node_modules\react-native-mqtt\android\src\main\java\com\tuanpm\RCTMqtt\RCTMqttModule.java:29: ��� �: �Ҳ������� import com.facebook.react.LifecycleState; ^ ����: �� LifecycleState λ��: ����� com.facebook.react D:\AwesomeProject\node_modules\react-native-mqtt\android\src\main\java\com\tuanpm\RCTMqtt\RCTMqttPackage.java:26: ����: �������Ḳ�ǻ�ʵ�ֳ����͵ķ��� @Override ^ 2 ������ FAILURE: Build failed with an exception. > IDLE * What went wrong: Execution failed for task ':react-native-mqtt:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. > :react-native-mqtt:compileDebugJavaWithJavac > Resolve files of :react-native-mqtt:debugCompileClasspath * Try: > Run with --stacktrace option to get the stack trace.-jdk15on-1.54.jar > 735.3 KiB/3.1 MiB downloaded > 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 6m 13s error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 Warning: This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times. D:\AwesomeProject\node_modules\react-native-mqtt\android\src\main\java\com\tuanpm\RCTMqtt\RCTMqttModule.java:29: ��� �: �Ҳ������� import com.facebook.react.LifecycleState; ^ ����: �� LifecycleState λ��: ����� com.facebook.react D:\AwesomeProject\node_modules\react-native-mqtt\android\src\main\java\com\tuanpm\RCTMqtt\RCTMqttPackage.java:26: ����: �������Ḳ�ǻ�ʵ�ֳ����͵ķ��� @Override ^ 2 ������ FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-mqtt:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. * 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 6m 13s at makeError (D:\AwesomeProject\node_modules\execa\index.js:174:9) at D:\AwesomeProject\node_modules\execa\index.js:278:16 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async runOnAllDevices (D:\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5) at async Command.handleAction (D:\AwesomeProject\node_modules\@react-native-community\cli\build\index.js:192:9) info Run CLI with --verbose flag for more details.
最新发布
08-15
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值