java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
Asked Answered
D

4

8

There is an error launching activity, unfortunately I assume it is not connected strictly with the project due to the fact the app launches on genymotion emulator, but does not on physical device.

When I run adb devices with the real one connected i get:

List of devices attached 
0009215b1eef4f  device

AndroidManifest.xml has not any permissions required set and device has sufficient api version.

Regards

Daniels answered 21/10, 2014 at 17:6 Comment(1)
This can also happen if you have added android:exported="false" in ManifestMosra
D
8

The issue was with Launcher selection in Android Studio. To improve testing speed of application module there was selected other Activity as Launcher(in run properties) than specified in manifest.xml. Strange that it worked even on emulator..

The solution is simply to change the Launcher to the one set in AndroidManifest.xml

Daniels answered 21/10, 2014 at 17:12 Comment(1)
Correct, running specified activity won't help if we want to test particular activity for no. of times ... instead using your solution and running app helps better :) thanks for hint!Stroll
P
10

Simply add:

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

on AndroidManifest.xml into the tag:

<activity>

Hope it helps

Protuberant answered 21/4, 2015 at 20:41 Comment(1)
Correct, running specified activity won't help if we want to test particular activity for no. of times ... instead using your solution and running app helps better :) thanks for hint!Stroll
D
8

The issue was with Launcher selection in Android Studio. To improve testing speed of application module there was selected other Activity as Launcher(in run properties) than specified in manifest.xml. Strange that it worked even on emulator..

The solution is simply to change the Launcher to the one set in AndroidManifest.xml

Daniels answered 21/10, 2014 at 17:12 Comment(1)
Correct, running specified activity won't help if we want to test particular activity for no. of times ... instead using your solution and running app helps better :) thanks for hint!Stroll
D
5

As @Tushar Gogna said in the comment.

"This can also happen if you have added android:exported="false" in Manifest"

Adding this as the answer, since it worked for me.

Doable answered 26/12, 2022 at 3:22 Comment(0)
N
0

For me the issue was with emulator. I added my company gmail to the emulator for testing and it forced me to setup pin. When I tried running the app the next day, I started getting this error.

Deleting the old and creating a new emulator was the solution that worked for me.

Noria answered 31/8, 2024 at 8:14 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.