I have tried to test android native apk calculator but every time i am getting
"
test run failed: Permission Denial: starting instrumentation ComponentInfo{com.test.android.calculator2/android.test.InstrumentationTestRunner} from pid=19036, uid=19036 not allowed because package com.test.android.calculator2 does not have a signature matching the target com.android.calculator2"
error message
Here is my code
package com.test.android.calculator2;
import android.app.Activity;
import com.robotium.solo.Solo;
import android.test.ActivityInstrumentationTestCase2;
@SuppressWarnings("unchecked")
public class TestApk extends ActivityInstrumentationTestCase2{
private static final String TARGET_PACKAGE_ID="com.android.calculator2";
private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME="com.android.calculator2.Calculator";
private static Class <?> launcherActivityClass;
static{
try {
Activity act = new Activity();
launcherActivityClass = Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
// @SuppressWarnings("unchecked")
public TestApk()throws ClassNotFoundException {
super(TARGET_PACKAGE_ID,launcherActivityClass);
}
private Solo solo;
@Override
protected void setUp() throws Exception {
solo = new Solo(getInstrumentation());
}
public void testCanOpenSettings(){
solo.getActivityMonitor();
getActivity();
solo.sendKey(Solo.DOWN);
solo.goBack();
}
@Override
public void tearDown() throws Exception {
try {
solo.finalize();
} catch (Throwable e) {
e.printStackTrace();
}
getActivity().finish();
super.tearDown();
}
}
"Android manifest file is like this"
<?xml version="1.0" encoding="utf-8"?>
package="com.test.android.calculator2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="19" />
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.android.calculator2" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<uses-library android:name="android.test.runner" />
</application>
</manifest>
Please help me out every time i am getting this error