I am trying to execute a system command to open a terminal(using am instruction) from eclipse.
The below is my c++ code from eclipse (used through JNI):
JNIEXPORT jstring JNICALL Java_com_example_vulnapp_NewActivity_stringFromJNICPP(JNIEnv * env, jobject obj)
{
LOGI("sys cmd:%x", system);
system("am start -a android.intent.action.MAIN -c android.intent.category.TEST -n com.android.term/.Term");
LOGI("After command executed");
return env->NewStringUTF("Hello From CPP");
}
The below is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.vulnapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="23" />
<uses-permission android:name = "android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.SMS" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<activity
android:name=".MainActivity"
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=".NewActivity" >
</activity>
</application>
</manifest>
When I try to run the application in the emulator I get the following error: Error from logcat I will be very grateful if someone could help me with this. I am really stuck up with this for a long time.