Code Monkey home page Code Monkey logo

docker-android-build-box's People

Contributors

anshulkabramobisy avatar archie94 avatar blacix avatar boris-penev avatar brnogz avatar dandevine avatar dependabot[bot] avatar dewijones92 avatar dougkeen avatar felhr85 avatar gderaco avatar ibobik avatar ikesyo avatar joshuabergeron avatar jwyseu avatar leondevlifelog avatar luchaninov avatar martin-andreasson avatar master-bob avatar mathroule avatar mayankkapoor avatar ming-robot avatar mingchen avatar nicholasmarais1158 avatar nightscape avatar ozmium avatar rascalyen avatar rishavmehra avatar rkswlrbduf avatar wwmun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-android-build-box's Issues

not cleared BUNDLE_GEMFILE env - malfunctioning fastlane

ENV BUNDLE_GEMFILE=/tmp/Gemfile

Hi, first let me thank you for very-very good job on this image. Now the issue.
our Android project has its own Gemfile in project root. But when BUNDLE_GEMFILE environment property stays set to /tmp/Gemfile then following does fail:

root@930e3add16fe:/project# fastlane install_plugins
[✔] 🚀
[11:29:59]: It seems like you wanted to load some plugins, however they couldn't be loaded
[11:29:59]: Please follow the troubleshooting guide: https://docs.fastlane.tools/plugins/plugins-troubleshooting/
Installing plugin dependencies...
[11:29:59]: It looks like fastlane plugins are not yet set up for this project.
[11:29:59]: fastlane will modify your existing Gemfile at path '/tmp/Gemfile'
[11:29:59]: This change is necessary for fastlane plugins to work
[11:29:59]: Should fastlane modify the Gemfile at path '/tmp/Gemfile' for you?

I found out that it is enought just to clear the BUNDLE_GEMFILE env property and it works nicely.

Building a NDK project installs extra NDK

I try to build a project in the image:

$ git clone --depth=1 --recurse-submodules https://github.com/love2d/love-android.git
$ cd love-android/
$ grep ndkVer app/build.gradle 
    ndkVersion '21.3.6528147'
$ grep ndkVer love/build.gradle 
    ndkVersion '21.3.6528147'
$ grep Revision $ANDROID_NDK_HOME/source.properties
Pkg.Revision = 21.3.6528147
$ ./gradlew assembleEmbedRelease

Though the NDK versions match, building tries to install a second copy.

> Configure project :love
Checking the license for package NDK (Side by side) 21.3.6528147 in /opt/android-sdk/licenses
License for package NDK (Side by side) 21.3.6528147 accepted.
Preparing "Install NDK (Side by side) 21.3.6528147 (revision: 21.3.6528147)".
"Install NDK (Side by side) 21.3.6528147 (revision: 21.3.6528147)" ready.
Installing NDK (Side by side) 21.3.6528147 in /opt/android-sdk/ndk/21.3.6528147
"Install NDK (Side by side) 21.3.6528147 (revision: 21.3.6528147)" complete.
"Install NDK (Side by side) 21.3.6528147 (revision: 21.3.6528147)" finished.

A workaround is to find the exact version and symbolically link the $ANDROID_NDK_HOME to the expected path.

$ export NDK_VERSION=`grep -o '[\.[:digit:]]\+$'  "$ANDROID_NDK_HOME/source.properties"`
$ ln -s $ANDROID_NDK_HOME $ANDROID_HOME/ndk/$NDK_VERSION

Request Java11

Sonar cloud is deprecating java 8 and 2020 August onwards it will not be supported. Is there going to be an update for java 11 which would work with android/gradle ?

How to create and run an Android emulator on the build system?

I'm trying to create an Android emulator using avdmanager and this guide. The sample YML script is:

image: mingc/android-build-box:latest

pipelines:
  default:
    - step:
        script:
          - $ANDROID_HOME/tools/bin/avdmanager create avd -n Android_7.1_API_25 -k "system-images;android-25;google_apis;x86_64" -c 250M --abi google_apis/x86_64

But it just results in the following error and stops the build:

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.checkBounds(String.java:381)
	at java.lang.String.<init>(String.java:545)
	at com.android.sdklib.tool.AvdManagerCli.readLine(AvdManagerCli.java:1110)
	at com.android.sdklib.tool.AvdManagerCli.promptForHardware(AvdManagerCli.java:983)
	at com.android.sdklib.tool.AvdManagerCli.createAvd(AvdManagerCli.java:817)
	at com.android.sdklib.tool.AvdManagerCli.doAction(AvdManagerCli.java:369)
	at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:205)
	at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:195)
Do you wish to create a custom hardware profile? [no] 

How do I workaround this? I eventually want to create and run an emulator on the Docker image.

x86 or x86_64 Android emulator cannot run on the Docker machine

You can create an x86_64 Android emulator in this Docker image. But it cannot run at all. Example, using guidelines from Sam Edwards, with a custom bash script:

#!/bin/bash

# Create an x86 emulator from scratch, with a 100 MB SD card storage space. See
# https://handstandsam.com/2016/04/23/using-the-android-emulator-for-continuous-integration/
# You have to echo "no" because it will ask if you want to use a custom hardware profile,
# and you don't.
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd \
    -n Android_7.1_API_25 \
    -k "system-images;android-25;google_apis;x86_64" \
    -c 100M \
    --abi google_apis/x86_64 \
    --force

If you try to launch this emulator, it will not work:

# Verify that an AVD image is available
emulator -list-avds # This will output: Android_7.1_API_25

# Launch the emulator now
$ANDROID_HOME/tools/emulator -avd Android_7.1_API_25 &

It will just display this error:

ERROR: 32-bit Linux Android emulator binaries are DEPRECATED, to use them
       you will have to do at least one of the following:
       - Use the '-force-32bit' option when invoking 'emulator'.
       - Set ANDROID_EMULATOR_FORCE_32BIT to 'true' in your environment.
       Either one will allow you to use the 32-bit binaries, but please be
       aware that these will disappear in a future Android SDK release.
       Consider moving to a 64-bit Linux system before that happens.

Even if you try to use the 32-bit flags, as per these instructions, it will still not work:

export ANDROID_EMULATOR_FORCE_32BIT=true
# Launch the emulator now
$ANDROID_HOME/tools/emulator -avd Android_7.1_API_25 -force-32bit &

You will get this error:

[1234567890]: ERROR: ./android/qt/qt_setup.cpp:28:Qt library not found at ../emulator/lib/qt/lib
Could not launch '../emulator/qemu/linux-x86/qemu-system-x86_64': No such file or directory

And this problem is documented here: https://stackoverflow.com/questions/42554337/cannot-launch-avd-in-emulatorqt-library-not-found

There is an alternate 'emulator' binary located at $ANDROID_HOME/emulator/emulator

But even this will not work to launch an x86 image:

$ANDROID_HOME/emulator/emulator -avd Android_7.1_API_25 &

Or

$ANDROID_HOME/emulator/emulator -use-system-libs -avd Android_7.1_API_25 -no-skin -no-audio -no-window -force-32-bit &

This will result in the following error:

emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: KVM requires a CPU that supports vmx or svm

And this problem is documented here: https://askubuntu.com/questions/564910/kvm-is-not-installed-on-this-machine-dev-kvm-is-missing and https://stackoverflow.com/questions/29136173/emulator-error-x86-emulation-currently-requires-hardware-acceleration

If you try to install the KVM software in the Docker machine, it will just fail at the sudo command -- sudo is not found, or not allowed.


The only thing that works for me is to use an ARM-based emulator instead of the x86 version, using the guidelines from https://medium.com/@AndreSand/android-emulator-on-docker-container-f20c49b129ef and https://paulemtz.blogspot.com/2013/05/android-testing-in-headless-emulator.html :

# Add missing folder to the PATH, to use sdkmanager
ANDROID_TOOLS=$ANDROID_HOME/tools/bin
PATH=$ANDROID_TOOLS:$PATH

# Download an ARM system image to create an ARM emulator.
sdkmanager "system-images;android-16;default;armeabi-v7a"

# Create an ARM AVD emulator, with 100MB SD card storage space.
echo "no" | avdmanager create avd \
    -n Android_4.1_API_16 \
    -k "system-images;android-16;default;armeabi-v7a" \
    -c 100M \
    --force

$ANDROID_HOME/emulator/emulator -avd Android_4.1_API_16 -no-skin -no-audio -no-window -no-boot-anim -gpu off &

So perhaps the x86 system images should not be included in the Docker image by default?

Build failed with an exception.

Hello, I am trut to use your docker image for automatic apk file creation from src code. I am run command docker run --rm -v pwd:/project -v "$HOME/.dockercache/gradle":"/root/.gradle" mingc/android-build-box bash -c 'cd /project; ./gradlew build' and got Exceptiom
user@iMac-user-86 android-code-delivery % docker run --rm -v '/Users/user/playbook/android-code-delivery/var/android-builds/fd01a0be-2bb4-47f4-97c4-18d34149245c/BlueMineMods 3/BlueMineMods':/project mingc/android-build-box bash -c 'cd /project; ./gradlew build'

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Downloading https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
..........10%...........20%...........30%..........40%...........50%...........60%..........70%...........80%...........90%..........100%

Welcome to Gradle 7.0.2!

Here are the highlights of this release:

  • File system watching enabled by default
  • Support for running with and building Java 16 projects
  • Native support for Apple Silicon processors
  • Dependency catalog feature preview

For more details see https://docs.gradle.org/7.0.2/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

  • Where:
    Build file '/project/app/build.gradle' line: 2

  • What went wrong:
    An exception occurred applying plugin request [id: 'com.android.application']

Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.

  • 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5m 22s
user@iMac-user-86 android-code-delivery %
user@iMac-user-86 android-code-delivery %
user@iMac-user-86 android-code-delivery % clear
user@iMac-user-86 android-code-delivery % docker run --rm -v '/Users/user/playbook/android-code-delivery/var/android-builds/fd01a0be-2bb4-47f4-97c4-18d34149245c/BlueMineMods 3/BlueMineMods':/project mingc/android-build-box bash -c 'cd /project; ./gradlew build'

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Downloading https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
..........10%...........20%...........30%..........40%...........50%...........60%..........70%...........80%...........90%..........100%

Welcome to Gradle 7.0.2!

Here are the highlights of this release:

  • File system watching enabled by default
  • Support for running with and building Java 16 projects
  • Native support for Apple Silicon processors
  • Dependency catalog feature preview

For more details see https://docs.gradle.org/7.0.2/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
The message received from the daemon indicates that the daemon has disappeared.
Build request sent: Build{id=18f1797e-e00f-485d-972e-ba3571e36bbc, currentDir=/project}
Attempting to read last messages from the daemon log...
Daemon pid: 58
log file: /root/.gradle/daemon/7.0.2/daemon-58.out.log
----- Last 20 lines from daemon log file - daemon-58.out.log -----
2021-09-07T23:43:40.040-0700 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] Command execution: started DaemonCommandExecution[command = Build{id=18f1797e-e00f-485d-972e-ba3571e36bbc, currentDir=/project}, connection = DefaultDaemonConnection: socket connection from /127.0.0.1:32973 to /127.0.0.1:33434] after 0.0 minutes of idle
2021-09-07T23:43:40.048-0700 [INFO] [org.gradle.launcher.daemon.server.DaemonRegistryUpdater] Marking the daemon as busy, address: [a073f451-6130-41a1-934b-ffc03918d423 port:32973, addresses:[localhost/127.0.0.1]]
2021-09-07T23:43:40.050-0700 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Marking busy by address: [a073f451-6130-41a1-934b-ffc03918d423 port:32973, addresses:[localhost/127.0.0.1]]
2021-09-07T23:43:40.076-0700 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
2021-09-07T23:43:40.105-0700 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-09-07T23:43:40.117-0700 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-09-07T23:43:40.119-0700 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] resetting idle timer
2021-09-07T23:43:40.124-0700 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] daemon is running. Sleeping until state changes.
2021-09-07T23:43:40.137-0700 [INFO] [org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy] Daemon is about to start building Build{id=18f1797e-e00f-485d-972e-ba3571e36bbc, currentDir=/project}. Dispatching build started information...
2021-09-07T23:43:40.148-0700 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 18: dispatching org.gradle.launcher.daemon.protocol.BuildStarted@7117d900
2021-09-07T23:43:40.166-0700 [DEBUG] [org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment] Configuring env variables: [PATH, SOURCE_COMMIT, TZ, ANDROID_SDK_TOOLS_VERSION, SOURCE_BRANCH, JAVA_HOME, TERM, FLUTTER_HOME, NODE_VERSION, LANG, ANDROID_HOME, ANDROID_NDK_VERSION, PWD, _, LANGUAGE, ANDROID_SDK_HOME, BUILD_DATE, ANDROID_NDK_HOME, OLDPWD, DOCKER_TAG, ANDROID_NDK, HOSTNAME, DEBIAN_FRONTEND, LC_ALL, SHLVL, HOME]
2021-09-07T23:43:40.185-0700 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 16: received class org.gradle.launcher.daemon.protocol.CloseInput
2021-09-07T23:43:40.186-0700 [DEBUG] [org.gradle.launcher.daemon.server.DefaultDaemonConnection] thread 16: Received IO message from client: org.gradle.launcher.daemon.protocol.CloseInput@6ee3f08c
2021-09-07T23:43:40.202-0700 [DEBUG] [org.gradle.launcher.daemon.server.exec.LogToClient] About to start relaying all logs to the client via the connection.
2021-09-07T23:43:40.206-0700 [INFO] [org.gradle.launcher.daemon.server.exec.LogToClient] The client will now receive all logging from the daemon (pid: 58). The daemon log file: /root/.gradle/daemon/7.0.2/daemon-58.out.log
2021-09-07T23:43:40.239-0700 [INFO] [org.gradle.launcher.daemon.server.exec.LogAndCheckHealth] Starting build in new daemon [memory: 1.7 GiB]
2021-09-07T23:43:40.259-0700 [INFO] [org.gradle.launcher.daemon.server.exec.ForwardClientInput] Closing daemon's stdin at end of input.
2021-09-07T23:43:40.262-0700 [INFO] [org.gradle.launcher.daemon.server.exec.ForwardClientInput] The daemon will no longer process any standard input.
2021-09-07T23:43:40.265-0700 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has started executing the build.
2021-09-07T23:43:40.266-0700 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] Executing build with daemon context: DefaultDaemonContext[uid=f062e493-5d3a-40a4-829a-3b7690634155,javaHome=/usr/lib/jvm/java-8-openjdk-amd64,daemonRegistryDir=/root/.gradle/daemon,pid=58,idleTimeout=10800000,priority=NORMAL,daemonOpts=-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
----- End of the daemon log -----

JVM crash log found: file:///project/hs_err_pid58.log

FAILURE: Build failed with an exception.

  • What went wrong:
    Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

  • 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

Question: What is the path of generated Apk?

Sorry for asking usage question here!

after running

image: mingc/android-build-box:latest

pipelines:
  default:
    - step:
        script:
          - chmod +x gradlew
          - ./gradlew assemble

It runs successfully. Now I want to upload generated Apk somewhere. Where do I access it?

Please add support latest SDK and build tool version

If we are targeting
compileSdkVersion 31
buildToolsVersion '30.0.3'

The build is failing inside this docker. Request you to add support for these, because android have already released version and some manufacture have started rolling out android 12 devices.

repositories.cfg could not be loaded.

Looks like it is looking at $DOCKER_HOME/.android, rather than $HOME/.android for teh config file.

Similar warning occurred multiple times during build.

Step 17/43 : RUN mkdir --parents "$HOME/.android/" &&     echo '### User Sources for Android SDK Manager' >         "$HOME/.android/repositories.cfg" &&     yes | "$ANDROID_HOME"/tools/bin/sdkmanager --licenses > /dev/null
 ---> Running in 700a525f586e
Warning: File /opt/android-sdk/.android/repositories.cfg could not be loaded.

Make it easier to run Android emulator - Add missing folders to the PATH

Various standard Android tools are not easy to run on the command line in the Docker image, because they are missing on the PATH environment variable. This makes it difficult to run them, because the user has to know the full path to the binaries or has to modify the PATH manually. This folder should be added to the PATH by default:

$ANDROID_HOME/tools/bin/

This is to run tools like avdmanager and sdkmanager.

For example: avdmanager is /opt/android-sdk/tools/bin/avdmanager

Furthermore, there is a non-working emulator binary at /opt/android-sdk/tools/emulator which should be removed or ignored, and replaced with the working one at /opt/android-sdk/emulator/emulator

As of November 2018, the current PATH is:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/opt/android-ndk

It should be modified to:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/android-sdk/emulator:/opt/android-sdk/tools/bin:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/opt/android-ndk

To test this, the following commands should work:

type emulator
type avdmanager
type sdkmanager

GemFile

Hi, I'm trying to build a fastlane project with bitbucket pipeline, but my lane fails to find the plugins:

' Could not find action, lane or variable 'get_version_name'.'

My GemFile in my project root is like this:
source "https://rubygems.org" gem "fastlane" plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') eval_gemfile(plugins_path) if File.exist?(plugins_path)

But the fastlane isn't find it. How can I solve this problem? thank you.

Consider removing the Flutter SDK from the master branch (only have it for Flutter branch)

I've noticed there are 2 branches in this Github project: "master" and "flutter".

If the flutter branch is only used for building Flutter apps, consider removing the Flutter SDK and the FLUTTER_HOME environment variable from the Dockerfile, on the master branch. This would reduce the Docker image size by about 542 MB, to make it more efficient.

And the Readme file could contain instructions and links on how to use the Docker image to build Flutter apps.

Consider removing old Build Tools and old Android Platform versions

Some of the Build Tools versions and Android Platform versions in the Docker container are very old. It's unlikely they will be used, because the Google Play Store requires a strict minimum version to be used, to publish app updates. Here are some examples of the requirements:

Removing the old versions will generate a smaller and more efficient Docker image, which will load faster on CI Build machines.

The Docker Hub page shows that installing the Build Tools and Android Platform contribute a very large portion to the overall Docker image size. For example, version 1.17 of the image uses 4.95 GB to install all these tools.

For example, consider removing the following old platform versions:

  • "platforms;android-24"
  • "platforms;android-23"
  • "platforms;android-22"
  • "platforms;android-21"
  • "platforms;android-20"
  • "platforms;android-19"
  • "platforms;android-18"
  • "platforms;android-17"
  • "platforms;android-16"

And old build tools:

  • "build-tools;24.0.3"
  • "build-tools;24.0.2"
  • "build-tools;24.0.1"
  • "build-tools;24.0.0"
  • "build-tools;23.0.3"
  • "build-tools;23.0.2"
  • "build-tools;23.0.1"
  • "build-tools;22.0.1"
  • "build-tools;21.1.2"
  • "build-tools;20.0.0"
  • "build-tools;19.1.0"
  • "build-tools;18.1.1"
  • "build-tools;17.0.0"

It may be possible to also remove all the Google APIs as well, because they only worked for platforms 16-24. I'm not 100% sure about this, but the old Google APIs (V1) for Google Maps does not work anymore, as per: https://stackoverflow.com/questions/34572026/error-inflating-class-com-google-android-maps-mapview-though-map-library-is-ment and https://developer.android.com/training/maps/index.html

If anyone really wants to use these old platforms, they could just use an old version of the android-build-box Docker image.

Please install timezone info in the Docker image

Some tools that require timezone info will no longer run on Ubuntu 18 Docker images, and will instead just report an error. I believe it's because Ubuntu 18.x no longer includes the 'timezone info' package by default, whereas Ubuntu 17 did include this.

The problem is described in this bug report from a different Github project, which runs on a Ubuntu 18.04 Docker container:

[Crash] Sys_error "/etc/localtime: No such file or directory"

It also causes problems when a client tries to change the timezone inside the Docker container. If you use a command like

cp -f /usr/share/zoneinfo/Europe/Paris /etc/localtime

it will not work, and it will just report an error:

cp: cannot stat '/usr/share/zoneinfo/Europe/Paris': No such file or directory

I believe the fix is to add dnsutils and tzdata to the Dockerfile apt-get install list, as shown here: https://github.com/CodaProtocol/coda/pull/3992/files


If it's not possible to install the timezone package into the Docker container, do you know of any other way for the client to do it? For example, will any of the following techniques work inside Docker?

General error during semantic analysis: Unsupported class file major version 60 in 1.23.0

Hello,

We've started to notice in all of our Android CI setups the error:

* Where:
Settings file '/tmp/build/63c5f882/develop/settings.gradle'

* What went wrong:
Could not compile settings file '/tmp/build/63c5f882/develop/settings.gradle'.
> startup failed:
  General error during semantic analysis: Unsupported class file major version 60
  
  java.lang.IllegalArgumentException: Unsupported class file major version 60
  	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
  	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
  	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
  	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)
  	at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
  	at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:251)
...
  	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
  	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
  	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
  	at java.base/java.lang.Thread.run(Thread.java:831)
  
  1 error

BUILD FAILED in 3s

It has not been seen before 1.23.0 over the past year.

Also it seems that the 1.23.0 has issues building Flutter:


Running Gradle task 'assembleDevRelease'...                     
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
	at org.codehaus.groovy.vmplugin.VMPluginFactory.<clinit>(VMPluginFactory.java:43)
	at org.codehaus.groovy.reflection.GroovyClassValueFactory.<clinit>(GroovyClassValueFactory.java:35)
	at org.codehaus.groovy.reflection.ClassInfo.<clinit>(ClassInfo.java:107)
	at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:95)
...

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.codehaus.groovy.reflection.ReflectionCache

For now we have reverted to using 1.22.0 image.

jenv local 11 not working

Trying to set the java to 11 using
$ jenv local 11
/bin/bash: line 148: jenv: command not found
how can I fix this?

using the latest version mingc/android-build-box:1.22.0

docker build fails

If I run docker build -t myimage-android-sdk . I get the error:

Step 13/22 : COPY README.md /README.md
COPY failed: stat /var/lib/docker/tmp/docker-builder273814224/README.md: no such file or directory

I don't expect this to be relevant but anyway:

  • Docker version: 19.03.8, build afacb8b

  • Running on: Mac OS X, ProductVersion: 10.15.4, BuildVersion: 19E287

No usable tags in repo or Docker Hub

We use this box through BitBucket Pipelines. We recently had an issue which caused all out builds to fail (see #11).

We declare the build image like this;
image: mingc/android-build-box
which targets the $latest configuration.

For the sake of reproducible builds, I'd love to specify the build image like this;
image: mingc/android-build-box:{version} (see docs)

Currently this repo has an unhelpful 'v1.0.0' tag (also in Docker Hub) from over a year ago.

I'd like to suggest that tags are added more frequently once the config is proven stable.

Android builds are now failing, as of 3 November 2018

I now get this error at the assembleDebug stage, when building an Android project in Bitbucket Pipelines:

pipelines:
  default:
    - step:
        script:
          - chmod +x gradlew
          - ./gradlew assembleDebug
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 23s

It was working fine yesterday. And it happens on projects that don't use the NDK.

How do we specify to use an older Docker image, instead of image: mingc/android-build-box:latest ?


Update: Using an older image like this works for me:

image: mingc/android-build-box:v1.1.2

Using the tags from Docker Hub: https://hub.docker.com/r/mingc/android-build-box/tags/

However this image is 10 months old. Could you please add a new Docker tag for this release point: 6bf8482 (it's everything up to 2 November 2018)

ANDROID_NDK_HOME not valid for Android Gradle plugin v2.2.3

Repo tag: b98f22e

Gradle: 3.3 (wrapper)
Android plugin: com.android.tools.build:gradle:2.2.3
Build tools: 23.0.1

Receive the following error during build;

Caused by: java.lang.NullPointerException
	at com.android.build.gradle.internal.ndk.DefaultNdkInfo.findTargetPlatformVersionOrLower(DefaultNdkInfo.java:167)
	at com.android.build.gradle.internal.ndk.DefaultNdkInfo.findLatestPlatformVersion(DefaultNdkInfo.java:89)
	at com.android.build.gradle.internal.ndk.NdkHandler.getPlatformVersion(NdkHandler.java:131)
	at com.android.build.gradle.internal.ndk.NdkHandler.supports64Bits(NdkHandler.java:234)
	at com.android.build.gradle.internal.ndk.NdkHandler.getSupportedAbis(NdkHandler.java:297)
	at com.android.build.gradle.internal.transforms.StripDebugSymbolTransform.<init>(StripDebugSymbolTransform.java:86)
	at com.android.build.gradle.internal.TaskManager.createStripNativeLibraryTask(TaskManager.java:1342)
	at com.android.build.gradle.internal.ApplicationTaskManager.createTasksForVariantData(ApplicationTaskManager.java:289)
	at com.android.build.gradle.internal.VariantManager.createTasksForVariantData(VariantManager.java:485)
	at com.android.build.gradle.internal.VariantManager$3.call(VariantManager.java:293)
	at com.android.build.gradle.internal.VariantManager$3.call(VariantManager.java:290)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120)
	at com.android.build.gradle.internal.profile.SpanRecorders.record(SpanRecorders.java:44)
	at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:286)
	at com.android.build.gradle.BasePlugin$11.call(BasePlugin.java:688)
	at com.android.build.gradle.BasePlugin$11.call(BasePlugin.java:685)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120)
	at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:683)
	at com.android.build.gradle.BasePlugin$10.call(BasePlugin.java:608)
	at com.android.build.gradle.BasePlugin$10.call(BasePlugin.java:605)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120)
	at com.android.build.gradle.BasePlugin.lambda$createTasks$1(BasePlugin.java:603)
	at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
	at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
	at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
	at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
	at com.sun.proxy.$Proxy15.afterEvaluate(Unknown Source)
	at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:82)
	... 56 more

It appears the NDK is extracted to /opt/android-ndk/android-ndk-r15c, but ANDROID_NDK_HOME points to /opt/android-ndk.

Temporary fix;

test -w /opt/android-ndk/android-ndk-r15c && mv /opt/android-ndk/android-ndk-r15c /opt && rm -r /opt/android-ndk && mv /opt/android-ndk-r15c /opt/android-ndk

Is there a way to cache Android emulator image downloads?

The dependency cache for gradle works well, with the following lines in the YML file:

pipelines:
  default:
    - step:
        caches:
          - gradle

Bitbucket Pipelines will retain many gradle downloads in ~/.gradle/caches

Is there a way to do the same thing for the Android emulator image downloads? These are large downloaded files which are usually stored in ~/.android/avd (see here)

You can see examples of emulator image downloads here.

Can't get androidTests (emulator) working

Hi,

unfortunately I'm unable to make androidTests work. The emulator is starting/started but when calling ./gradlew connectedAndroidTest (after almost 15 minutes), I get this exception:

...
> Task :app:connectedDebugAndroidTest
Task :app:connectedDebugAndroidTest in app Starting
Caching disabled for task ':app:connectedDebugAndroidTest' because:
  Build cache is disabled
Task ':app:connectedDebugAndroidTest' is not up-to-date because:
  Task.upToDateWhen is false.
DeviceConnector 'test(AVD) - 7.0': installing /opt/atlassian/pipelines/agent/build/app/build/outputs/apk/debug/app-debug.apk

AAPT2 aapt2-4.1.0-6503028-linux Daemon #0: shutdown
AAPT2 aapt2-4.1.0-6503028-linux Daemon #1: shutdown
AAPT2 aapt2-4.1.0-6503028-linux Daemon #2: shutdown
AAPT2 aapt2-4.1.0-6503028-linux Daemon #3: shutdown

> Task :app:connectedDebugAndroidTest
Unable to install /opt/atlassian/pipelines/agent/build/app/build/outputs/apk/debug/app-debug.apk

com.android.build.gradle.internal.testing.ConnectedDevice > runTests[test(AVD) - 7.0] �[31mFAILED �[0m
	com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException
		at com.android.build.gradle.internal.testing.ConnectedDevice.installPackage(ConnectedDevice.java:136)
[XmlResultReporter]: XML test result file generated at /opt/atlassian/pipelines/agent/build/app/build/outputs/androidTest-results/connected/flavors/debugAndroidTest/TEST-test(AVD) - 7.0-app-debugAndroidTest.xml. Total tests 1, failure 1, 
com.android.ddmlib.InstallException
	at com.android.ddmlib.internal.DeviceImpl.installRemotePackage(DeviceImpl.java:1230)
	at com.android.ddmlib.internal.DeviceImpl.installPackage(DeviceImpl.java:1050)
	at com.android.ddmlib.internal.DeviceImpl.installPackage(DeviceImpl.java:1026)
	at com.android.ddmlib.internal.DeviceImpl.installPackage(DeviceImpl.java:1015)
	at com.android.build.gradle.internal.testing.ConnectedDevice.installPackage(ConnectedDevice.java:130)
	at com.android.build.gradle.internal.testing.SimpleTestRunnable.run(SimpleTestRunnable.java:134)
	at com.android.ide.common.workers.ExecutorServiceAdapter$submit$submission$1.run(ExecutorServiceAdapter.kt:68)
	at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinTask.externalInterruptibleAwaitDone(ForkJoinTask.java:361)
	at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1001)
	at com.android.ide.common.workers.ExecutorServiceAdapter.await(ExecutorServiceAdapter.kt:102)
	at com.android.build.gradle.internal.testing.BaseTestRunner.runTests(BaseTestRunner.java:193)
	at com.android.build.gradle.internal.tasks.DeviceProviderInstrumentTestTask.lambda$doTaskAction$2(DeviceProviderInstrumentTestTask.java:206)
	at com.android.builder.testing.api.DeviceProvider.use(DeviceProvider.java:53)
	at com.android.build.gradle.internal.tasks.DeviceProviderInstrumentTestTask.doTaskAction(DeviceProviderInstrumentTestTask.java:194)
	at com.android.build.gradle.internal.tasks.NonIncrementalTask$taskAction$$inlined$recordTaskAction$1.invoke(AndroidVariantTask.kt:74)
	at com.android.build.gradle.internal.tasks.NonIncrementalTask$taskAction$$inlined$recordTaskAction$1.invoke(AndroidVariantTask.kt:34)
	at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:91)
	at com.android.build.gradle.internal.tasks.NonIncrementalTask.taskAction(NonIncrementalTask.kt:57)
	at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:726)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:693)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:569)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:395)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:387)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:84)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:554)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:537)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:278)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:267)
	at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
	at java.util.Optional.orElseGet(Optional.java:267)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)
	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
	at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
	at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)
	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72)
	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)
	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
	at java.util.Optional.map(Optional.java:215)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
	at java.util.Optional.orElseGet(Optional.java:267)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
	at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
	at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
	at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:194)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:186)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:356)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.ddmlib.ShellCommandUnresponsiveException
	at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:598)
	at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:381)
	at com.android.ddmlib.internal.DeviceImpl.executeShellCommand(DeviceImpl.java:711)
	at com.android.ddmlib.internal.DeviceImpl.installRemotePackage(DeviceImpl.java:1221)
	... 120 more
[no message defined]
Task :app:connectedDebugAndroidTest in app Finished

Do you have any advice?

Here is the script to start the emulator and execute androidTests:

#!/bin/bash

# Download an ARM system image to create an ARM emulator.
sdkmanager "system-images;android-24;default;armeabi-v7a"

# Launch the emulator in the background
# Create an ARM AVD emulator, with a 100 MB SD card storage space. Echo "no"
# because it will ask if you want to use a custom hardware profile, and you don't.
# https://medium.com/@AndreSand/android-emulator-on-docker-container-f20c49b129ef
echo no | avdmanager create avd --force --sdcard 100M --name test -k "system-images;android-24;default;armeabi-v7a"
emulator -avd test -no-audio -no-window &

## Wait for Android to finish booting
wget --quiet --output-document=android-wait-for-emulator https://raw.githubusercontent.com/travis-ci/travis-cookbooks/master/community-cookbooks/android-sdk/files/default/android-wait-for-emulator
chmod +x android-wait-for-emulator
./android-wait-for-emulator
## Unlock the Lock Screen
adb shell input keyevent 82

#start tests
./gradlew app:connectedAndroidTest --info

android iterative build

Hi,
I would like to use this docker for Android project iterative build.
Could you please help me if it can be achieved? I'm not fluent in docker.

Here is assumed workflow:

  • prepare the sources in my Android project folder ~/android
  • build the project with docker using -v flag:
    docker run --rm -v ~/android:/project ....
    It's first time long time build, but the built artifacts should be saved for re-using in further builds.
  • change source code of the project as needed, commit the changes to git
  • run iterative build of the project in docker using artifacts from the previous build. This time the build should be fast.

Consider removing all the "extras" items of local libraries, in the Android SDK

The following components are installed on the Docker images of android-build-box:

  • extra-android-m2repository
  • extra-google-m2repository
  • extra-google-google_play_services
  • extras-m2repository-constraint-layout-1.0.2
  • extras-m2repository-constraint-layout-1.0.1

They will download about 550 MB of library dependencies to the $ANDROID_HOME/extras folder, which will act like a local Maven repository ("m2repository"). It contains things like Google Play Services, Android Support libraries, RecyclerView, Constraint Layout, etc.

But I believe these items are never used anymore.

The "extras" folder is deprecated, because gradle will now download these libraries on-demand, from https://maven.google.com -- even for the very old versions. You can browse https://maven.google.com and use the search box to see all the available versions that can be downloaded. The gradle build will just ignore the extras folder, and re-download the libraries anyway.

More info about the "extras" folder:


So please remove the 3 "extras" items from the Docker image, to reduce the overall size by about 550 MB, and make it more efficient.

You can see from the stackoverflow link that the on-demand Maven repo -- https://maven.google.com -- has been available since at least July 2017.

Interactive Mode

Hi, this is issue about asking help :/

My company trying to use this image with Azure DevOps with Kubernetes and Docker.
I am not experienced with DevOps but they said me image works only with Interactive Mode.

I would like hear advices about the way of using image? If it is how can we make it work?

apt-get update fails

Tag: 1.8.0

I run apt-get update as an early step in my build.

Recently, I'm getting the following error;

+ apt-get update
Ign:1 http://security.ubuntu.com/ubuntu artful-security InRelease
Err:2 http://security.ubuntu.com/ubuntu artful-security Release
  404  Not Found [IP: 91.189.91.26 80]
Get:3 https://deb.nodesource.com/node_10.x artful InRelease [4,611 B]
Ign:4 http://archive.ubuntu.com/ubuntu artful InRelease
Ign:5 http://archive.ubuntu.com/ubuntu artful-updates InRelease
Get:6 https://deb.nodesource.com/node_10.x artful/main amd64 Packages [767 B]
Ign:7 http://archive.ubuntu.com/ubuntu artful-backports InRelease
Err:8 http://archive.ubuntu.com/ubuntu artful Release
  404  Not Found [IP: 91.189.88.161 80]
Err:9 http://archive.ubuntu.com/ubuntu artful-updates Release
  404  Not Found [IP: 91.189.88.161 80]
Err:10 http://archive.ubuntu.com/ubuntu artful-backports Release
  404  Not Found [IP: 91.189.88.161 80]
Reading package lists...
E: The repository 'http://security.ubuntu.com/ubuntu artful-security Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu artful Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu artful-updates Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu artful-backports Release' does not have a Release file.

My last successful build was 5th May 2019, and only noticed this error today.

Could this be related to Ubuntu 17.10 being "End of Life"? When I browse http://archive.ubuntu.com/ubuntu/dists/ I don't see directories for "artful".

Would this simply do the job?

- FROM ubuntu:17.10
+ FROM ubuntu:18.04

Any foreseen implications of upgrading to 18.04?

while building the project i got this error

File /root/.android/repositories.cfg could not be loaded.
Checking the license for package SDK Patch Applier v4 in /opt/android-sdk/licenses
Warning: License for package SDK Patch Applier v4 not accepted.
Checking the license for package Google Repository in /opt/android-sdk/licenses
Warning: License for package Google Repository not accepted.

Some tidy up: Delete old build tools, remove unnecessary things, update documentation

I have noticed a few things that could be improved in the latest version of docker-android-build-box (version 1.23.1). The Docker image file size is really big, currently at 6.7 GB. This makes it slow for CI build systems to download the image.

I think it could be reduced slightly by removing various things:

Things that could be removed in the Docker image

  • We can remove old build tools of "build-tools;25.0.3", "build-tools;25.0.2", "build-tools;25.0.1" "build-tools;25.0.0". These were used at approximately September 2017, so no modern Android project will be using them now, 4 years later. They can be safely removed. The corresponding "platforms;android-25" can also be removed.

  • Kotlin 1.5 and gradle 7.2 can be removed. All Android apps are setup to use their own specific versions of Kotlin and Gradle. The system versions of Kotlin and gradle are never used. Android apps will use gradlew to download their own version of gradle, as defined in the gradle-wrapper.properties file of the project. Similarly, the project's build.gradle file will specifiy a unique version of Kotlin to download, using this: implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" or this implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

Documentation updates for Readme.md

  • The Readme.md file says that Python 2 is installed. But this is incorrect. Python 2.7 is not available by default on Ubuntu 20.04. It only has Python 3.
  • I think it would be better to specify the exact Python version available, which is Python 3.8.10
  • I think it would be better to specify exactly which versions of Java are available, and which one is set as the default. Something like this: #65 (comment)

If there are no objections, I can create a pull request with all these changes.

FAILURE: Build failed with an exception.

docker run --rm -v /Users/user/playbook/android-build/var/android-builds/62d024dc-5092-48b1-9aed-28b620efa762/178/178:/project -w '/project' mingc/android-build-box bash -c 'source /root/.bash_profile && chmod 777 gradlew && ./gradlew --configuration-cache && ./gradlew build'
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Downloading https://services.gradle.org/distributions/gradle-6.8-bin.zip
..........10%..........20%..........30%...........40%..........50%..........60%..........70%...........80%..........90%..........100%

Welcome to Gradle 6.8!

Here are the highlights of this release:

  • Faster Kotlin DSL script compilation
  • Vendor selection for Java toolchains
  • Convenient execution of tasks in composite builds
  • Consistent dependency resolution

For more details see https://docs.gradle.org/6.8/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

  • What went wrong:
    Gradle could not start your build.

Cannot create service of type DefaultConfigurationCache using DefaultConfigurationCache constructor as there is a problem with parameter #10 of type ConfigurationCacheFingerprintController.
Cannot create service of type ConfigurationCacheFingerprintController using ConfigurationCacheFingerprintController constructor as there is a problem with parameter #5 of type FileCollectionFingerprinterRegistry.
> Cannot create service of type FileCollectionFingerprinterRegistry using method VirtualFileSystemServices$BuildSessionServices.createFileCollectionFingerprinterRegistry() as there is a problem with parameter #1 of type List.
> Could not create service of type FileHasher using BuildSessionServices.createFileHasher().
> Timeout waiting to lock file hash cache (/project/.gradle/6.8/fileHashes). It is currently in use by another Gradle instance.
Owner PID: 335
Our PID: 335
Owner Operation:
Our operation:

@mingchen hello how I can fix this exeption during task execution?

Missing user

I want to scp the created apk file to the host with scp.

But when running ssh or scp commands within the container I get the error "unknown user 1000".

Commands relating to users have weird results:

id
uid=1000 gid=1000 groups=1000

/etc/passwd does not really contain a user:

cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin

I think there is a user missing since the container is run with userid 1000

Implement support of Apple M1 (Silicon)

Hi!
Could you implement support of Apple M1 processor? Now during running this image on such hardware I get error:

Command: yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;30.0.3"

 Exit status of command 'yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;30.0.3"' was 1 instead of 0.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
	at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
	at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
	at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
	at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
	at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 5 more

ndk-build error: missing file command

during ndk build, we get error that command "file" does not exist.

And it's correct, it is required:
grep file $ANDROID_NDK_HOME/build/ndk-build | grep -v '#'
file -L "$SHELL" | grep -q "x86[_-]64"

Kindly add it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.