How to Install Google Play Services GMS SDK on CircleCI - android

I am using a CircleCI server to build and test and Android application and have trouble installing the Android SDK for Google Play Services (including GMS services) on the server.
My circle.yml file is:
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
dependencies:
pre:
- echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all --filter extra-android-m2repository
- echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all
- wget $DEBUG_KEYSTORE_URL
- openssl des3 -d -pass env:DEBUG_KEYSTORE_PASSWORD -salt -in debug.keystore.encrypted -out ~/.android/debug.keystore
test:
override:
- ./gradlew assembleDebug
post:
- cp -r app/build/outputs $CIRCLE_ARTIFACTS
The first
- echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all --filter extra-android-m2repository
was a fix for an earlier issue with the Android SDK extras, and I thought that the second line would install all remaining components:
- echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all
However, I am getting the following error (below).
When trying to keep my circle.yml file up to date with the latest Android SDK, I seem to keep running into similar issues. Any suggestions are appreciated!
Download https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.0-beta1/gradle-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/1.3.0-beta1/gradle-core-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder/1.3.0-beta1/builder-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/lint/lint/24.3.0-beta1/lint-24.3.0-beta1.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.2.1/proguard-gradle-5.2.1.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-parent/5.2.1/proguard-parent-5.2.1.pom
Download https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.3.6/groovy-all-2.3.6.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder-model/1.3.0-beta1/builder-model-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder-test-api/1.3.0-beta1/builder-test-api-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/sdklib/24.3.0-beta1/sdklib-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/sdk-common/24.3.0-beta1/sdk-common-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/common/24.3.0-beta1/common-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/build/manifest-merger/24.3.0-beta1/manifest-merger-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/24.3.0-beta1/ddmlib-24.3.0-beta1.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm/5.0.3/asm-5.0.3.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-parent/5.0.3/asm-parent-5.0.3.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.pom
Download https://jcenter.bintray.com/com/android/tools/jack/jack-api/0.9.0/jack-api-0.9.0.pom
Download https://jcenter.bintray.com/com/android/tools/jill/jill-api/0.9.0/jill-api-0.9.0.pom
Download https://jcenter.bintray.com/com/android/tools/lint/lint-checks/24.3.0-beta1/lint-checks-24.3.0-beta1.pom
Download https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.4/ecj-4.4.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.pom
Download https://jcenter.bintray.com/com/android/tools/annotations/24.3.0-beta1/annotations-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/24.3.0-beta1/layoutlib-api-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/dvlib/24.3.0-beta1/dvlib-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/lint/lint-api/24.3.0-beta1/lint-api-24.3.0-beta1.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.pom
Download https://jcenter.bintray.com/com/intellij/annotations/12.0/annotations-12.0.pom
Download https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.pom
Download https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.0-beta1/gradle-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/1.3.0-beta1/gradle-core-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/build/builder/1.3.0-beta1/builder-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/lint/lint/24.3.0-beta1/lint-24.3.0-beta1.jar
Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.2.1/proguard-gradle-5.2.1.jar
Download https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.3.6/groovy-all-2.3.6.jar
Download https://jcenter.bintray.com/com/android/tools/build/builder-model/1.3.0-beta1/builder-model-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/build/builder-test-api/1.3.0-beta1/builder-test-api-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/sdklib/24.3.0-beta1/sdklib-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/sdk-common/24.3.0-beta1/sdk-common-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/common/24.3.0-beta1/common-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/build/manifest-merger/24.3.0-beta1/manifest-merger-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/24.3.0-beta1/ddmlib-24.3.0-beta1.jar
Download https://jcenter.bintray.com/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar
Download https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.jar
Download https://jcenter.bintray.com/com/android/tools/jack/jack-api/0.9.0/jack-api-0.9.0.jar
Download https://jcenter.bintray.com/com/android/tools/jill/jill-api/0.9.0/jill-api-0.9.0.jar
Download https://jcenter.bintray.com/com/android/tools/lint/lint-checks/24.3.0-beta1/lint-checks-24.3.0-beta1.jar
Download https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.4/ecj-4.4.jar
Download https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.jar
Download https://jcenter.bintray.com/com/android/tools/annotations/24.3.0-beta1/annotations-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/24.3.0-beta1/layoutlib-api-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/dvlib/24.3.0-beta1/dvlib-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/lint/lint-api/24.3.0-beta1/lint-api-24.3.0-beta1.jar
Download https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.jar
Download https://jcenter.bintray.com/com/intellij/annotations/12.0/annotations-12.0.jar
Download https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.google.android.gms:play-services-maps:7.5.0.
Searched in the following locations:
http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
https://repo1.maven.org/maven2/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
https://repo1.maven.org/maven2/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
https://jcenter.bintray.com/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
https://maven.fabric.io/public/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
https://maven.fabric.io/public/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
Required by:
project-android-app:app:unspecified
> Could not find com.google.android.gms:play-services-location:7.5.0.
Searched in the following locations:
http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
https://jcenter.bintray.com/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
https://maven.fabric.io/public/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
https://maven.fabric.io/public/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
Required by:
project-android-app:app:unspecified
> Could not find com.google.android.gms:play-services-gcm:7.5.0.
Searched in the following locations:
http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
https://maven.fabric.io/public/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
https://maven.fabric.io/public/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
Required by:
project-android-app:app:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
export TERM="dumb"
./gradlew dependencies
returned exit code 1
Total time: 19.331 secs Action failed: ./gradlew dependencies

The solution after much tweaking seems to require you to explicitly specify the components you need in the --filter option. If you don't add filter, it appears that --all will NOT give you all the components needed.
Fix is below for others:
ssh
dependencies:
pre:
- echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all --filter extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository

I got this same error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugCompile'.
Could not find com.google.android.gms:play-services-location:7.5.0.
This tip below solved the problem:
echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all --filter extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository

Related

Getting Android sdkmanager to run with Java 11

I am facing a problem while running Android sdkmanager with Java 11 (Not studio, only SDK tools). I don't want to install JDK 8 or something similar. Is there a way to fix this for Android sdkmanager with JDK 11?
I have gone through this answer and it doesn't offer command line fix for java 11. Any other workaround possible?
UPDATE: as explained in another answer, the sdkmanager from the new command line tool supports JDK 11+. The old sdkmanager has not received updates in years, so this workaround should not be necessary. Check #dmertins answer for links and more details.
If anyone is looking for a Linux fix on Java 11. I built this on top of previous answers
cd Android/tools
mkdir jaxb_lib
wget https://repo1.maven.org/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar -O jaxb_lib/activation.jar
wget https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.3.3/jaxb-impl-2.3.3.jar -O jaxb_lib/jaxb-impl.jar
wget https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/3.0.11/istack-commons-runtime-3.0.11.jar -O jaxb_lib/istack-commons-runtime.jar
wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-xjc/2.3.3/jaxb-xjc-2.3.3.jar -O jaxb_lib/jaxb-xjc.jar
wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar -O jaxb_lib/jaxb-core.jar
wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-jxc/2.3.3/jaxb-jxc-2.3.3.jar -O jaxb_lib/jaxb-jxc.jar
wget https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar -O jaxb_lib/jaxb-api.jar
After the download finishes (make sure all files were downloaded OK), you have to edit sdkmanager and avdmanager scripts in the tools/bin directory. You can do this manually or automatically.
From Simon Ruggier answer (doesn't work on mac unless you use gnu-sed):
sed -ie 's%^CLASSPATH=.*%\0:$APP_HOME/jaxb_lib/*%' bin/sdkmanager bin/avdmanager
Or manually, scroll down to the CLASSPATH variable, and add the new jars we just downloaded like this:
CLASSPATH=$APP_HOME/jaxb_lib/activation.jar:$APP_HOME/jaxb_lib/jaxb-impl.jar:$APP_HOME/jaxb_lib/jaxb-xjc.jar:$APP_HOME/jaxb_lib/jaxb-core.jar:$APP_HOME/jaxb_lib/jaxb-jxc.jar:$APP_HOME/jaxb_lib/jaxb-api.jar:<etc etc...DO NOT REMOVE THE OTHER JARS!...>
The sdkmanager that comes with the deprecated SDK Tools package doesn't support JDK 8 and is no longer receiving updates since september 2017. More information here and here.
The sdkmanager included in the new Command-Line Tools package supports JDK 11 and it can be downloaded from the Android Studio download page, in the Command line tools only section. There's no need to download any other files or to hack with the sdkmanager script, however you will need to update your PATH setting, e.g. on Linux: $ANDROID_HOME/cmdline-tools/latest/bin instead of $ANDROID_HOME/tools/bin
Although deprecated, the old Tools package is still being installed with Android Studio 4.1.1 by default. This post explains why.
For those of you seeing this issue in Travis CI:
I was seeing this error while attempting to accept the license agreement for build tools 30.0.2, targeting Android 30, with Java 11 for a travis CI build.
Applying this answer (https://stackoverflow.com/a/65782803/6500352) I ended up with this working yml
os: linux
language: android
jdk: openjdk11
android:
components:
- tools
- platform-tools
- tools
- extra-android-m2repository
env:
global:
- TARGET_VERSION=30
- ANDROID_BUILD_TOOLS_VERSION=30.0.2
- ANDROID_HOME=~/android-sdk
before_install:
- touch $HOME/.android/repositories.cfg
- wget "https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip" -O commandlinetools.zip
- unzip commandlinetools.zip -d $ANDROID_HOME/
- yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager "platforms;android-${TARGET_VERSION}" --sdk_root=$ANDROID_HOME
- yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" --sdk_root=$ANDROID_HOME
before_script:
- chmod +x gradlew
script:
- ./gradlew your_command_here
Download jxab and jaf, put them all into classpath.
e.g.
sdkmanager.bat
...
set CLASSPATH=%CLASSPATH%;mylib\jaxb-ri\lib\jaxb-api.jar
set CLASSPATH=%CLASSPATH%;mylib\jaxb-ri\lib\jaxb-core.jar
set CLASSPATH=%CLASSPATH%;mylib\jaxb-ri\lib\jaxb-impl.jar
set CLASSPATH=%CLASSPATH%;mylib\jaxb-ri\lib\jaxb-jxc.jar
set CLASSPATH=%CLASSPATH%;mylib\jaxb-ri\lib\jaxb-xjc.jar
set CLASSPATH=%CLASSPATH%;mylib\jaf-1.1.1\activation.jar
#rem Execute sdkmanager
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %SDKMANAGER_OPTS% -classpath "%CLASSPATH%" com.android.sdklib.tool.sdkmanager.SdkManagerCli %CMD_LINE_ARGS%
...
Here's a more automated version of Emilio's answer (thanks!):
cd Android/tools
mkdir jaxb_lib
wget https://repo1.maven.org/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar -O jaxb_lib/activation.jar
wget https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.3.3/jaxb-impl-2.3.3.jar -O jaxb_lib/jaxb-impl.jar
wget https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/3.0.11/istack-commons-runtime-3.0.11.jar -O jaxb_lib/istack-commons-runtime.jar
wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-xjc/2.3.3/jaxb-xjc-2.3.3.jar -O jaxb_lib/jaxb-xjc.jar
wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar -O jaxb_lib/jaxb-core.jar
wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-jxc/2.3.3/jaxb-jxc-2.3.3.jar -O jaxb_lib/jaxb-jxc.jar
wget https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar -O jaxb_lib/jaxb-api.jar
# Append jaxb_lib to the CLASSPATH in sdkmanager and avdmanager
sed -ie 's%^CLASSPATH=.*%\0:$APP_HOME/jaxb_lib/*%' bin/sdkmanager bin/avdmanager
The jar directory also doesn't belong under bin, so these instructions place it one level higher.
There is an issues according to previous answers, that you'd better to use more recent jaxb-impl jar such as 2.3.1 to avoid the reflection warning.
https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.3.1/jaxb-impl-2.3.1.jar
Also if we put all jar files into ${APP_HOME}/lib and then append ${APP_HOME}/lib/* to CLASSPATH, the java will pick up all jar files.
If you are on Apple Silicon or don't have wget installed:
cd Android/sdk/tools # or Android/tools
mkdir jaxb_lib
curl https://repo1.maven.org/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar -o jaxb_lib/activation.jar
curl https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.3.3/jaxb-impl-2.3.3.jar -o jaxb_lib/jaxb-impl.jar
curl https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/3.0.11/istack-commons-runtime-3.0.11.jar -o jaxb_lib/istack-commons-runtime.jar
curl https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-xjc/2.3.3/jaxb-xjc-2.3.3.jar -o jaxb_lib/jaxb-xjc.jar
curl https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar -o jaxb_lib/jaxb-core.jar
curl https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-jxc/2.3.3/jaxb-jxc-2.3.3.jar -o jaxb_lib/jaxb-jxc.jar
curl https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar -o jaxb_lib/jaxb-api.jar
# Add To CLASSPATH
sed -ie 's%^CLASSPATH=.*%\0:$APP_HOME/jaxb_lib/*%' bin/sdkmanager bin/avdmanager
# Add this manually on newline after CLASSPATH
CLASSPATH=$APP_HOME/jaxb_lib/activation.jar:$APP_HOME/jaxb_lib/jaxb-impl.jar:$APP_HOME/jaxb_lib/jaxb-xjc.jar:$APP_HOME/jaxb_lib/jaxb-core.jar:$APP_HOME/jaxb_lib/jaxb-jxc.jar:$APP_HOME/jaxb_lib/jaxb-api.jar:$APP_HOME/jaxb_lib/istack-commons-runtime.jar:$CLASSPATH
After trying Wang Qian's answer, I got Exception in thread "main" java.lang.NoSuchFieldError: REFLECTION. This might because the versions of jaxb-impl and jaxb-core are not matching. Make sure you download the same version of these two libraries, such as 2.3.0.1.
After that, I got another exception: Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/istack/FinalArrayList. I found out this is because we are missing another library: istack-commons-runtime. Download it and put it into the classpath as well.
So the full list of library dependencies that need to add to classpath specifically should be:
jaxb-api
jaxb-core
jaxb-impl
jaxb-jxc
jaxb-xjc
activation
istack-commons-runtime
After this, you should be able to run sdkmanager but with a warning of illegal reflective access. You can ignore it without any problems. If you are interested in it, have a quick search. You'll find lots of questions on Stack Overflow regarding this warning.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.(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:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
Using Java 12, these are the steps I followed to bypass this warning. Thanks to Wang Qian.
Navigate to the path where the android sdk is installed such as the following.
%LOCALAPPDATA%\Android\Sdk\tools\bin
Edit sdkmanager.bat with a text editor such as notepad.
Find the following lines at approximately line 70.
#rem Execute sdkmanager
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %SDKMANAGER_OPTS% -classpath "%CLASSPATH%" com.android.sdklib.tool.sdkmanager.SdkManagerCli %CMD_LINE_ARGS%
Just above those lines, paste the following code.
set CLASSPATH=%CLASSPATH%;%APP_HOME%\mylib\jaxb-api.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\mylib\jaxb-core.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\mylib\jaxb-impl.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\mylib\jaxb-jxc.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\mylib\jaxb-xjc.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\mylib\activation.jar
Create a new folder called mylib in the tools folder of your android sdk installation.
%LOCALAPPDATA%\Android\Sdk\tools\mylib
Download the latest version of the following 6 jar files and place them in the mylib folder.
https://repo1.maven.org/maven2/javax/activation/activation/
https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/
https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-core
https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl
https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-xjc
https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-jxc/
Remove the versioning in the filenames to match the filenames set in the sdkmanager.bat file. You should now have the following files.
%LOCALAPPDATA%\Android\Sdk\tools\mylib\activation.jar
%LOCALAPPDATA%\Android\Sdk\tools\mylib\jaxb-api.jar
%LOCALAPPDATA%\Android\Sdk\tools\mylib\jaxb-core.jar
%LOCALAPPDATA%\Android\Sdk\tools\mylib\jaxb-impl.jar
%LOCALAPPDATA%\Android\Sdk\tools\mylib\jaxb-jxc.jar
%LOCALAPPDATA%\Android\Sdk\tools\mylib\jaxb-xjc.jar
All set! Now run your sdkmanager --update command
%LOCALAPPDATA%\Android\sdk\tools\bin\sdkmanager --update
If you're on macOS using the android-sdk formula from Homebrew, it's discontinued and only supports Java 8. Quoting its formula page:
android-sdk requires Java 8. You can install it with:
brew install --cask homebrew/cask-versions/temurin8
android-sdk has been officially discontinued upstream. It may stop
working correctly (or at all) in recent versions of macOS.
For Java 11 and newer, you can install the android-commandlinetools formula.
brew install android-commandlinetools
Don't forget to set the ANDROID_HOME variable pointing to your "new" Android SDK directory:
export ANDROID_HOME=/usr/local/share/android-commandlinetools

Bitbucket-Pipelines android build setup fails

After struggling for a couple of hours I was able to setup my docker container. My yml file is as below:
image: mingc/android-build-box:latest
pipelines:
default:
- step:
script:
# Grab the Android Support Repo which isn't included in the container
- echo y | android update sdk --filter "extra-android-m2repository" --no-ui -a
# Accept preview licences
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_SDK_HOME/licenses/android-sdk-preview-license"
- ./gradlew assembleDebug --info
However, when I use 'com.google.android.gms:play-services-location:11.0.2' in my bild.gradle file I end up receiving this error:
FAILURE: Build failed with an exception.
* What went wrong: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.google.android.gms:play-services-location:11.0.2.
Searched in the following locations:
file:/opt/android-sdk/extras/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom
file:/opt/android-sdk/extras/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar
file:/opt/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom
file:/opt/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar
file:/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom
file:/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar
https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom
https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar
https://jcenter.bintray.com/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar
https://jitpack.io/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom
https://jitpack.io/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar
https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom
https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar
Required by:
project :app > project :sdk
Any help is much appreciated.
Try this, it builds fine for me.
image: mingc/android-build-box:latest
pipelines:
default:
- step:
script:
- chmod +x gradlew
- ./gradlew assemble
I think it's because you are using the gms libs, but not include google maven repo to your gradle script.
Google has published their own repo(https://developer.android.com/studio/build/dependencies.html#google-maven),you can add it to your project.
Please kindly check your build.gradle and add
google() (if you are using android gradle plugin 3.0) or
maven {
url "https://maven.google.com"
}
into
allprojects {
repositories {
...
}
}
section.
BTW in most cases a tiny android sdk docker is enough for CI pipeline, maybe you can try https://hub.docker.com/r/zhywang/android-sdk/ , it's just ~700MB, takes much less time to download.

CircleCI "Some errors occurred while attempting to infer information about your code"

I'm trying to build an Android project using CircleCI, but every time I run a build, the build completes in the Configure Build task and I get this message:
Some errors occurred while attempting to infer information about your code.
Also, when this occurs, CircleCI automatically tries to rebuild the branch, causing a loop, because every new build keeps failing.
Here's my circle.yml file
version: 1
machine:
java:
version: oraclejdk8
environment:
# Java options
JAVA_OPTS: "-Xms512m -Xmx2048m"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
dependencies:
pre:
# Install the android packages
- echo y | android update sdk --no-ui --all --filter "build-tools-25.0.3"
test:
pre:
override:
# Generate a debug-apk
- ./gradlew assembleAppseeOffDebug -PdisablePreDex
# Copy the generated apk files to Circle-CI Artifacts
- cp -r app/build/outputs/apk/ $CIRCLE_ARTIFACTS
# Copy the test results to Circle-CI Artifacts
- cp -r app/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS
Solved the problem by following this circle.yml example
In 1, after the test tag there's an override tag, but in my circle.yml file there's a pre tag. Removing that pre tag solved the problem.
Final circle.yml file
version: 1
machine:
java:
version: oraclejdk8
environment:
# Java options
JAVA_OPTS: "-Xms512m -Xmx2048m"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
dependencies:
pre:
# Install the android packages
- echo y | android update sdk --no-ui --all --filter "build-tools-25.0.3
test:
# REMOVED pre TAG
override:
# Generate a debug-apk
- ./gradlew assembleAppseeOffDebug -PdisablePreDex
# Copy the generated apk files to Circle-CI Artifacts
- cp -r app/build/outputs/apk/ $CIRCLE_ARTIFACTS
# Copy the test results to Circle-CI Artifacts
- cp -r app/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS

Travis CI for Android - Build Error: Failed to find target & Could not find dependencies

I am trying to set up Travis CI for my existing Android project. I've added the .travis.yml:
language: android
android:
components:
- build-tools-21.1.2
- android-22
- extra-google-google_play_services
But it always fails in Travis CI with the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':evercamPlay'.
failed to find target android-22 : /usr/local/android-sdk
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or debug option to get more log output.
BUILD FAILED
Total time: 16.801 secs
The command "./gradlew build connectedCheck" exited with 1.
Done. Your build exited with 1.
What should I do to get rid of this error?
Update:
After updating build tools to version 22.0.1, this error is gone but got new error:
> Could not find com.android.support:support-v4:22.2.0.
...
> Could not find com.google.android.gms:play-services:7.3.0.
...
In my build.gradle:
dependencies {
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.android.gms:play-services:7.3.0'
}
Any idea how to fix this?
Thanks!
You need to update the build tools to the version 22.X, I have tried in my project configuration and that works.
android:
components:
- android-22
- build-tools-22.0.1
It's also possible that Travis hasn't been updated with the appropriate sdks yet. From their docs (as of June 9, 2015):
Pre-installed components #
While the following components are preinstalled, the exact list may change without prior notice. To ensure the stability of your build environment, we recommend that you explicitly specify the required components for your project.
platform-tools
build-tools-21.1.1
android-21
sys-img-armeabi-v7a-android-21
android-20
sys-img-armeabi-v7a-android-wear-20
android-19
sys-img-armeabi-v7a-android-19
android-18
sys-img-armeabi-v7a-android-18
android-17
sys-img-armeabi-v7a-android-17
android-16
sys-img-armeabi-v7a-android-16
android-15
sys-img-armeabi-v7a-android-15
android-10
extra-android-support
extra-google-google_play_services
extra-google-m2repository
extra-android-m2repository
No mention of v22 sdk or build tools there.
language: android
android:
components:
- platform-tool
- tool
- android-22
- build-tools-22.0.1
- extra-android-m2repository
- extra-google-m2repository

Error with travis-c and appcompat v-21

i wnt to set CI with travis-ci with my android project.
Those are my gradles:
top-level
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
flatDir{
dirs 'libs'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.1'
classpath 'org.robolectric:robolectric-gradle-plugin:0.12.0'
}
}
allprojects {
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}
Project specific:
apply plugin: 'com.android.application'
apply plugin: 'robolectric'
apply from: 'config/quality.gradle'
dependencies {
compile files('libs/com.mobandme.ada_v2.4.4.jar')
compile 'com.squareup:otto:1.3.5'
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.github.pedrovgs:renderers:1.0.9'
compile 'com.jakewharton:butterknife:5.0.1'
compile 'com.etsy.android.grid:library:1.0.4'
compile 'ch.acra:acra:4.5.0'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.android.support:support-v4:21.0.2'
compile 'com.android.support:cardview-v7:21.0.2'
compile 'com.shamanland:fab:0.0.5'
compile 'com.github.johnkil.android-robototextview:robototextview:2.1.0'
compile 'com.path:android-priority-jobqueue:1.1.2'
compile "com.android.support:appcompat-v7:21.0.2"
compile 'com.jakewharton:disklrucache:2.0.2'
compile 'com.squareup.retrofit:retrofit:1.7.1'
compile 'com.snappydb:snappydb-lib:0.5.0'
compile 'com.esotericsoftware.kryo:kryo:2.24.0'
}
repositories{
flatDir{
dirs 'libs'
}
}
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
defaultConfig {
minSdkVersion 18
targetSdkVersion 21
versionCode 113
versionName "1.0"
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
signingConfigs {
release {
storeFile file('***')
storePassword '***'
keyAlias '***'
keyPassword '***'
}
}
lintOptions {
disable 'InvalidPackage'
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
productFlavors {}
}
And my travis file
language: java
jdk: oraclejdk7
env:
matrix:
- ANDROID_SDKS=android-21 ANDROID_TARGET=android-21
branches:
only:
- master
before_install:
- chmod +x gradlew
# Install base Android SDK
- wget http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz
- tar xzf android-sdk_r23.0.2-linux.tgz
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
# install android build tools
- wget https://dl-ssl.google.com/android/repository/build-tools_r21.1.1-linux.zip
- unzip build-tools_r21.1.1-linux.zip -d $ANDROID_HOME
- mkdir -p $ANDROID_HOME/build-tools/
- mv $ANDROID_HOME/android-5.0 $ANDROID_HOME/build-tools/21.1.1
- echo yes | android update sdk --filter build-tools-21.1.1 --no-ui --force > /dev/null
- echo yes | android update sdk --filter tools --no-ui --force > /dev/null
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-21 --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-google-m2repository --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-google-google_play_services --no-ui --force > /dev/null
script:
- TERM=dumb ./gradlew assembleRelease
This is travis output
Using worker: worker-linux-docker-e8480109.prod.travis-ci.com:travis-linux-6
system_info
Build system information
Build language: java
Installing an SSH key from: default repository key
Key fingerprint: c3:f4:e6:fd:0c:b3:83:41:2a:d8:cd:ca:b1:3e:65:ca
git.checkout
1.15s$ git clone --depth=50 --branch=master git#github.com:colymore/firext-android.git colymore/firext-android
Cloning into 'colymore/firext-android'...
Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.
remote: Counting objects: 2088, done.
remote: Compressing objects: 100% (909/909), done.
remote: Total 2088 (delta 1137), reused 1840 (delta 912)
Receiving objects: 100% (2088/2088), 5.69 MiB | 0 bytes/s, done.
Resolving deltas: 100% (1137/1137), done.
Checking connectivity... done.
$ cd colymore/firext-android
$ git checkout -qf 80a86aee1209b99d40d2b11d08292dba6958dbbd
This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables. See http://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
Setting environment variables from .travis.yml
$ export ANDROID_SDKS=android-21
$ export ANDROID_TARGET=android-21
$ jdk_switcher use oraclejdk7
Switching to Oracle JDK7 (java-7-oracle), JAVA_HOME will be set to /usr/lib/jvm/java-7-oracle
$ export TERM=dumb
$ java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
$ javac -version
javac 1.7.0_60
before_install.1
0.01s$ chmod +x gradlew
before_install.2
1.19s$ wget http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz
--2014-11-30 13:29:31-- http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz
Resolving dl.google.com (dl.google.com)... 74.125.228.97, 74.125.228.98, 74.125.228.99, ...
Connecting to dl.google.com (dl.google.com)|74.125.228.97|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 140827643 (134M) [application/x-tar]
Saving to: `android-sdk_r23.0.2-linux.tgz'
100%[======================================>] 140,827,643 118M/s in 1.1s
2014-11-30 13:29:33 (118 MB/s) - `android-sdk_r23.0.2-linux.tgz' saved [140827643/140827643]
before_install.3
1.37s$ tar xzf android-sdk_r23.0.2-linux.tgz
before_install.4
0.00s$ export ANDROID_HOME=$PWD/android-sdk-linux
before_install.5
0.00s$ export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
before_install.6
0.38s$ wget https://dl-ssl.google.com/android/repository/build-tools_r21.1.1-linux.zip
--2014-11-30 13:29:34-- https://dl-ssl.google.com/android/repository/build-tools_r21.1.1-linux.zip
Resolving dl-ssl.google.com (dl-ssl.google.com)... 74.125.22.136, 74.125.22.190, 74.125.22.91, ...
Connecting to dl-ssl.google.com (dl-ssl.google.com)|74.125.22.136|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 32642454 (31M) [application/zip]
Saving to: `build-tools_r21.1.1-linux.zip'
100%[======================================>] 32,642,454 109M/s in 0.3s
2014-11-30 13:29:34 (109 MB/s) - `build-tools_r21.1.1-linux.zip' saved [32642454/32642454]
before_install.7
0.71s$ unzip build-tools_r21.1.1-linux.zip -d $ANDROID_HOME
Archive: build-tools_r21.1.1-linux.zip
creating: /home/travis/build/colymore/firext-android/android-sdk-linux/android-5.0/
inflating: /home/travis/build/colymore/firext-android/android-sdk-linux/android-5.0/NOTICE.txt
before_install.8
0.01s$ mkdir -p $ANDROID_HOME/build-tools/
before_install.9
0.01s$ mv $ANDROID_HOME/android-5.0 $ANDROID_HOME/build-tools/21.1.1
before_install.10
3.17s$ echo yes | android update sdk --filter build-tools-21.1.1 --no-ui --force > /dev/null
Error: Ignoring unknown package filter 'build-tools-21.1.1'
before_install.11
1.19s$ echo yes | android update sdk --filter tools --no-ui --force > /dev/null
before_install.12
2.30s$ echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
before_install.13
7.11s$ echo yes | android update sdk --filter android-21 --no-ui --force > /dev/null
before_install.14
3.12s$ echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
before_install.15
4.00s$ echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
before_install.16
3.19s$ echo yes | android update sdk --filter extra-google-m2repository --no-ui --force > /dev/null
before_install.17
3.89s$ echo yes | android update sdk --filter extra-google-google_play_services --no-ui --force > /dev/null
56.27s$ ./gradlew assemble
Downloading https://services.gradle.org/distributions/gradle-2.1-all.zip
[Downloads..]
WARNING: Dependency org.json:json:20080701 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
WARNING [Project: :Firext] variant.getProcessManifest() is deprecated. Call it on one of variant.getOutputs() instead.
:Firext:preBuild
:Firext:compileDebugNdk
:Firext:preDebugBuild
:Firext:checkDebugManifest
:Firext:preReleaseBuild
:Firext:prepareComAndroidSupportAppcompatV72100Library
:Firext:prepareComAndroidSupportCardviewV72102Library
:Firext:prepareComAndroidSupportSupportV42102Library
:Firext:prepareComEtsyAndroidGridLibrary104Library
:Firext:prepareComGithubJohnkilAndroidRobototextviewRobototextview210Library
:Firext:prepareComGoogleAndroidGmsPlayServices6171Library
:Firext:prepareComShamanlandFab005Library
:Firext:prepareComSnappydbSnappydbLib050Library
:Firext:prepareDebugDependencies
:Firext:compileDebugAidl
:Firext:compileDebugRenderscript
:Firext:generateDebugBuildConfig
:Firext:generateDebugAssets UP-TO-DATE
:Firext:mergeDebugAssets
:Firext:generateDebugResValues
:Firext:generateDebugResources
:Firext:mergeDebugResources
/home/travis/build/colymore/firext-android/Firext/src/main/res/drawable-hdpi/ic_launcher.png: Error: Cannot run program "/home/travis/build/colymore/firext-android/android-sdk-linux/build-tools/21.1.1/aapt": error=2, No such file or directory
:Firext:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Firext:mergeDebugResources'.
> /home/travis/build/colymore/firext-android/Firext/src/main/res/drawable-hdpi/ic_launcher.png: Error: Cannot run program "/home/travis/build/colymore/firext-android/android-sdk-linux/build-tools/21.1.1/aapt": error=2, No such file or directory
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 28.369 secs
The command "eval ./gradlew assemble" failed. Retrying, 2 of 3.
WARNING: Dependency org.json:json:20080701 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
WARNING: Dependency org.json:json:20080701 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
WARNING [Project: :Firext] variant.getProcessManifest() is deprecated. Call it on one of variant.getOutputs() instead.
:Firext:preBuild
:Firext:compileDebugNdk UP-TO-DATE
:Firext:preDebugBuild
:Firext:checkDebugManifest
:Firext:preReleaseBuild
:Firext:prepareComAndroidSupportAppcompatV72100Library UP-TO-DATE
:Firext:prepareComAndroidSupportCardviewV72102Library UP-TO-DATE
:Firext:prepareComAndroidSupportSupportV42102Library UP-TO-DATE
:Firext:prepareComEtsyAndroidGridLibrary104Library UP-TO-DATE
:Firext:prepareComGithubJohnkilAndroidRobototextviewRobototextview210Library UP-TO-DATE
:Firext:prepareComGoogleAndroidGmsPlayServices6171Library UP-TO-DATE
:Firext:prepareComShamanlandFab005Library UP-TO-DATE
:Firext:prepareComSnappydbSnappydbLib050Library UP-TO-DATE
:Firext:prepareDebugDependencies
:Firext:compileDebugAidl UP-TO-DATE
:Firext:compileDebugRenderscript UP-TO-DATE
:Firext:generateDebugBuildConfig UP-TO-DATE
:Firext:generateDebugAssets UP-TO-DATE
:Firext:mergeDebugAssets UP-TO-DATE
:Firext:generateDebugResValues UP-TO-DATE
:Firext:generateDebugResources UP-TO-DATE
:Firext:mergeDebugResources
/home/travis/build/colymore/firext-android/Firext/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/res/drawable-mdpi/abc_btn_radio_to_on_mtrl_000.png: Error: Cannot run program "/home/travis/build/colymore/firext-android/android-sdk-linux/build-tools/21.1.1/aapt": error=2, No such file or directory
:Firext:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Firext:mergeDebugResources'.
> /home/travis/build/colymore/firext-android/Firext/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/res/drawable-mdpi/abc_btn_radio_to_on_mtrl_000.png: Error: Cannot run program "/home/travis/build/colymore/firext-android/android-sdk-linux/build-tools/21.1.1/aapt": error=2, No such file or directory
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 11.542 secs
The command "eval ./gradlew assemble" failed. Retrying, 3 of 3.
WARNING: Dependency org.json:json:20080701 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
WARNING: Dependency org.json:json:20080701 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
WARNING [Project: :Firext] variant.getProcessManifest() is deprecated. Call it on one of variant.getOutputs() instead.
:Firext:preBuild
:Firext:compileDebugNdk UP-TO-DATE
:Firext:preDebugBuild
:Firext:checkDebugManifest
:Firext:preReleaseBuild
:Firext:prepareComAndroidSupportAppcompatV72100Library UP-TO-DATE
:Firext:prepareComAndroidSupportCardviewV72102Library UP-TO-DATE
:Firext:prepareComAndroidSupportSupportV42102Library UP-TO-DATE
:Firext:prepareComEtsyAndroidGridLibrary104Library UP-TO-DATE
:Firext:prepareComGithubJohnkilAndroidRobototextviewRobototextview210Library UP-TO-DATE
:Firext:prepareComGoogleAndroidGmsPlayServices6171Library UP-TO-DATE
:Firext:prepareComShamanlandFab005Library UP-TO-DATE
:Firext:prepareComSnappydbSnappydbLib050Library UP-TO-DATE
:Firext:prepareDebugDependencies
:Firext:compileDebugAidl UP-TO-DATE
:Firext:compileDebugRenderscript UP-TO-DATE
:Firext:generateDebugBuildConfig UP-TO-DATE
:Firext:generateDebugAssets UP-TO-DATE
:Firext:mergeDebugAssets UP-TO-DATE
:Firext:generateDebugResValues UP-TO-DATE
:Firext:generateDebugResources UP-TO-DATE
:Firext:mergeDebugResources
/home/travis/build/colymore/firext-android/Firext/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/res/drawable-mdpi/abc_btn_radio_to_on_mtrl_000.png: Error: Cannot run program "/home/travis/build/colymore/firext-android/android-sdk-linux/build-tools/21.1.1/aapt": error=2, No such file or directory
:Firext:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Firext:mergeDebugResources'.
> /home/travis/build/colymore/firext-android/Firext/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/res/drawable-mdpi/abc_btn_radio_to_on_mtrl_000.png: Error: Cannot run program "/home/travis/build/colymore/firext-android/android-sdk-linux/build-tools/21.1.1/aapt": error=2, No such file or directory
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 11.423 secs
The command "eval ./gradlew assemble" failed 3 times.
The command "./gradlew assemble" failed and exited with 1 during .
Your build has been stopped.
To Top
Tip:
Did you know that you can split a build into several smaller pieces? Learn more
How can we help?
Support Ticket
Live Chat
E-Mail us
Documentation
Running Jobs (0)
There are no jobs
Queue (0)
There are no jobs
Update: VM images already include fixed android-wait-for-emulator script and android SDK tools version 24.0.0 by default solving issues I commented.
Solution - issue 1: Appcompat v21.0.2
I suggest you try to update platform-tools before tools.
Tools 23.0.5 requires platform-tools 19+, so i don't think you are updating it.
And appcompat-v7:21.0.2 requires last android-m2repository that requires tools 23.0.5.
Update: If I'm right about the issue2, you are using their pre-installed SDK, so you are updating tools correctly because they preinstalled platform-tools v20 but if you solve issue2, your problem will be issue1. I'm not sure about issue 2 because you use language:java, I use language:android. Check the path and search their SDK tools echo $PATH.
Alternative: If I'm wrong and your problems persist. I see you include a library that could depen on android-support-v4 and appcompat-v7.
Check dependencies conflicts.
- ./gradlew androidDependencies
- ./gradlew -q :Firext:dependencies
- ./gradlew -q :Firext:dependencyInsight --dependency support-v4 --configuration compile
- ./gradlew -q :Firext:dependencyInsight --dependency appcompat-v7 --configuration compile
You need version 21.0.2 from android.m2repository, you can try to exclude them.
compile files('libs/com.mobandme.ada_v2.4.4.jar') {
exclude group: 'com.android.support'
}
Solution - issue 2: Builds-tools aapt not found
I read in your log that build-tools/aapt is not found. You are adding ANDROID_HOME to the end of PATH, but Travis-ci already did first, so you are using their tools/android at usr/local/android-sdk-23.0.2 that includes build-tools v20.0.0 no 21.1.1.
As you are using docker and you can not update tools to 23.0.5 there due to another issue, you can use my work around so you save already installed platforms and system-images and can use old tools/android to update to 23.0.5. You don't need download it using wget:
- echo "WARNING! delete when fixed"; export OLD_SDK=/usr/local/android-sdk-23.0.2
- cp -R ${OLD_SDK}/tools ${SDK}/tools || echo "SDK tools copy failed."
- cp -R ${OLD_SDK}/platforms ${SDK}/platforms || echo "SDK platforms copy failed."
- cp -R ${OLD_SDK}/system-images ${SDK}/system-images || echo "SDK system-images copy failed."
or wait they update VM images soon
or change the order, so you use your SDK:
- export ANDROID_HOME=${TRAVIS_BUILD_DIR}/android-sdk-linux
- export PATH=${ANDROID_HOME}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH}
Suggestion:
you don't need download build-tools using wget.
I'm currently using this for updates:
- echo "LIST SUGGESTED SDK PACKAGES"; android list sdk -e || true
- echo "LIST AVAILABLE SDK PACKAGES"; android list sdk -a -e || true
- echo "UPDATE PACKAGES IF REQUIRED"; echo y | android update sdk -u -t platform-tool,tool,\
extra-android-support,extra-google-google_play_services,\
extra-android-m2repository,extra-google-m2repository,\
android-19,sys-img-armeabi-v7a-android-19,\
android-18,sys-img-armeabi-v7a-android-18,\
android-17,sys-img-armeabi-v7a-android-17,\
android-16,sys-img-armeabi-v7a-android-16,\
android-15,sys-img-armeabi-v7a-android-15 || true
- echo "UPDATE PACKAGES IF POSSIBLE"; echo y | android update sdk -a -u -t ${BUILD_TOOLS},\
android-20,android-21,${SDK_EXTRA_PKGS:-} || true
- echo "LIST SDK UPDATES BY FILTERS"; android update sdk -u -n -t platform,system-image,\
add-on,extra || true

Categories

Resources