首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android SDK未构建

Android SDK未构建
EN

Stack Overflow用户
提问于 2019-09-25 22:49:29
回答 1查看 897关注 0票数 0

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

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

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

代码语言:javascript
复制
$ 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,但没有这样的文件或符号链接

代码语言:javascript
复制
$ 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并更改我的路径?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-25 23:36:05

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58101168

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档