java.lang.SecurityException:权限拒绝:启动意图 { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26492301/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
提问by Jacob
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.
启动时出错activity
,不幸的是,由于应用程序在genymotion
模拟器上启动,但不在物理设备上,我认为它与项目没有严格关联。
When I run adb devices
with the real one connected i get:
当我adb devices
连接真机运行时,我得到:
List of devices attached
0009215b1eef4f device
AndroidManifest.xml
has not any permissions required set and device has sufficient api version
.
AndroidManifest.xml
没有任何所需的权限设置,设备有足够的api version
.
Regards
问候
回答by Kike Rios
Simply add:
只需添加:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
on AndroidManifest.xmlinto the tag:
在AndroidManifest.xml 中加入标签:
<activity>
Hope it helps
希望能帮助到你
回答by Jacob
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..
问题在于 Android Studio 中的启动器选择。为了提高应用程序模块的测试速度,选择了其他 Activity 作为Launcher
(在运行属性中)而不是 manifest.xml 中指定的。奇怪的是它甚至在模拟器上也能工作..
The solution is simply to change the Launcher to the one set in AndroidManifest.xml
解决方法很简单,只需将 Launcher 更改为AndroidManifest.xml