Android/Gradle espresso test not starting activity -


i'm having difficulty convincing new android build system run tests. when running test gives unable resolve activity for: intent error has been discussed in other questions there nothing in there have fixed problem.

i've stripped down test package not rely on main package (com.wealdtech.app) @ still have problem starting activity.

my test activity:

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);   } } 

and test class:

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();   } 

relevant parts of 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"   } } 

the full stack trace obtain is:

java.lang.runtimeexception: not launch activity @ com.google.android.apps.common.testing.testrunner.googleinstrumentation.startactivitysync(googleinstrumentation.java:286) @ android.test.instrumentationtestcase.launchactivitywithintent(instrumentationtestcase.java:119) @ android.test.instrumentationtestcase.launchactivity(instrumentationtestcase.java:97) @ android.test.activityinstrumentationtestcase2.getactivity(activityinstrumentationtestcase2.java:104) @ com.wealdtech.test.tilelayouttest.testnull(tilelayouttest.java:21) @ java.lang.reflect.method.invokenative(native method) @ android.test.instrumentationtestcase.runmethod(instrumentationtestcase.java:214) @ android.test.instrumentationtestcase.runtest(instrumentationtestcase.java:199) @ android.test.activityinstrumentationtestcase2.runtest(activityinstrumentationtestcase2.java:192) @ android.test.androidtestrunner.runtest(androidtestrunner.java:191) @ android.test.androidtestrunner.runtest(androidtestrunner.java:176) @ android.test.instrumentationtestrunner.onstart(instrumentationtestrunner.java:554) @ com.google.android.apps.common.testing.testrunner.googleinstrumentationtestrunner.onstart(googleinstrumentationtestrunner.java:167) @ android.app.instrumentation$instrumentationthread.run(instrumentation.java:1701) caused by: java.lang.runtimeexception: unable resolve activity for: intent { act=android.intent.action.main flg=0x14000000 cmp=com.wealdtech.test/.tilelayouttestactivity } @ android.app.instrumentation.startactivitysync(instrumentation.java:379) @ com.google.android.apps.common.testing.testrunner.googleinstrumentation.access$101(googleinstrumentation.java:52) @ com.google.android.apps.common.testing.testrunner.googleinstrumentation$2.call(googleinstrumentation.java:268) @ com.google.android.apps.common.testing.testrunner.googleinstrumentation$2.call(googleinstrumentation.java:266) @ java.util.concurrent.futuretask.run(futuretask.java:237) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) @ java.lang.thread.run(thread.java:841) 

i haven't included androidmanifest.xml because read suggests not need add intent tilelayouttestactivity, have tried anyway , ended same result.

i have tried changing gradle plugin android-library android in case causing problem, again same result.

i can't see documentation regarding prerequisites espresso testing, or testing gradle build system, haven't covered. ideas cannot start activity part of test?

reference others can come post came, don't lose time.

  1. change legacy, abandoned, ugly activityinstrumentationtestcase2 annotations supported androidstudio, gradle , espresso 2. developed google further.

  2. forget activityinstrumentationtestcase2 forever!

  3. start using @runwith, @largetest, @test, @rule ...


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -