3

I have an android app that I am trying to launch and it gives me the error

java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.hoosierag/.MainActivity } from null (pid=32395, uid=2000) not exported from uid 10125

I get this error when I try to change the launcher activity in the manifest. Also I dont get this error when I launch it on the emulator, but when I try to launch it on a device. I have tried it on 3 different android devices and it gave the same error all three times. Here is my manifest code :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.hoosierag"
      android:versionName="1.11" android:versionCode="4">
        <uses-sdk android:minSdkVersion="3"/>
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
        <uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
        <uses-permission android:name="android.permission.DISABLE_KEYGUARD"></uses-permission>
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>


    <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
        <activity android:name=".MainActivity" android:screenOrientation="portrait"
                  android:label="MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="Main" android:screenOrientation="portrait"/>
        <activity android:name="News" android:screenOrientation="portrait"/>
        <activity android:name="Audio" android:screenOrientation="portrait"/>

Initially the Launcher Activity was the activity called Main. I then created a new activity called MainActivity and made that the launcher class.

Vipul
  • 27,808
  • 7
  • 60
  • 75
RagHaven
  • 4,156
  • 21
  • 72
  • 113
  • Is there any line in your log cat around the permission denial that states which line in your Activity is the problem? Or which permission caused the exception? Usually those things are listed in the log near the excerpt that you pasted. – FoamyGuy Jun 15 '12 at 18:31
  • i think you have shared only part of manifest? share whole manifest code – Vipul Jun 15 '12 at 18:34
  • can you provide the first line of MainActivity which ill be like "package .............;" ...... – Dheeresh Singh Jun 15 '12 at 18:49
  • Your manifest is missing the `android:exported="true"` directive within your `activity` tags. Note: Whenever you specified `intent-filter` directive, you must also consider `android:exported` directive. – ChuongPham Mar 29 '14 at 05:39

4 Answers4

8

As stated by Jomia:

The java.lang.SecurityException you are seeing is because you may enter two entries pointing to same activity. Remove the second one and you should be good to go.

and finally after changing Main activity to MainActivity in manifest Clean your Project from Project->Clean... before running on device

Community
  • 1
  • 1
ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
5

You should try to mark MainActivity in your AndroidManifest.xml with attribute exported. Like this:

<activity android:exported="true" android:name=".MainActivity" android:screenOrientation="portrait" android:label="MainActivity">
hRT
  • 61
  • 1
  • 1
1

Frequently, requires null in a SecurityException means that the component is not exported. There is a possibility that may not be a your problem. Activity is automatically exported when it has an <intent-filter> tag. I recommend

  • clean the project
  • build
  • full uninstall app from device
  • re-install
Hein
  • 2,675
  • 22
  • 32
0

If you are using GIT:
Delete the whole repository folder and resync it with your git-server.

Tomblarom
  • 1,429
  • 1
  • 15
  • 38