मुझे परीक्षण चलाने के लिए नए एंड्रॉइड बिल्ड सिस्टम को आश्वस्त करने में कठिनाई हो रही है। परीक्षण चलाते समय यह Unable to resolve activity for: Intent
त्रुटि देता है जिस पर अन्य प्रश्नों पर चर्चा की गई है लेकिन वहां कुछ भी नहीं है जिसने मेरी समस्या तय की है।एंड्रॉइड/ग्रैडल एस्प्रेसो परीक्षण गतिविधि शुरू नहीं कर रहा है
मैंने इसे नीचे छीन लिया है ताकि मेरा परीक्षण पैकेज मेरे मुख्य पैकेज (com.wealdtech.app
) पर भरोसा न करे, लेकिन अभी भी समस्या शुरू करने में समस्या है।
मेरा परीक्षण गतिविधि:
package com.wealdtech.test;
import android.app.Activity;
import android.os.Bundle;
public class TileLayoutTestActivity extends Activity
{
@Override
public void onCreate(final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
}
और अपने परीक्षण वर्ग:
package com.wealdtech.test;
import android.test.ActivityInstrumentationTestCase2;
public class TileLayoutTest extends ActivityInstrumentationTestCase2<TileLayoutTestActivity>
{
public TileLayoutTest()
{
super(TileLayoutTestActivity.class);
}
@Override
protected void setUp() throws Exception
{
super.setUp();
setActivityInitialTouchMode(false);
}
public void testNull()
{
final TileLayoutTestActivity activity = getActivity();
activity.finish();
}
build.gradle के प्रासंगिक भागों:
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
testPackageName "com.wealdtech.test"
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
}
पूर्ण स्टैक ट्रेस मैं प्राप्त है:
java.lang.RuntimeException: Could not launch activity
at com.google.android.apps.common.testing.testrunner.GoogleInstrumentation.startActivitySync(GoogleInstrumentation.java:286)
at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:119)
at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:97)
at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:104)
at com.wealdtech.test.TileLayoutTest.testNull(TileLayoutTest.java:21)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
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:1701)
Caused by: java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.wealdtech.test/.TileLayoutTestActivity }
at android.app.Instrumentation.startActivitySync(Instrumentation.java:379)
at com.google.android.apps.common.testing.testrunner.GoogleInstrumentation.access$101(GoogleInstrumentation.java:52)
at com.google.android.apps.common.testing.testrunner.GoogleInstrumentation$2.call(GoogleInstrumentation.java:268)
at com.google.android.apps.common.testing.testrunner.GoogleInstrumentation$2.call(GoogleInstrumentation.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
मैंने अपना AndroidManifest.xml
शामिल नहीं किया है क्योंकि मैंने जो कुछ भी पढ़ा है, वह बताता है कि मुझे TileLayoutTestActivity
के लिए कोई इरादा जोड़ने की आवश्यकता नहीं है, हालांकि मैंने इसे वैसे भी करने की कोशिश की है और उसी परिणाम के साथ समाप्त हो गया है।
मैंने समस्या उत्पन्न करने के मामले में android-library
से android
तक ग्रैडल प्लगइन को बदलने का भी प्रयास किया है, लेकिन फिर एक ही परिणाम।
मैं एस्प्रेसो परीक्षण के लिए पूर्व शर्त के बारे में कोई दस्तावेज नहीं देख सकता, या ग्रैडल बिल्ड सिस्टम के साथ परीक्षण कर रहा हूं, जिसे मैंने पहले ही कवर नहीं किया है। कोई भी विचार जिसके लिए मैं परीक्षण के हिस्से के रूप में गतिविधि शुरू नहीं कर सकता?
क्या आप इसके लिए एक फिक्स ढूंढ पाएंगे? मेरी परियोजना पर एक ही मुद्दे में चल रहा है। –