Ubuntu:我接受了所有许可,但仍然收到SDK错误

时间:2019-07-03 15:35:35

标签: android cordova sdk

我第一次尝试创建一个虚拟应用程序。我安装了所需的组件,包括cordova,android studion等。最初出现了许可证不被接受的问题。我去了Adroid / Sdk / tools / bin文件夹和sdkmanager并接受了许可证。接受许可证后:

Warning: File /home/mauricewaka/.android/repositories.cfg could not be loaded.  
All SDK package licenses accepted.======] 100% Computing updates...  

我仍然收到此错误:

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/usr/lib/android-sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app
WARNING: The specified Android SDK Build Tools version (27.0.1) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.0.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '27.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
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 14s
/home/mauricewaka/MyApp/hello/platforms/android/gradlew: Command failed with exit code 1 Error output:
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 14s

2 个答案:

答案 0 :(得分:0)

使用

yes | sdkmanager --licenses

接受所有许可

,然后再次构建。希望这会有所帮助。

如果得到

sdkmanager: command not found

这意味着您需要将以下文件夹添加到PATH

$ANDROID_SDK_HOME/tools/bin

那是sdkmanager居住的地方。

$ ANDROID_SDK_HOME需要替换为android sdk所在的目录-在我看来是ubuntu 18.04 LTS上的〜/ Android / Sdk /

希望有帮助。

答案 1 :(得分:0)

这有点奏效:

我输入并输入;

touch ~/.android/repositories.cfg

在输入之前:

./sdkmanager --licenses 

还去了Adnroid / Sdk / tools / bin

then typed ./sdkmanager "platforms;android-26"

您还可以使用“ platforms; android-28”等

重启终端后,它开始工作。