मैं निम्नलिखित समस्या का सामना करना पड़:एंड्रॉयड एस्प्रेसो यूआई परीक्षण - चल परीक्षण विफल रहा: इंस्ट्रुमेंटेशन रन की वजह से विफल 'java.lang.IllegalAccessError'
जब मैं एस्प्रेसो मैं हमेशा का उपयोग कर एक स्टैंड-अलोन यूआई परीक्षण शुरू करने की कोशिश परीक्षण चलाने के बिना निम्न कंसोल त्रुटि संदेश प्राप्त करें।
Test running startedTest running failed: Instrumentation run failed due to 'java.lang.IllegalAccessError'
Empty test suite.
तो मैं आदेश भागने की कोशिश की:
gradle -q dependencies
और मैं निम्नलिखित परिणाम प्राप्त:
androidTestCompile - Classpath for compiling the androidTest sources.
+--- com.android.support:support-annotations:23.0.1
+--- com.android.support.test:runner:0.3
| +--- com.android.support.test:exposed-instrumentation-api-publish:0.3
| +--- junit:junit:4.12
| | \--- org.hamcrest:hamcrest-core:1.3
| \--- com.android.support:support-annotations:22.2.0 -> 23.0.1
+--- com.android.support.test:rules:0.3
| \--- com.android.support.test:runner:0.3 (*)
+--- com.android.support.test.espresso:espresso-core:2.1 -> 2.2
| +--- com.android.support.test.espresso:espresso-idling-resource:2.2
| +--- com.squareup:javawriter:2.1.1
| +--- javax.inject:javax.inject:1
| +--- org.hamcrest:hamcrest-library:1.3
| | \--- org.hamcrest:hamcrest-core:1.3
| +--- com.android.support.test:rules:0.3 (*)
| +--- org.hamcrest:hamcrest-integration:1.3
| | \--- org.hamcrest:hamcrest-library:1.3 (*)
| +--- com.google.code.findbugs:jsr305:2.0.1
| +--- javax.annotation:javax.annotation-api:1.2
| \--- com.android.support.test:runner:0.3 (*)
+--- com.android.support.test.espresso:espresso-intents:2.2
| \--- com.android.support.test.espresso:espresso-core:2.2 (*)
+--- com.android.support.test.espresso:espresso-web:2.2
| +--- org.ccil.cowan.tagsoup:tagsoup:1.2
| +--- com.android.support:support-annotations:22.2.0 -> 23.0.1
| \--- com.android.support.test.espresso:espresso-core:2.2 (*)
+--- com.android.support.test.uiautomator:uiautomator-v18:2.1.1
+--- com.android.support.test.espresso:espresso-contrib:2.2
| +--- com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.0
| | \--- org.hamcrest:hamcrest-core:1.3
| +--- com.android.support:support-v4:22.2.0
| | \--- com.android.support:support-annotations:22.2.0 -> 23.0.1
| +--- com.android.support:recyclerview-v7:22.2.0
| | +--- com.android.support:support-annotations:22.2.0 -> 23.0.1
| | \--- com.android.support:support-v4:22.2.0 (*)
| \--- com.android.support.test.espresso:espresso-core:2.2 (*)
\--- com.android.support:multidex-instrumentation:1.0.1
मैं इस विषय पर कुछ समाधान खोजने की कोशिश की, लेकिन भाग्य के बिना।
मैं नहीं जानता कि वास्तव में क्या मैं परीक्षण काम कर रहे बनाने के लिए अद्यतन करने के लिए करना चाहिए।
@RunWith(AndroidJUnit4.class)
public class SignInActivityTest extends ActivityInstrumentationTestCase2<SignInActivity> {
public TestHelper tl = new TestHelper();
public SignInActivityTest() {
super(SignInActivity.class);
}
@Before
public void setUp() throws Exception {
super.setUp();
injectInstrumentation(InstrumentationRegistry.getInstrumentation());
SignInActivity lActivity = getActivity();
}
// Insert scenario methods here
@Test
public void processTest() throws InterruptedException {
// TODO: strings which are inserted into inputs should be defined as the string constants
// Discuss it with Jan Sedlacek.
tl.insertTextIntoInput(R.id.login_txv_username, "test");
tl.insertTextIntoInput(R.id.login_txv_password, "test");
}
}
क्या मैं इस काम के लिए कृपया बनाने के लिए बदलने के लिए चाहिए:
यहाँ app.gradle कॉन्फ़िग फ़ाइल
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "test.my.app"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
repositories {
jcenter()
mavenCentral()
maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.orhanobut:logger:1.11'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:design:23.0.1'
// UI TESTING DEPENDENCIES
androidTestCompile 'com.android.support:support-annotations:23.0.1'
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
//androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2'
androidTestCompile('com.android.support:multidex-instrumentation:1.0.1') {
exclude group: 'com.android.support', module: 'multidex'
}
// ORM DATABASE DEPENDENCIES
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
// STETHO CORE
compile 'com.facebook.stetho:stetho:1.1.1'
compile 'com.facebook.stetho:stetho-urlconnection:1.1.1'
compile 'com.facebook.stetho:stetho-okhttp:1.1.1'
// GOOGLE ANALYTICS
compile 'com.google.android.gms:play-services-analytics:7.8.0'
// JODA TIME FOR ANDROID
compile 'net.danlew:android.joda:2.8.2'
// SECURE SHARED PREFERENCES
compile 'com.scottyab:secure-preferences-lib:0.1.3'
// MATERIAL DIALOG
compile 'com.avast:android-styled-dialogs:2.2.0'
// SQL CIPHER
compile 'com.commonsware.cwac:sqlcipher-for-android:3.3.1'
// HTML PARSER
compile 'org.jsoup:jsoup:1.8.3'
// MULTIDEX SUPPORT
compile 'com.android.support:multidex:1.0.1'
// SECOND MATERIAL DIALOG
compile('com.afollestad.material-dialogs:core:[email protected]') {
transitive = true
}
compile('com.afollestad.material-dialogs:commons:[email protected]') {
transitive = true
}
// ANDROID BOOTSTRAP
compile 'com.beardedhen:androidbootstrap:2.0.0'
}
और नमूने का परीक्षण वर्ग की है? मैं किसी भी मदद के लिए खुश हूँ।
क्या आपने इसे ठीक करने का प्रबंधन किया था? मैं एक ही मुद्दे में भाग रहा हूँ। मेरा परीक्षण वास्तव में एंड्रॉइडटेस्टकेस को विस्तारित कर रहा था। –
मैं एक ही समस्या से पीड़ित हूं। उस पर कोई समाधान? –