【发布时间】:2021-03-01 21:14:38
【问题描述】:
在我的 ubuntu 中,我已经为 react native 项目安装了 Android SDK 和 OpenJDK 11。
在我的.zshrc 中,我设置了这样的路径:
export ANDROID_SDK_ROOT="$HOME/Android/cmdline-tools/tools/bin"
PATH="$PATH:$ANDROID_SDK_ROOT"
当我运行sdkmanager --version 时,我有3.0 作为响应(我的路径似乎还可以)。
这个问题很奇怪,当我运行sdkmanager --licenses我有以下结果All SDK package licenses accepted.======] 100% Computing updates...
但是当我在我的项目中运行yarn android 时,出现以下错误:
> Configure project :react-native-reanimated
Checking the license for package SDK Patch Applier v4 in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package SDK Patch Applier v4 not accepted.
Checking the license for package Android Emulator in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package Android Emulator not accepted.
Checking the license for package Android SDK Platform-Tools in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package Android SDK Platform-Tools not accepted.
Checking the license for package Android SDK Tools in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package Android SDK Tools not accepted.
Checking the license for package Android SDK Build-Tools 29.0.2 in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package Android SDK Build-Tools 29.0.2 not accepted.
Checking the license for package Android SDK Platform 29 in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package Android SDK Platform 29 not accepted.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* Where:
Build file '/home/hadock/samus/Projects/rm/rm-app/node_modules/react-native-reanimated/android/build.gradle' line: 89
* What went wrong:
A problem occurred configuring project ':react-native-reanimated'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
platform-tools Android SDK Platform-Tools
patcher;v4 SDK Patch Applier v4
emulator Android Emulator
platforms;android-29 Android SDK Platform 29
tools Android SDK Tools
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: /home/hadock/Android/cmdline-tools/tools/bin
* 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 5s
error Failed to install the app. Please accept all necessary Android SDK licenses using Android SDK Manager: "$ANDROID_HOME/tools/bin/sdkmanager --licenses". Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
error Command failed with exit code 1.
看起来有些许可证没有签名,但命令告诉我一切正常。
有关信息:
yarn android 启动 react-native run-android
我的 sdkmanager 存储在 ~/Android
hadock in ~/Android
➜ ls
build-tools cmdline-tools emulator licenses patcher platforms platform-tools tools
hadock in ~/Android
➜ tree cmdline-tools/bin
cmdline-tools/bin
├── apkanalyzer
├── avdmanager
├── lint
├── screenshot2
└── sdkmanager
0 directories, 5 files
sdkmanager --list(一部分)
Installed packages:=====================] 100% Computing updates...
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;29.0.2 | 29.0.2 | Android SDK Build-Tools 29.0.2 | build-tools/29.0.2/
build-tools;29.0.3 | 29.0.3 | Android SDK Build-Tools 29.0.3 | build-tools/29.0.3/
emulator | 30.4.5 | Android Emulator | emulator/
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/
platform-tools | 31.0.0 | Android SDK Platform-Tools | platform-tools/
platforms;android-29 | 5 | Android SDK Platform 29 | platforms/android-29/
我的配置(neofetch)
➜ neofetch
`.:/ossyyyysso/:. hadock@hadock-legion
.:oyyyyyyyyyyyyyyyyyyo:` --------------------
-oyyyyyyyodMMyyyyyyyysyyyyo- OS: Kubuntu 20.10 x86_64
-syyyyyyyyyydMMyoyyyydmMMyyyyys- Host: 81FV Lenovo Legion Y530-15ICH
oyyysdMysyyyydMMMMMMMMMMMMMyyyyyyyo Kernel: 5.8.0-44-generic
`oyyyydMMMMysyysoooooodMMMMyyyyyyyyyo` Uptime: 2 hours, 42 mins
oyyyyyydMMMMyyyyyyyyyyyysdMMysssssyyyo Packages: 2333 (dpkg), 18 (snap)
-yyyyyyyydMysyyyyyyyyyyyyyysdMMMMMysyyy- Shell: zsh 5.8
oyyyysoodMyyyyyyyyyyyyyyyyyyydMMMMysyyyo Resolution: 1920x1080
yyysdMMMMMyyyyyyyyyyyyyyyyyyysosyyyyyyyy DE: Plasma 5.19.5
yyysdMMMMMyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy WM: KWin
oyyyyysosdyyyyyyyyyyyyyyyyyyydMMMMysyyyo WM Theme: Layan
-yyyyyyyydMysyyyyyyyyyyyyyysdMMMMMysyyy- Theme: Breeze Dark [Plasma], Breeze-Dark [GTK2], Breeze [GTK3]
oyyyyyydMMMysyyyyyyyyyyysdMMyoyyyoyyyo Icons: Fluent [Plasma], Fluent [GTK2/3]
`oyyyydMMMysyyyoooooodMMMMyoyyyyyyyyo Terminal: konsole
oyyysyyoyyyysdMMMMMMMMMMMyyyyyyyyo Terminal Font: JetBrains Mono NL 10
-syyyyyyyyydMMMysyyydMMMysyyyys- CPU: Intel i5-8300H (8) @ 4.000GHz
-oyyyyyyydMMyyyyyyysosyyyyo- GPU: Intel UHD Graphics 630
./oyyyyyyyyyyyyyyyyyyo/. GPU: NVIDIA GeForce GTX 1050 Ti Mobile
`.:/oosyyyysso/:.` Memory: 3281MiB / 15883MiB
如果您想了解更多信息,请随时询问。
我已经检查了其他一些回复,例如:
【问题讨论】:
标签: android react-native