The app works on my Genymotion emulator but fails when running on the real device with this exception on startup:
Launching application: <package>/<package>.MainActivity.
DEVICE SHELL COMMAND: am start -D -n "<package>/<package>.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=<package>/.MainActivity }
java.lang.SecurityException: Permission Denial: starting Intent { act=<package>.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=<package>/.MainActivity } from null (pid=21943, uid=2000) not exported from uid 10204
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:2204)
at com.android.commands.am.Am.runStart(Am.java:494)
at com.android.commands.am.Am.run(Am.java:109)
at com.android.commands.am.Am.main(Am.java:82)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
at dalvik.system.NativeStart.main(Native Method)
Waiting for process: <package>
Here's my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="<package>"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="<package>.MainActivity"
android:label="#string/app_name" >
</activity>
</application>
</manifest>
And MainActivity.java:
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
What's going on? Why would it be trying to run as a particular user when I'm just using a normal configuration?
Change below in you menifest.xml file
<activity
android:name="<package>.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>
You should define your activity something like this in manifest
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#android:style/AppTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Related
I am creating an app with read_sms permission.it worked perfectly fine with emulator but when deployed on Samsung galaxy s5 with android 4.4.2 causing error.the app does not even start when tapped.it displays app isn't installed.
ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.project.searchandroid/.MainActivity } from null (pid=24876, uid=2000) requires android.permission.READ_SMS
ActivityManager: at android.os.Parcel.readException(Parcel.java:1465)
ActivityManager: at android.os.Parcel.readException(Parcel.java:1419)
ActivityManager: at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:2367)
ActivityManager: at com.android.commands.am.Am.runStart(Am.java:680)
[2015-03-24 19:07:47 - SearchAndroid] ActivityManager: at com.android.commands.am.Am.onRun(Am.java:270)
ActivityManager: at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
[2015-03-24 19:07:47 - SearchAndroid] ActivityManager: at com.android.commands.am.Am.main(Am.java:76)
ActivityManager: at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
ActivityManager: at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:301)
ActivityManager: at dalvik.system.NativeStart.main(Native Method)
Please help me. i have project to complete. Thnx.
here is my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.project.searchandroid"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.READ_SMS"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<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=".PreferenceActivity"
android:label="#string/app_name"/>
<activity
android:name=".FilterActivity"
android:label="#string/app_name"/>
<activity
android:name=".AboutActivity"
android:label="#string/app_name"
android:parentActivityName="com.project.searchandroid.MainActivity">
</activity>
</application>
</manifest>
I am making an android app. the first launcher activity code is :
package com.example.test;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
public class FirstPage extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sp = getSharedPreferences("STATE",0);
String x = sp.getString("typeOfUser","");
if(x==""){
setContentView(R.layout.activity_first_page);
Intent intent = new Intent(this,LoginOrRegister.class);
startActivity(intent);
}
else {
setContentView(R.layout.lat_lon);
}
}
}
Manifest file is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:maxSdkVersion="19" android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.test.FirstPage"
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=".LoginOrRegister" />
<activity android:name="Registration"></activity>
<activity android:name="SignIn"></activity>
</application>
</manifest>
But when running this app. there is error: :
No command output when running: 'am start -n com.example.test/com.example.test.FirstPage -a android.intent.action.MAIN -c android.intent.category.LAUNCHER' on device emulator-5554
this is my stack trace:
com.android.ddmlib.ShellCommandUnresponsiveException
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:430)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:347)
at com.android.ddmlib.Device.executeShellCommand(Device.java:584)
at com.android.ide.eclipse.adt.internal.launch.ActivityLaunchAction.doLaunchAction(ActivityLaunchAction.java:67)
at com.android.ide.eclipse.adt.internal.launch.ActivityLaunchAction.doLaunchAction(ActivityLaunchAction.java:109)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.doLaunchAction(AndroidLaunchController.java:1293)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.doLaunchAction(AndroidLaunchController.java:1305)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.launchApp(AndroidLaunchController.java:1277)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.simpleLaunch(AndroidLaunchController.java:913)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.continueLaunch(AndroidLaunchController.java:755)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.launch(AndroidLaunchController.java:575)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.doLaunch(LaunchConfigDelegate.java:330)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:246)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Could be a duplicate of one of these questions, which have to do with the same ShellCommandUnresponsiveException exception shown in the stack trace:
Android CTS is showing ShellCommandUnresponsiveException on emulator
Android App Won't Display in Emulator
This is the error that shows on my logcat when i run my TagViewer.java for NFC on Eclipse. I am running a NFC program and basically it runs however at a certain period of time the program shuts down on its own.
08-29 14:06:33.677: E/ViewTag(22056): Unknown intent Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.android.nfc/.TagViewer }
This is from my Android Manifest. I am guessing that the error is from here because of the line on the error android.intent.action.MAIN and such.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.nfc"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-feature android:name="android.hardware.nfc" android:required="true"/>
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="16" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".TagViewer"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</intent-filter>
</activity>
</application>
</manifest>
this is from my java and basically the last line, when i put // the program will not shut down but it will show like a white page.However the title NFC is still showing so i know that it is slightly working
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTagContent = (LinearLayout) findViewById(R.id.tag_viewer);
mTitle = (TextView) findViewById(R.id.title);
resolveIntent(getIntent());
}
Change your Declaration activity "TagViewer" instead of ".TagViewer"
I am getting the following error:
ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.optionpricing/.optionListNew } from null (pid=1160, uid=2000) requires null
I am new to programming in Android and I could not make sense of the other postings related to my problem. I wonder if there is an issue with the optionListNew class? Can someone lend a hand so I can move on to completing my app. Also, the app runs in my virtual device, and I only get this error when I try to test it on my actual phone.
Any ideas are appreciated. Below is the manifest file.
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="1" android:versionName="1.0"
package="com.optionpricing" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="8"/>
<application android:icon="#drawable/icon"
android:label="#string/app_name"
android:debuggable="true">
<activity android:name=".optionListNew">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".OptionPricing"/>
<activity android:name=".optionListNew"/>
<activity android:name=".futureOptionActivity"/>
<activity android:name=".currencyOptionActivity"/>
<activity android:name=".gapOptionActivity"/>
<activity android:name=".gapOptionList01"/>
<activity android:name=".barrierSingleUpInActivity"/>
<activity android:name=".testActivity"/>
<activity android:name=".barrierlistview"/>
<activity android:name=".barrierSingleDownInActivity"/>
</application>
</manifest>
You added "optionListNew" activity twice in the manifest file.. remove below activity by deleting this line
<activity android:name=".optionListNew"/>
Your Manifest.xml code will become
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="1" android:versionName="1.0"
package="com.optionpricing" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="8"/>
<application android:icon="#drawable/icon"
android:label="#string/app_name"
android:debuggable="true">
<activity android:name=".optionListNew">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".OptionPricing"/>
<activity android:name=".futureOptionActivity"/>
<activity android:name=".currencyOptionActivity"/>
<activity android:name=".gapOptionActivity"/>
<activity android:name=".gapOptionList01"/>
<activity android:name=".barrierSingleUpInActivity"/>
<activity android:name=".testActivity"/>
<activity android:name=".barrierlistview"/>
<activity android:name=".barrierSingleDownInActivity"/>
</application>
</manifest>
optionListNew is present twice in the manifest. Remove the second.
i want to change my launching activity.for the moment my manifest is this:
<application android:icon="#drawable/iconbj" android:label="#string/app_name"
android:debuggable="true">
<activity android:name=".Main" android:label="#string/app_name" android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="DemoPlayActivity" android:name="DemoPlayActivity" android:screenOrientation="landscape"></activity>
</application>
now I have created another activity which is a splash screen and i want to launch this instead of Main so I tried this way:
<application android:icon="#drawable/iconbj" android:label="#string/app_name"
android:debuggable="true">
<activity android:name=".Splash" android:label="#string/app_name"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="Main" android:label="Main"
android:screenOrientation="landscape">
</activity>
<activity android:label="DemoPlayActivity" android:name="DemoPlayActivity"
android:screenOrientation="landscape"></activity>
</application>
but i get thisproblem with permission:
[2011-03-31 16:32:44 - BlackJackNuovo]
ActivityManager:
java.lang.SecurityException:
Permission Denial: starting Intent {
act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER]
flg=0x10000000
cmp=com.phinet.android.blackjack/.Main
} from null (pid=-1, uid=-1) requires
null.
please help me :)
Update
NO WAY. I did this way:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.phinet.android.blackjack" android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<application android:icon="#drawable/iconbj" android:label="#string/app_name"
android:debuggable="true">
<activity android:name="com.phinet.android.blackjack.Splash" android:label="Splash"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.phinet.android.blackjack.Main" android:label="Main"
android:screenOrientation="landscape">
</activity>
<activity android:label="com.phinet.android.blackjack.DemoPlayActivity" android:name="DemoPlayActivity"
android:screenOrientation="landscape"></activity>
</application>
</manifest>
but it seems to lunch always the Main activity,this is the concole log:
[2011-04-01 10:57:10 - BlackJackNuovo] Uploading BlackJackNuovo.apk onto device '9000d365e767'
[2011-04-01 10:57:16 - BlackJackNuovo] Installing BlackJackNuovo.apk...
[2011-04-01 10:57:32 - BlackJackNuovo] Success!
[2011-04-01 10:57:32 - BlackJackNuovo] Starting activity com.phinet.android.blackjack.Main on device 9000d365e767
[2011-04-01 10:57:32 - BlackJackNuovo] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.phinet.android.blackjack/.Main }
[2011-04-01 10:57:35 - BlackJackNuovo] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.phinet.android.blackjack/.Main } from null (pid=-1, uid=-1) requires null
WHY?
<activity android:name="Main" android:label="Main"
android:screenOrientation="landscape">
</activity>
<activity android:label="DemoPlayActivity" android:name="DemoPlayActivity"
android:screenOrientation="landscape"></activity>
Should still have the leading .
<activity android:name=".Main" android:label="Main" android:screenOrientation="landscape">
</activity>
<activity android:label=".DemoPlayActivity" android:name="DemoPlayActivity"android:screenOrientation="landscape">
</activity>
This is stating it has a relative path to your Classes. You could make absolute references if you wished, i.e. "com.your.app.Main"