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"
Related
Currently, I am facing a travis CI build error in my repository here, and I'd really like to know the exact issue as connectedCheck only outputs
Tests on test(AVD) - 5.1.1 failed: Instrumentation run failed due to 'java.lang.NullPointerException'
in Travis, and the tests are passing just fine in my own machine.
This is my current .travis.yml :
sudo: required
language: android
jdk: oraclejdk8
env:
global:
- ANDROID_TARGET=android-22
- ANDROID_ABI=armeabi-v7a
android:
components:
- tools
- platform-tools
- build-tools-27.0.3
- android-27
- android-22
- extra-android-m2repository
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
before_script:
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
- emulator -avd test -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
- ./build.sh
- ./gradlew connectedCheck coveralls
on:
tags: true
I want to know how to get a more detailed error message (e.g. line number).
Well, it's right there in logs, according to travis job, here's the test which is failing test_shouldConvertMonthsToYears due to java.lang.NullPointerException.
Hope it helps.
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
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
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:
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