I'm using Double Espresso from Jake Wharton, which helps with Google Espresso integration in Android Studio and Gradle. The trouble comes with compatibility library (support-v4), which classes are unavailable in test builds:
java.lang.RuntimeException: Exception during suite construction
at android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests.testSuiteConstructionFailed(TestSuiteBuilder.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner.onStart(GoogleInstrumentationTestRunner.java:167)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1840)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.test.suitebuilder.TestMethod.instantiateTest(TestMethod.java:87)
at android.test.suitebuilder.TestMethod.createTest(TestMethod.java:73)
at android.test.suitebuilder.TestSuiteBuilder.addTest(TestSuiteBuilder.java:262)
at android.test.suitebuilder.TestSuiteBuilder.build(TestSuiteBuilder.java:184)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:379)
at com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner.onCreate(GoogleInstrumentationTestRunner.java:114)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5142)
at android.app.ActivityThread.access$1500(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1418)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5872)
at java.lang.reflect.Method.invokeNative(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1069)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:885)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: net.skoumal.project.activity.MainActivity
at net.skoumal.project.test.MainActivityTest.<init>(MainActivityTest.java:30)
... 19 more
The solution is very simple, just change this lines in your gradle.build:
androidTestCompile 'com.jakewharton.espresso:espresso:1.1-r3'
androidTestCompile('com.jakewharton.espresso:espresso-support-v4:1.1-r3')
by adding exlude for compatibility library:
androidTestCompile 'com.jakewharton.espresso:espresso:1.1-r3'
androidTestCompile('com.jakewharton.espresso:espresso-support-v4:1.1-r3') {
exclude group: 'com.android.support'
}
Related
I am new developing Android Apps, I'm trying to run an application but I receive this error
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at app.unityudx.io.new_app.process.UnityApplication.onCreate(UnityApplication.java:59)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:999)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4151)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org.slf4j.helpers.SubstituteLoggerFactory
at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:86)
at app.unityudx.io.new_app.process.UnityApplication.onCreate(UnityApplication.java:59)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:999)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4151)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
I researched, and people in internet say that the class is not in Classpath, but when I add implementation 'org.slf4j:slf4j-android:1.7.25' in graddle this error present
Program type already present: org.slf4j.impl.StaticMDCBinder
Android Studio is 3.1.2
It seems that other lib includes that lib. you need to find out which one and add :
exclude.
in my case it was:
implementation (group: 'io.jafka', name: 'jeos', version: '0.9.14') {
exclude module: 'slf4j-log4j12'
}
I am building a chat app using Firebase. When I want to test my app this error shows and the app crashes. The error is:
09-26 17:27:38.437 29482-29482/shashoug.com.zoolisd E/AndroidRuntime: FATAL EXCEPTION: main
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309)
at android.app.ActivityThread.access$700(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "shashoug.com.zoolisd.MainActivity" on path: /data/app/shashoug.com.zoolisd-2.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1071)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2171)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309)
at android.app.ActivityThread.access$700(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
09-26 17:27:40.079 29482-29482/? I/Process: Sending signal. PID: 29482 SIG: 9
As it was said in earlier answers, just try:
Build - Clean project, after that
Build - Rebuild project.
Also, if it doesn't help, try File - Invalidate Caches/Restart - Invalidate.
After all of above, delete app from your device and install it again.
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: /data/app/com.example.admin.map-2.apk
at android.app.ActivityThread.installProvider(ActivityThread.java:4820)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4430)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4372)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: /data/app/com.example.admin.map-2.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.ActivityThread.installProvider(ActivityThread.java:4805)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4430)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4372)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
if you want to use only map service then only compile dependency of map:
compile 'com.google.android.gms:play-services-maps:10.0.0'
do not compile the complete play service dependency:
compile 'com.google.android.gms:play-services:10.0.1'
It will solve your problem.
I want to use espresso tests with gradle. To do that I tried to use double-espresso by Jake Wharton, but it doesn't work.
I've read that it could be duplicated dependencies, but I have excluded Dagger and Support-v4 libs, like Jake wrote in his README.
Can anyone give me advice on what could be wrong here?
test class:
package info.korzeniowski.myapp.test;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;
import info.korzeniowski.myapp.R;
import info.korzeniowski.myapp.activity.MainActivity_;
import static com.google.android.apps.common.testing.ui.espresso.Espresso.onView;
import static com.google.android.apps.common.testing.ui.espresso.assertion.ViewAssertions.matches;
import static com.google.android.apps.common.testing.ui.espresso.contrib.DrawerActions.closeDrawer;
import static com.google.android.apps.common.testing.ui.espresso.contrib.DrawerActions.openDrawer;
import static com.google.android.apps.common.testing.ui.espresso.contrib.DrawerMatchers.isClosed;
import static com.google.android.apps.common.testing.ui.espresso.contrib.DrawerMatchers.isOpen;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withId;
public class BasicTest extends ActivityInstrumentationTestCase2<MainActivity_> {
public BasicTest() {
super(MainActivity_.class);
}
#Override
protected void setUp() throws Exception {
super.setUp();
getActivity();
}
#LargeTest
public void testOpenAndCloseDrawer() {
onView(withId(R.id.drawer_layout)).check(matches(isClosed()));
openDrawer(R.id.drawer_layout);
onView(withId(R.id.drawer_layout)).check(matches(isOpen()));
closeDrawer(R.id.drawer_layout);
onView(withId(R.id.drawer_layout)).check(matches(isClosed()));
}
}
build.gradle:
buildscript {
def androidGradlePluginVersion= '0.9.+'
def androidAptVersion = '1.2+'
repositories {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:${androidGradlePluginVersion}"
classpath "com.neenbedankt.gradle.plugins:android-apt:${androidAptVersion}"
}
}
repositories {
mavenCentral()
mavenLocal()
}
apply plugin: 'android'
apply plugin: 'android-apt'
apt {
arguments {
androidManifestFile variant.processResources.manifestFile
resourcePackageName 'info.korzeniowski.myapp'
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'LICENSE.txt'
}
}
def androidSupportVersion = '19.0.+'
def greenDaoVersion = '1.3.+'
def androidAnnotationsVersion = '2.7.1'
def daggerVersion = '1.2.1'
dependencies {
// Android Support
compile "com.android.support:support-v4:${androidSupportVersion}"
compile "com.android.support:appcompat-v7:${androidSupportVersion}"
// Android Annotations
apt "com.googlecode.androidannotations:androidannotations:${androidAnnotationsVersion}"
compile "com.googlecode.androidannotations:androidannotations-api:${androidAnnotationsVersion}"
// Dagger
apt "com.squareup.dagger:dagger-compiler:${daggerVersion}"
compile "com.squareup.dagger:dagger:${daggerVersion}"
// Espresso
androidTestCompile ('com.jakewharton.espresso:espresso:1.1-r2') {
exclude group: 'com.squareup.dagger', module: 'dagger'
}
androidTestCompile ('com.jakewharton.espresso:espresso-support-v4:1.1-r2') {
exclude group: 'com.android.support', module: 'support-v4'
}
}
Test results:
Running tests
Test running started
Test failed to run to completion. Reason: 'Instrumentation run failed due to 'java.lang.IllegalAccessError''. Check device logcat for details
Test running failed: Instrumentation run failed due to 'java.lang.IllegalAccessError'
Logcat:
3-18 12:52:12.168 274-443/system_process I/ActivityManager﹕ Start proc info.korzeniowski.myapp for added application info.korzeniowski.myapp: pid=2998 uid=10049 gids={50049, 1028}
03-18 12:52:27.417 2998-2998/? I/dalvikvm﹕ Failed resolving Lorg/hamcrest/integration/EasyMock2Adapter; interface 2417 'Lorg/easymock/IArgumentMatcher;'
03-18 12:52:27.417 2998-2998/? W/dalvikvm﹕ Link of class 'Lorg/hamcrest/integration/EasyMock2Adapter;' failed
03-18 12:52:27.537 2998-2998/? W/ClassPathPackageInfoSource﹕ Cannot load class. Make sure it is in your apk. Class name: 'org.hamcrest.integration.EasyMock2Adapter'. Message: org.hamcrest.integration.EasyMock2Adapter
java.lang.ClassNotFoundException: org.hamcrest.integration.EasyMock2Adapter
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:204)
at android.test.ClassPathPackageInfoSource.createPackageInfo(ClassPathPackageInfoSource.java:88)
at android.test.ClassPathPackageInfoSource.access$000(ClassPathPackageInfoSource.java:39)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:50)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:47)
at android.test.SimpleCache.get(SimpleCache.java:31)
at android.test.ClassPathPackageInfoSource.getPackageInfo(ClassPathPackageInfoSource.java:72)
at android.test.ClassPathPackageInfo.getSubpackages(ClassPathPackageInfo.java:48)
at android.test.ClassPathPackageInfo.addTopLevelClassesTo(ClassPathPackageInfo.java:61)
at android.test.ClassPathPackageInfo.getTopLevelClassesRecursive(ClassPathPackageInfo.java:55)
at android.test.suitebuilder.TestGrouping.testCaseClassesInPackage(TestGrouping.java:156)
at android.test.suitebuilder.TestGrouping.addPackagesRecursive(TestGrouping.java:117)
at android.test.suitebuilder.TestSuiteBuilder.includePackages(TestSuiteBuilder.java:102)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:366)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4435)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org/hamcrest/integration/EasyMock2Adapter
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:204)
at android.test.ClassPathPackageInfoSource.createPackageInfo(ClassPathPackageInfoSource.java:88)
at android.test.ClassPathPackageInfoSource.access$000(ClassPathPackageInfoSource.java:39)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:50)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:47)
at android.test.SimpleCache.get(SimpleCache.java:31)
at android.test.ClassPathPackageInfoSource.getPackageInfo(ClassPathPackageInfoSource.java:72)
at android.test.ClassPathPackageInfo.getSubpackages(ClassPathPackageInfo.java:48)
at android.test.ClassPathPackageInfo.addTopLevelClassesTo(ClassPathPackageInfo.java:61)
at android.test.ClassPathPackageInfo.getTopLevelClassesRecursive(ClassPathPackageInfo.java:55)
at android.test.suitebuilder.TestGrouping.testCaseClassesInPackage(TestGrouping.java:156)
at android.test.suitebuilder.TestGrouping.addPackagesRecursive(TestGrouping.java:117)
at android.test.suitebuilder.TestSuiteBuilder.includePackages(TestSuiteBuilder.java:102)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:366)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4435)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.hamcrest.integration.EasyMock2Adapter" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/info.korzeniowski.myapp.test-1.apk", zip file "/data/app/info.korzeniowski.myapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/info.korzeniowski.myapp.test-1, /data/app-lib/info.korzeniowski.myapp-1, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:204)
at android.test.ClassPathPackageInfoSource.createPackageInfo(ClassPathPackageInfoSource.java:88)
at android.test.ClassPathPackageInfoSource.access$000(ClassPathPackageInfoSource.java:39)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:50)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:47)
at android.test.SimpleCache.get(SimpleCache.java:31)
at android.test.ClassPathPackageInfoSource.getPackageInfo(ClassPathPackageInfoSource.java:72)
at android.test.ClassPathPackageInfo.getSubpackages(ClassPathPackageInfo.java:48)
at android.test.ClassPathPackageInfo.addTopLevelClassesTo(ClassPathPackageInfo.java:61)
at android.test.ClassPathPackageInfo.getTopLevelClassesRecursive(ClassPathPackageInfo.java:55)
at android.test.suitebuilder.TestGrouping.testCaseClassesInPackage(TestGrouping.java:156)
at android.test.suitebuilder.TestGrouping.addPackagesRecursive(TestGrouping.java:117)
at android.test.suitebuilder.TestSuiteBuilder.includePackages(TestSuiteBuilder.java:102)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:366)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4435)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
03-18 12:52:27.537 2998-2998/? I/dalvikvm﹕ Failed resolving Lorg/hamcrest/integration/JMock1Adapter; interface 2468 'Lorg/jmock/core/Constraint;'
03-18 12:52:27.537 2998-2998/? W/dalvikvm﹕ Link of class 'Lorg/hamcrest/integration/JMock1Adapter;' failed
03-18 12:52:27.587 2998-2998/? W/ClassPathPackageInfoSource﹕ Cannot load class. Make sure it is in your apk. Class name: 'org.hamcrest.integration.JMock1Adapter'. Message: org.hamcrest.integration.JMock1Adapter
java.lang.ClassNotFoundException: org.hamcrest.integration.JMock1Adapter
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:204)
at android.test.ClassPathPackageInfoSource.createPackageInfo(ClassPathPackageInfoSource.java:88)
at android.test.ClassPathPackageInfoSource.access$000(ClassPathPackageInfoSource.java:39)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:50)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:47)
at android.test.SimpleCache.get(SimpleCache.java:31)
at android.test.ClassPathPackageInfoSource.getPackageInfo(ClassPathPackageInfoSource.java:72)
at android.test.ClassPathPackageInfo.getSubpackages(ClassPathPackageInfo.java:48)
at android.test.ClassPathPackageInfo.addTopLevelClassesTo(ClassPathPackageInfo.java:61)
at android.test.ClassPathPackageInfo.getTopLevelClassesRecursive(ClassPathPackageInfo.java:55)
at android.test.suitebuilder.TestGrouping.testCaseClassesInPackage(TestGrouping.java:156)
at android.test.suitebuilder.TestGrouping.addPackagesRecursive(TestGrouping.java:117)
at android.test.suitebuilder.TestSuiteBuilder.includePackages(TestSuiteBuilder.java:102)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:366)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4435)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org/hamcrest/integration/JMock1Adapter
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:204)
at android.test.ClassPathPackageInfoSource.createPackageInfo(ClassPathPackageInfoSource.java:88)
at android.test.ClassPathPackageInfoSource.access$000(ClassPathPackageInfoSource.java:39)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:50)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:47)
at android.test.SimpleCache.get(SimpleCache.java:31)
at android.test.ClassPathPackageInfoSource.getPackageInfo(ClassPathPackageInfoSource.java:72)
at android.test.ClassPathPackageInfo.getSubpackages(ClassPathPackageInfo.java:48)
at android.test.ClassPathPackageInfo.addTopLevelClassesTo(ClassPathPackageInfo.java:61)
at android.test.ClassPathPackageInfo.getTopLevelClassesRecursive(ClassPathPackageInfo.java:55)
at android.test.suitebuilder.TestGrouping.testCaseClassesInPackage(TestGrouping.java:156)
at android.test.suitebuilder.TestGrouping.addPackagesRecursive(TestGrouping.java:117)
at android.test.suitebuilder.TestSuiteBuilder.includePackages(TestSuiteBuilder.java:102)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:366)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4435)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.hamcrest.integration.JMock1Adapter" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/info.korzeniowski.myapp.test-1.apk", zip file "/data/app/info.korzeniowski.myapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/info.korzeniowski.myapp.test-1, /data/app-lib/info.korzeniowski.myapp-1, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:204)
at android.test.ClassPathPackageInfoSource.createPackageInfo(ClassPathPackageInfoSource.java:88)
at android.test.ClassPathPackageInfoSource.access$000(ClassPathPackageInfoSource.java:39)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:50)
at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:47)
at android.test.SimpleCache.get(SimpleCache.java:31)
at android.test.ClassPathPackageInfoSource.getPackageInfo(ClassPathPackageInfoSource.java:72)
at android.test.ClassPathPackageInfo.getSubpackages(ClassPathPackageInfo.java:48)
at android.test.ClassPathPackageInfo.addTopLevelClassesTo(ClassPathPackageInfo.java:61)
at android.test.ClassPathPackageInfo.getTopLevelClassesRecursive(ClassPathPackageInfo.java:55)
at android.test.suitebuilder.TestGrouping.testCaseClassesInPackage(TestGrouping.java:156)
at android.test.suitebuilder.TestGrouping.addPackagesRecursive(TestGrouping.java:117)
at android.test.suitebuilder.TestSuiteBuilder.includePackages(TestSuiteBuilder.java:102)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:366)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4435)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
03-18 12:52:28.477 2998-3011/? I/TestRunner﹕ started: testOpenAndCloseDrawer(info.korzeniowski.myapp.test.BasicTest)
03-18 12:52:28.497 274-439/system_process I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN flg=0x10000000 cmp=info.korzeniowski.myapp/.activity.MainActivity_} from pid 2998
03-18 12:52:28.617 2998-2998/? I/greenDAO﹕ Creating tables for schema version 1
03-18 12:52:28.687 2998-2998/? W/dalvikvm﹕ Class resolved by unexpected DEX: Linfo/korzeniowski/myapp/MyApp;(0x416fc6a8):0x73054000 ref [Ldagger/ObjectGraph;] Ldagger/ObjectGraph;(0x416fc6a8):0x72ec8000
03-18 12:52:28.687 2998-2998/? W/dalvikvm﹕ (Linfo/korzeniowski/myapp/MyApp; had used a different Ldagger/ObjectGraph; during pre-verification)
03-18 12:52:28.697 2998-2998/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41465700)
03-18 12:52:28.738 2998-2998/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
at info.korzeniowski.myapp.MyApp.onCreate(MyApp.java:32)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4444)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
03-18 12:52:28.738 274-286/system_process W/ActivityManager﹕ Error in app info.korzeniowski.myapp running instrumentation ComponentInfo{info.korzeniowski.myapp.test/android.test.InstrumentationTestRunner}:
03-18 12:52:28.738 274-286/system_process W/ActivityManager﹕ java.lang.IllegalAccessError
03-18 12:52:28.738 274-286/system_process W/ActivityManager﹕ java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementationF
Since class is not found in org.hamcrest.integration package, try excluding it. Then your your dependencies would look like
// Espresso
androidTestCompile ('com.jakewharton.espresso:espresso:1.1-r2') {
exclude group: 'com.squareup.dagger', module: 'dagger'
exclude group: 'org.hamcrest', module: 'hamcrest-integration'
}
androidTestCompile ('com.jakewharton.espresso:espresso-support-v4:1.1-r2') {
exclude group: 'com.android.support', module: 'support-v4'
// Not sure whether line below is needed
exclude group: 'org.hamcrest', module: 'hamcrest-integration'
}
I'm getting FATAL EXCEPTION running android.support.v8.renderscript.* on Razor i, a x86 device. The problem goes away if I use android.renderscript.* Also there is not problem with ARM devices. Here is the exception:
03-03 18:35:26.009 25011-25011/com.example.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 143 cannot locate '__strlen_chk'...
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2115)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2153)
at android.app.ActivityThread.access$700(ActivityThread.java:137)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5031)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 143 cannot locate '__strlen_chk'...
at android.support.v8.renderscript.RenderScript.create(RenderScript.java:945)
at android.support.v8.renderscript.RenderScript.create(RenderScript.java:982)
at android.support.v8.renderscript.RenderScript.create(RenderScript.java:968)
at com.example.app.MainActivity$PlaceholderFragment.createScript(MainActivity.java:92)
at com.example.app.MainActivity$PlaceholderFragment.onCreateView(MainActivity.java:81)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
at android.app.BackStackRecord.run(BackStackRecord.java:635)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1397)
at android.app.Activity.performStart(Activity.java:5067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2088)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2153)
at android.app.ActivityThread.access$700(ActivityThread.java:137)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5031)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
I meet the same issue when I using Build Tools 21.1.1 and proguard, you may need to use the following proguard settings:
-keepclasseswithmembernames class * {
native <methods>;
}
-keep class android.support.v8.renderscript.** { *; }
For more infomation: Using the Android Renderscript v8 Support Library
With Build Tools 21.1.1 this issue disappear.
I think you should also include the native libraries from \build-tools\19.0.2\renderscript\lib\packaged