Travis CI Build Fails for android-20 and android-22 - android

I want to test my code from android-15 to android-23, but unfortunately build fails for android-20 and android-22.
Error: Invalid --tag default for the selected target.
The command "echo no | android create avd --force -n test -t
$ANDROID_TARGET --abi $ANDROID_ABI" failed and exited with 1 during .
travis file :
language: android
sudo: false
jdk: oraclejdk7
os:
- linux
android:
components:
- platform-tools
- tools
- build-tools-23.0.3
- android-23
# Additional components
- extra
- extra-google-m2repository
- extra-android-m2repository
- extra-android-support
# Images
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
env:
matrix:
- ANDROID_SDKS=android-15 ANDROID_TARGET=android-15 ANDROID_ABI=armeabi-v7a
- ANDROID_SDKS=android-16 ANDROID_TARGET=android-16 ANDROID_ABI=armeabi-v7a
- ANDROID_SDKS=android-17 ANDROID_TARGET=android-17 ANDROID_ABI=armeabi-v7a
- ANDROID_SDKS=android-18 ANDROID_TARGET=android-18 ANDROID_ABI=armeabi-v7a
- ANDROID_SDKS=android-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
- ANDROID_SDKS=android-20 ANDROID_TARGET=android-20 ANDROID_ABI=armeabi-v7a
- ANDROID_SDKS=android-21 ANDROID_TARGET=android-21 ANDROID_ABI=armeabi-v7a
- ANDROID_SDKS=android-22 ANDROID_TARGET=android-22 ANDROID_ABI=armeabi-v7a
- ANDROID_SDKS=android-23 ANDROID_TARGET=android-23 ANDROID_ABI=armeabi-v7a
global:
# wait up to 10 minutes for adb to connect to emulator
- ADB_INSTALL_TIMEOUT=10
cache:
directories:
- $HOME/.gradle/caches/2.10
- $HOME/.gradle/caches/jars-1
- $HOME/.gradle/daemon
- $HOME/.gradle/native
- $HOME/.gradle/wrapper
before_install:
- chmod +x gradlew
before_script:
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
- emulator -avd test -no-skin -no-audio -no-window &
script:
- android-wait-for-emulator
- adb devices
- adb shell setprop dalvik.vm.dexopt-flags v=n,o=v
- adb shell input keyevent 82 &
- ./gradlew connectedCheck
travis result
How fix it?

The Android 20 SDK target is for KitKat4.4 wearables and has a slightly different system image with abi prefix that is causing the error.
Under the #images you can add the image provided by Travis-CI
- sys-img-armeabi-v7a-android-wear-20
In the android 20 matrix script you will have to add android-wear/armeabi-v7
- ANDROID_SDKS=android-20 ANDROID_TARGET=android-20 ANDROID_ABI=android-wear/armeabi-v7a

Related

Android Travis CI Error: Invalid --abi armeabi-v7a for the selected target

My Travis build keeps failing because apparently it does not recognize the arm abi. Here's my full .travis.yml:
language: android
sudo: required
env:
global:
- ANDROID_API_LEVEL=28
- ANDROID_BUILD_TOOLS_VERSION=28.0.3
- ANDROID_ABI=armeabi-v7a
- ANDROID_EMU_API_LEVEL=27
android:
components:
- tools
- platform-tools
- tools # appears twice as per Travis docs
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
- android-$ANDROID_API_LEVEL
- android-$ANDROID_EMU_API_LEVEL
- extra-android-m2repository
- sys-img-${ANDROID_ABI}-android-${ANDROID_EMU_API_LEVEL}
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
before_script:
- echo no | android create avd --force -n test -t android-$ANDROID_EMU_API_LEVEL --abi $ANDROID_ABI -c 100M
- emulator -avd test -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
- chmod +x gradlew
script:
- android list target
- ./gradlew clean build
- ./gradlew test
- ./gradlew connectedCheck
I have also tried to change the abi in the emulator to google_apis/armeabi-v7a to no avail. Also tried to add google_apis in the system image download. I have currently tried API_LEVEL 22, 27 and 28.
What is the issue here?
You can try ANDROID_ABI=arm64-v8ainstead of ANDROID_ABI=armeabi-v7a
I don't know if this is still relevant since it was asked 4 months ago, but I also just recently had this same issue. I tried many different things people suggested and none of it worked till I set it up this way:
language: android
sudo: required
jdk: oraclejdk8
env:
global:
- ANDROID_API_LEVEL=28
- ANDROID_BUILD_TOOLS_VERSION=28.0.3
- ANDROID_ABI=armeabi-v7a
android:
components:
- tools
- platform-tools
- tools
- extra-android-m2repository
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
before_install:
- touch $HOME/.android/repositories.cfg
- yes | sdkmanager "platforms;android-28"
- yes | sdkmanager "build-tools;28.0.3"
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
before_script:
- chmod +x gradlew
script:
- ./gradlew clean build
- ./gradlew test

Travis Android build fails due to "Target id is not valid."

I want to run android tests on a connected device. This is my .travis.yml file:
language: android
jdk: oraclejdk8
env:
global:
- ADB_INSTALL_TIMEOUT=10
before_cache:
- cd ${TRAVIS_BUILD_DIR}/gradle/caches/
- find . -name "*.lock" -exec rm -rfv {} \;
- cd ${TRAVIS_BUILD_DIR}
cache:
directories:
- ${TRAVIS_BUILD_DIR}/gradle/caches/
- ${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/
notifications:
email: false
android:
components:
- tools
- build-tools-25.0.2
- platform-tools
- tools
- sys-img-armeabi-v7a-android-22
install:
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"
# Show version and download Gradle Wrapper if it's not already cached
- ./gradlew --version
# Check components status
- sdkmanager --list || true
# Emulator Management: Create, Start and Wait
before_script:
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- emulator -avd test -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- android list target
- ./gradlew build connectedCheck test jacocoTestReport
after_script:
# Show lint results
- cat ${TRAVIS_BUILD_DIR}/*/build/reports/lint-results.xml
after_success:
- bash <(curl -s https://codecov.io/bash)
Here is the build log https://travis-ci.org/mueller-ma-bot/openhab.android/builds/311512604?utm_source=github_status&utm_medium=notification
Check this line in the build log:
Skipping 'ARM EABI v7a System Image, Android API 22, revision 2'; it
depends on 'SDK Platform Android 5.1.1, API 22, revision 2' which was
not installed.
Install missing platform:
android:
components:
- tools
- build-tools-25.0.2
- platform-tools
- tools
- android-22
- sys-img-armeabi-v7a-android-22

Test espresso with Travis

I am trying to test integration tests with Travis-CI. I have the yml:
language: android
jdk: oraclejdk8
sudo: false
android:
components:
- platform-tools
- tools
- build-tools-25.0.2
- android-25
- sys-img-armeabi-v7a-android-22
#Extras
- extra-android-m2repository
- extra-google-m2repository
- extra-android-m2repository
before_script:
- android list targets
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- ./gradlew test
- ./gradlew connectedAndroidTest
script: "./travis-build.sh"
This should work, but I am always getting:
Error: Target id is not valid. Use 'android list targets' to get the target ids.
I have no idea how to fix this problem...
Any help is appreciated
Old VM (used with sudo: false) only include platforms up to android-21, please try this
language: android
jdk: oraclejdk8
sudo: false
android:
components:
- platform-tools
- tools
- build-tools-25.0.2
- android-22 # Android platform used by your alternative emulator
- android-25
- sys-img-armeabi-v7a-android-22
#Extras
- extra-android-m2repository
- extra-google-m2repository # Removed duplicated component
before_script:
- android list targets
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- ./gradlew test
- ./gradlew connectedAndroidTest
script: "./travis-build.sh"

Travis-CI implementation of Android SDK 25 with Emulator

I need help with implementing Travis-CI in my android repository.
My Project is compiled with SDK 25 but is downwards compatible to Version 21.
How do I have to change my .travis.yml to run an android emulator thats compatible with that SDK Version?
.travis.yml:
language: android
jdk: oraclejdk8
android:
components:
- tools # to get the new `repository-11.xml`
- tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
- platform-tools
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-19
- build-tools-25.0.0
- android-25
# - sys-img-armeabi-v7a-android-22
before_script:
#- android update sdk -a --no-ui --filter sys-img-armeabi-v7a-android-25,sys-img-x86_64-android-25
# - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
# - emulator -avd test -no-skin -no-audio -no-window &
# - android-wait-for-emulator
# - adb shell input keyevent 82 &
script:
# - ./gradlew build connectedCheck
Right now it exits with the "no connected devices"-Error, which makes sense, because there is no emulator running. But when I tried it using the android-22 emulator it also crashed with an error like "Android SDK 22 not installed"
EDIT:
The commented lines in the travis.yml didn't work, that's why they are commented out.
For such properties that we have in our project:
compileSdkVersion 25
minSdkVersion 21
targetSdkVersion 25
We use such emulator:
echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a --skin 480x800
No special deps are required in travis.yml besides:
- tools
- platform-tools
- build-tools-25.0.1
- android-25
- extra-android-m2repository
Here is out repository with min SDK 19:
https://github.com/elpassion/el-peon-android
I only answer the android-22 part because I'm not using Travis-ci with recent versions of Android:
language: android
jdk: oraclejdk8
android:
components:
- tools # to get the new `repository-11.xml`
- tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
- platform-tools
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- build-tools-25.0.0
- android-25
- android-22 # Android platform used by your alternative emulator
- sys-img-armeabi-v7a-android-22
before_script:
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- ./gradlew build connectedCheck

Config travis.yml file in android project error

i just want travis ci check my project not have error (i don't have test case). But when i commit my code,travis ci always run fail or error (my project not have error). Someone can help me.
My travis.yml file content:
language: android
android:
components:
- build-tools-23.0.2
- android-23
- extra
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
before_script:
- echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
- emulator -avd test -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script: ./gradlew connectedAndroidTest
Chmod:
Output:

Categories

Resources