Failed to install the following Android SDK packages as some licences have not been accepted

Hi everybody,

I’m trying to publish my app. So far I’ve been able to overcome all obstacles in that process. But after already having spent hours on this one I’d like to ask for help.

During build I get this output:

jens@linux7:~/fdroiddata$ fdroid build -v -l com.jens.automation2
2021-03-05 18:16:52,577 DEBUG: Reading ‘config.yml’
2021-03-05 18:16:52,656 DEBUG: Popen([‘git’, ‘cat-file’, ‘–batch-check’], cwd=/home/jens/fdroiddata, universal_newlines=False, shell=None, istream=)
2021-03-05 18:16:52,668 DEBUG: Popen([‘git’, ‘diff’, ‘–cached’, ‘–abbrev=40’, ‘–full-index’, ‘–raw’], cwd=/home/jens/fdroiddata, universal_newlines=False, shell=None, istream=None)
2021-03-05 18:16:52,712 DEBUG: Popen([‘git’, ‘diff’, ‘–abbrev=40’, ‘–full-index’, ‘–raw’], cwd=/home/jens/fdroiddata, universal_newlines=False, shell=None, istream=None)
2021-03-05 18:16:52,888 DEBUG: Popen([‘git’, ‘ls-files’, ‘–modified’], cwd=/home/jens/fdroiddata, universal_newlines=False, shell=None, istream=None)
2021-03-05 18:16:53,096 DEBUG: Popen([‘git’, ‘status’, ‘–porcelain’, ‘–untracked-files’], cwd=/home/jens/fdroiddata, universal_newlines=False, shell=None, istream=None)
2021-03-05 18:16:54,144 DEBUG: skip deploying full build logs: not enabled in config
2021-03-05 18:16:54,264 DEBUG: Getting git vcs interface for https://git.server47.de/jens/Automation.git
2021-03-05 18:16:54,264 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:16:54,264 DEBUG: > git rev-parse --show-toplevel
2021-03-05 18:16:54,473 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:16:54,473 DEBUG: > git submodule foreach --recursive git reset --hard
2021-03-05 18:16:54,583 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:16:54,583 DEBUG: > git submodule foreach --recursive git clean -dffx
2021-03-05 18:16:54,692 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:16:54,692 DEBUG: > git -c core.askpass=/bin/true -c core.sshCommand=/bin/false -c url.https://.insteadOf=ssh:// -c url.https://u:p@bitbucket.org/.insteadOf=git@bitbucket.org: -c url.https://u:p@bitbucket.org.insteadOf=git://bitbucket.org -c url.https://u:p@bitbucket.org.insteadOf=https://bitbucket.org -c url.https://u:p@github.com/.insteadOf=git@github.com: -c url.https://u:p@github.com.insteadOf=git://github.com -c url.https://u:p@github.com.insteadOf=https://github.com -c url.https://u:p@gitlab.com/.insteadOf=git@gitlab.com: -c url.https://u:p@gitlab.com.insteadOf=git://gitlab.com -c url.https://u:p@gitlab.com.insteadOf=https://gitlab.com fetch origin
2021-03-05 18:17:00,108 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:00,108 DEBUG: > git -c core.askpass=/bin/true -c core.sshCommand=/bin/false -c url.https://.insteadOf=ssh:// -c url.https://u:p@bitbucket.org/.insteadOf=git@bitbucket.org: -c url.https://u:p@bitbucket.org.insteadOf=git://bitbucket.org -c url.https://u:p@bitbucket.org.insteadOf=https://bitbucket.org -c url.https://u:p@github.com/.insteadOf=git@github.com: -c url.https://u:p@github.com.insteadOf=git://github.com -c url.https://u:p@github.com.insteadOf=https://github.com -c url.https://u:p@gitlab.com/.insteadOf=git@gitlab.com: -c url.https://u:p@gitlab.com.insteadOf=git://gitlab.com -c url.https://u:p@gitlab.com.insteadOf=https://gitlab.com fetch --prune --tags --force origin
2021-03-05 18:17:00,518 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:00,518 DEBUG: > git remote set-head origin --auto
2021-03-05 18:17:01,028 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:01,028 DEBUG: > git checkout -f HEAD
2021-03-05 18:17:01,139 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:01,139 DEBUG: > git clean -dffx
2021-03-05 18:17:01,351 DEBUG: skip deploying full build logs: not enabled in config
2021-03-05 18:17:01,351 DEBUG: Getting git vcs interface for https://git.server47.de/jens/Automation.git
2021-03-05 18:17:01,352 DEBUG: > git --version
git version 2.30.1
2021-03-05 18:17:01,561 INFO: Using git version 2.30.1
2021-03-05 18:17:01,561 DEBUG: Checking 1.6.21
2021-03-05 18:17:01,561 INFO: Building version 1.6.21 (96) of com.jens.automation2
2021-03-05 18:17:01,561 INFO: Getting source for revision bb22bcee95e3c6cf6c9ba350e1fc7353da51d97b
2021-03-05 18:17:01,562 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:01,562 DEBUG: > git rev-parse --show-toplevel
2021-03-05 18:17:01,771 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:01,771 DEBUG: > git submodule foreach --recursive git reset --hard
2021-03-05 18:17:01,980 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:01,980 DEBUG: > git submodule foreach --recursive git clean -dffx
2021-03-05 18:17:02,089 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:02,089 DEBUG: > git -c core.askpass=/bin/true -c core.sshCommand=/bin/false -c url.https://.insteadOf=ssh:// -c url.https://u:p@bitbucket.org/.insteadOf=git@bitbucket.org: -c url.https://u:p@bitbucket.org.insteadOf=git://bitbucket.org -c url.https://u:p@bitbucket.org.insteadOf=https://bitbucket.org -c url.https://u:p@github.com/.insteadOf=git@github.com: -c url.https://u:p@github.com.insteadOf=git://github.com -c url.https://u:p@github.com.insteadOf=https://github.com -c url.https://u:p@gitlab.com/.insteadOf=git@gitlab.com: -c url.https://u:p@gitlab.com.insteadOf=git://gitlab.com -c url.https://u:p@gitlab.com.insteadOf=https://gitlab.com fetch origin
2021-03-05 18:17:02,499 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:02,500 DEBUG: > git -c core.askpass=/bin/true -c core.sshCommand=/bin/false -c url.https://.insteadOf=ssh:// -c url.https://u:p@bitbucket.org/.insteadOf=git@bitbucket.org: -c url.https://u:p@bitbucket.org.insteadOf=git://bitbucket.org -c url.https://u:p@bitbucket.org.insteadOf=https://bitbucket.org -c url.https://u:p@github.com/.insteadOf=git@github.com: -c url.https://u:p@github.com.insteadOf=git://github.com -c url.https://u:p@github.com.insteadOf=https://github.com -c url.https://u:p@gitlab.com/.insteadOf=git@gitlab.com: -c url.https://u:p@gitlab.com.insteadOf=git://gitlab.com -c url.https://u:p@gitlab.com.insteadOf=https://gitlab.com fetch --prune --tags --force origin
2021-03-05 18:17:02,910 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:02,911 DEBUG: > git remote set-head origin --auto
2021-03-05 18:17:03,420 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:03,420 DEBUG: > git checkout -f bb22bcee95e3c6cf6c9ba350e1fc7353da51d97b
2021-03-05 18:17:03,633 DEBUG: Directory: build/com.jens.automation2
2021-03-05 18:17:03,633 DEBUG: > git clean -dffx
2021-03-05 18:17:03,743 INFO: Creating local.properties file at build/com.jens.automation2/local.properties
2021-03-05 18:17:03,743 INFO: Creating local.properties file at build/com.jens.automation2/app/local.properties
2021-03-05 18:17:03,743 DEBUG: Removing debuggable flags from build/com.jens.automation2/app
2021-03-05 18:17:03,751 INFO: Cleaning Gradle project…
2021-03-05 18:17:03,751 DEBUG: Directory: build/com.jens.automation2/app
2021-03-05 18:17:03,754 DEBUG: > /usr/lib/python3/dist-packages/gradlew-fdroid clean
Found 6.5 via distributionUrl
Running /home/jens/.cache/fdroidserver/gradle/6.5/bin/gradle clean

Task :app:clean UP-TO-DATE

BUILD SUCCESSFUL in 2s
1 actionable task: 1 up-to-date
2021-03-05 18:17:06,671 INFO: Scanning source for common problems…
2021-03-05 18:17:06,689 INFO: Ignoring usual suspect ‘firebase’ at app/build.gradle
2021-03-05 18:17:06,697 INFO: Ignoring usual suspect ‘google.*play.*services’ at app/build.gradle
2021-03-05 18:17:06,751 INFO: Removing gradle-wrapper.jar at gradle/wrapper/gradle-wrapper.jar
2021-03-05 18:17:06,751 INFO: Creating source tarball…
2021-03-05 18:17:07,556 INFO: Building Gradle project…
2021-03-05 18:17:07,556 DEBUG: Directory: build/com.jens.automation2/app
2021-03-05 18:17:07,556 DEBUG: > /usr/lib/python3/dist-packages/gradlew-fdroid assembleFdroidFlavorRelease
Found 6.5 via distributionUrl
Running /home/jens/.cache/fdroidserver/gradle/6.5/bin/gradle assembleFdroidFlavorRelease
Observed package id ‘build-tools;29.0.3’ in inconsistent location ‘/usr/lib/android-sdk/build-tools/debian’ (Expected ‘/usr/lib/android-sdk/build-tools/29.0.3’)
Already observed package id ‘build-tools;29.0.3’ in ‘/usr/lib/android-sdk/build-tools/29.0.3’. Skipping duplicate at ‘/usr/lib/android-sdk/build-tools/debian’
Observed package id ‘build-tools;29.0.3’ in inconsistent location ‘/usr/lib/android-sdk/build-tools/debian’ (Expected ‘/usr/lib/android-sdk/build-tools/29.0.3’)
Already observed package id ‘build-tools;29.0.3’ in ‘/usr/lib/android-sdk/build-tools/29.0.3’. Skipping duplicate at ‘/usr/lib/android-sdk/build-tools/debian’
Checking the license for package Android SDK Build-Tools 29.0.2 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 29.0.2 not accepted.
Checking the license for package Android SDK Platform 29 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Platform 29 not accepted.

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:app:compileFdroidFlavorReleaseJavaWithJavac’.

Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
platforms;android-29 Android SDK Platform 29
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 3s
2021-03-05 18:17:11,374 DEBUG: Popen([‘git’, ‘cat-file’, ‘–batch-check’], cwd=/home/jens/fdroiddata/build/com.jens.automation2, universal_newlines=False, shell=None, istream=)
2021-03-05 18:17:11,392 ERROR: Could not build app com.jens.automation2: Build failed for com.jens.automation2:1.6.21@bb22bcee95e3c6cf6c9ba350e1fc7353da51d97b
==== detail begin ====
Found 6.5 via distributionUrl
Running /home/jens/.cache/fdroidserver/gradle/6.5/bin/gradle assembleFdroidFlavorRelease
Observed package id ‘build-tools;29.0.3’ in inconsistent location ‘/usr/lib/android-sdk/build-tools/debian’ (Expected ‘/usr/lib/android-sdk/build-tools/29.0.3’)
Already observed package id ‘build-tools;29.0.3’ in ‘/usr/lib/android-sdk/build-tools/29.0.3’. Skipping duplicate at ‘/usr/lib/android-sdk/build-tools/debian’
Observed package id ‘build-tools;29.0.3’ in inconsistent location ‘/usr/lib/android-sdk/build-tools/debian’ (Expected ‘/usr/lib/android-sdk/build-tools/29.0.3’)
Already observed package id ‘build-tools;29.0.3’ in ‘/usr/lib/android-sdk/build-tools/29.0.3’. Skipping duplicate at ‘/usr/lib/android-sdk/build-tools/debian’
Checking the license for package Android SDK Build-Tools 29.0.2 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 29.0.2 not accepted.
Checking the license for package Android SDK Platform 29 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Platform 29 not accepted.

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:app:compileFdroidFlavorReleaseJavaWithJavac’.

Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
platforms;android-29 Android SDK Platform 29
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 3s
==== detail end ====
2021-03-05 18:17:11,392 INFO: Finished
2021-03-05 18:17:11,392 INFO: 1 build failed
2021-03-05 18:17:11,393 DEBUG: skip deploying full build logs: not enabled in config
jens@linux7:~/fdroiddata$

Most search results on the internet will ask you to run a file called sdkmanager in the tools directory of the installed Android SDK. But there is no such file in the folder.

Those are my installed SDK components:

jens@linux7:~/fdroiddata$ dpkg --list|grep -i android
ii aapt 1:10.0.0+r36-3 amd64 Android Asset Packaging Tool
ii adb 1:10.0.0+r36-7 amd64 Android Debug Bridge
ii androguard 3.4.0~a1-1 all full Python tool to play with Android files
ii android-libaapt:amd64 1:10.0.0+r36-3 amd64 Android Asset Packaging Tool - Shared library
ii android-libadb 1:10.0.0+r36-7 amd64 Library for Android Debug Bridge
ii android-libandroidfw:amd64 1:10.0.0+r36-3 amd64 Android utility library
ii android-libart 10.0.0+r36-3 amd64 Android Runtime
ii android-libbacktrace 1:10.0.0+r36-7 amd64 Android backtrace library
ii android-libbase 1:10.0.0+r36-7 amd64 Android base library
ii android-libboringssl 10.0.0+r36-1 amd64 Google’s internal fork of OpenSSL for the Android SDK
ii android-libcrypto-utils 1:10.0.0+r36-7 amd64 Android crypto-utils library
ii android-libcutils 1:10.0.0+r36-7 amd64 Android utils library for C
ii android-libetc1 1:10.0.0+r36-1 amd64 ETC1 compression library
ii android-libext4-utils 10.0.0+r36+ds-2 amd64 Android ext4 utility library
ii android-liblog 1:10.0.0+r36-7 amd64 Android NDK logger interfaces
ii android-libnativebridge 1:10.0.0+r36-7 amd64 Android native bridge library
ii android-libnativeloader 1:10.0.0+r36-7 amd64 Android native loader library
ii android-libsparse 1:10.0.0+r36-7 amd64 Library for sparse files
ii android-libunwind 10.0.0+r36-4 amd64 libunwind for Android
ii android-libutils 1:10.0.0+r36-7 amd64 Android Utility Function Library
ii android-libziparchive 1:10.0.0+r36-7 amd64 Library for ZIP archives
ii android-sdk 28.0.2+3 amd64 Software development kit for Android platform
ii android-sdk-build-tools 29.0.3+3 amd64 Tools for building Android applications
ii android-sdk-build-tools-common 29.0.3+3 all Tools for building Android applications - Common files
ii android-sdk-common 28.0.2+3 all Common files of Android SDK base toolset
ii android-sdk-platform-tools 28.0.2+3 amd64 Tools for interacting with an Android platform
ii android-sdk-platform-tools-common 28.0.2+3 all Tools for interacting with an Android platform - Common files
ii apksigner 30.0.3-3 all command line tool to sign and verify Android APKs
ii dexdump 10.0.0+r36-3 amd64 Displays information about Android DEX files
ii dmtracedump 10.0.0+r36-3 amd64 Generates graphical call-stack diagrams from Android trace logs
ii fastboot 1:10.0.0+r36-7 amd64 Android fastboot tool
ii fdroidserver 2.0-1 all F-Droid build server and repository tools for Android
ii libandroid-23-java 6.0.1+r72-6 all Android framework for API Level 23 (6.0 Marshmallow)
ii libapksig-java 30.0.3-3 all library to sign and verify Android APKs
jens@linux7:~/fdroiddata$

Does anybody have an idea what I could do?

Do what F-Droid server does:

cat << EOF > $ANDROID_HOME/licenses/android-sdk-license

8933bad161af4178b1185d1a37fbf41ea5269c55

d56f5187479451eabf01fb78af6dfcb131a6481e

24333f8a63b6825ea9c5514f83c2829b004d1fee
EOF
1 Like

That did it.

The next step also failed (install another SDK version) because of permission issues.

Then it dawned me: I’ve been using the android-sdk from the debian repository. That installed it here: /usr/lib/android-sdk/

Write access for my regular user did not work which is probably also why the installer failed in adding the above values to the files.

Thanks a lot for your answer!