I'm trying to get my instrumentation tests running on Travis CI. I'm getting this error when the build runs on Travis. However, I don't have any problems running the tests locally. I'm new to Android/Java development so I'm not even sure where to start looking.
...
:MyappAndroid:packageMyappDebugAndroidTest
:MyappAndroid:assembleMyappDebugAndroidTest
:MyappAndroid:connectedMyappDebugAndroidTest
Tests on test(AVD) - 6.0 failed: Instrumentation run failed due to 'java.io.FileNotFoundException'
com.android.builder.testing.ConnectedDevice > No tests found.[test(AVD) - 6.0] FAILED
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).
:MyappAndroid:connectedMyappDebugAndroidTest FAILED
...
Here is one of my tests that I expect to run:
package core.ui.dialogs;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DialogActivityTest {
@Rule
public ActivityTestRule<DialogActivity> mActivityRule = new ActivityTestRule<>(DialogActivity.class);
@Test
public void testSomething() {
// etc...
}
}
My .travis.yml
:
language: android
jdk: oraclejdk7
sudo: false
env:
global:
- ANDROID_API_LEVEL=23
- BUILD_TOOLS_VERSION=23.0.3
- ANDROID_ABI=armeabi-v7a
- ADB_INSTALL_TIMEOUT=8
android:
components:
- tools
- build-tools-$BUILD_TOOLS_VERSION
- android-$ANDROID_API_LEVEL
- add-on
- extra
before_script:
- echo no | android create avd --force -n test -t android-$ANDROID_API_LEVEL --abi $ANDROID_ABI
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script: ./gradlew assembleMyappDebug connectedMyappDebugAndroidTest -PdisablePreDex
Update: Here are a few things that may be relevant in my build.gradle
:
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 19
targetSdkVersion 23
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
// ...
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.squareup.dagger:dagger:1.2.2'
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
// ...
androidTestCompile 'com.squareup:javawriter:2.5.0'
androidTestCompile ('com.android.support.test.espresso:espresso-core:2.0') {
exclude group: 'javax.inject'
}
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
}
I'm also new to android, but I`ll try to help you.
You can follow this answer:
https://groups.google.com/d/msg/adt-dev/QW5SuzQizNk/mWdaEuuCCQAJ
which links to:
https://github.com/google/dagger/issues/271
Basically this maybe the problem:
You might of used compile 'com.google.dagger:dagger-compiler:2.0.2'
incorrectly.
The correct apt 'com.google.dagger:dagger-compiler:2.0.2'
and also check this link same as your issue
https://googleweblight.com/?lite_url=https://github.com/Shippable/support/issues/1453&ei=a6rzQlWF&lc=en-IN&s=1&m=140&host=www.google.co.in&ts=1471246688&sig=AKOVD67-05kCThujPFkmuySpywKlKpVG-g
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With