gpt4 book ai didi

Android SDK 未构建

转载 作者:太空宇宙 更新时间:2023-11-04 09:58:43 24 4
gpt4 key购买 nike

我正在使用 ubuntu 18.04,我正在学习 react-native。

我没有安装 Android Studio,而是安装了 Genymotion 作为我的 android 模拟器用于测试,并使用 sudo apt-get install android-sdk 安装了 Android SDK

安装react和react native工具后,我创建了一个新的react-native项目,并尝试在不接触任何代码的情况下运行它,但出现以下错误

$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 863 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...

> Configure project :app
Observed package id 'build-tools;debian' in inconsistent location '/usr/lib/android-sdk/build-tools/27.0.1' (Expected '/usr/lib/android-sdk/build-tools/debian')
Observed package id 'build-tools;debian' in inconsistent location '/usr/lib/android-sdk/build-tools/27.0.1' (Expected '/usr/lib/android-sdk/build-tools/debian')
Checking the license for package Android SDK Build-Tools 28.0.3 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
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: /usr/lib/android-sdk

* 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 2s

error Failed to install the app. Please accept all necessary SDK licenses using SDK Manager: "$ANDROID_HOME/tools/bin/sdkmanager --licenses". Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
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: /usr/lib/android-sdk

* 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 2s

at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (/home/arilanto/Documents/srcs/native/rdrxn/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:74:39)
at buildAndRun (/home/arilanto/Documents/srcs/native/rdrxn/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/home/arilanto/Documents/srcs/native/rdrxn/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)

错误消息建议我使用 /usr/lib/android-sdk/tools/bin/sdkmanager --licenses 但没有这样的文件或符号链接(symbolic link)

$ ls -la /usr/lib/android-sdk/tools/bin/
total 8
drwxr-xr-x 2 root root 4096 sept. 25 10:11 .
drwxr-xr-x 4 root root 4096 sept. 25 10:11 ..
lrwxrwxrwx 1 root root 12 mars 11 2019 e2fsck -> /sbin/e2fsck
lrwxrwxrwx 1 root root 15 mars 11 2019 fsck.ext4 -> /sbin/fsck.ext4
lrwxrwxrwx 1 root root 15 mars 11 2019 mkfs.ext4 -> /sbin/mkfs.ext4
lrwxrwxrwx 1 root root 15 mars 11 2019 resize2fs -> /sbin/resize2fs
lrwxrwxrwx 1 root root 27 mars 11 2019 screenshot2 -> ../../../../bin/screenshot2
lrwxrwxrwx 1 root root 13 mars 11 2019 tune2fs -> /sbin/tune2fs

我可以通过从在他们的 ubuntu 上安装 Android Studio 的人那里复制文件来完成这个 android-sdk 安装,还是我应该完全安装 Android Studio 并更改我的路径?

最佳答案

是的,您也可以从谷歌的网站下载它们,或者在下载“一体化”android studio 包时重新安装 sdk。还要查看文件夹(如果存在)/usr/lib/android-sdk-linux/tools/bin。您有错误/未完成的安装。如果某人的计算机运行 deb linux 发行版并且具有相似的处理器(例如,你们都使用 Intel),则可以只复制文件。

关于Android SDK 未构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58101168/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com