automating native calculator app using robotium

46 views
Skip to first unread message

Sudhakar Gera

unread,
Sep 28, 2015, 10:14:45 AM9/28/15
to Robotium Developers

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"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 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

naveed

unread,
Sep 29, 2015, 5:59:53 AM9/29/15
to Robotium Developers
Hi, 

You got to sign your calculator(native android calculator) to get it running.


Naveed

syed tariful

unread,
Sep 29, 2015, 10:02:28 AM9/29/15
to robotium-...@googlegroups.com

Hi Sudhakar,
This error is coming because your apk is not resigned. First you resigned the calculator apk. Then it will work.

--
You received this message because you are subscribed to the Google Groups "Robotium Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotium-develo...@googlegroups.com.
To post to this group, send email to robotium-...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotium-developers.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages