Issue
This problem popped up recently on one of my development machines. I haven't yet verified it on my other machine, but yesterday I was not having this problem on that machine.
The problem I'm having is when I'm running my tests for my ActivityInstrumentationTestCase2 inherited classes. My device is not in lock-screen. I'm getting the following Exception:
java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.xilconic.achieveitall/.util.activities.TestingFragmentActivity }
at android.app.Instrumentation.startActivitySync(Instrumentation.java:379)
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.xilconic.achieveitall.test.fragments.goalsoverview.GoalsOverviewFragmentTests.setUp(GoalsOverviewFragmentTests.java:24)
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 android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
My code:
Testing class:
public class GoalsOverviewFragmentTests extends ActivityInstrumentationTestCase2 { private TestingFragmentActivity activity;
public GoalsOverviewFragmentTests(){
super(TestingFragmentActivity.class);
}
@Override
protected void setUp() throws Exception{
super.setUp();
activity = getActivity();
}
// Testing methods here
}
Android Manifest (regular project):
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xilconic.achieveitall"
android:versionCode="1"
android:versionName="0.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.xilconic.achieveitall.GoalTargetsActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.xilconic.achieveitall.util.activities.TestingFragmentActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
Android Manifest (Test project):
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xilconic.achieveitall.test"
android:versionCode="1"
android:versionName="0.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19"/>
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.xilconic.achieveitall" />
<application
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<uses-library android:name="android.test.runner" />
</application>
</manifest>
Solution
Solution: Delete the bin and gen folder, then refreshing the eclipse project.
The problem I was having, was that the contents of my bin and gen folder had gotten out of sync.
Note:
Another symptom that you are having this problem, is that you are having problems or warnings that make not sense.
In my particular case, I was having a strange warning that I fixed on my other machine and comitted it, but then ended up seeing it again on this particular machine even though the problem was no longer to be found in my code.
Answered By - Xilconic
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.