java.lang.SecurityException: Permission Denial: starting Intent {} from null not exported from uid

今天使用Intellij IDEA(与Android Studio相同)开发时出现了这样一个问题

原本创建项目时默认的启动Activity是MainActivity,后来为了测试新建了一个Activity,

然后把这个Activity设为了项目启动的Acitvity,结果项目启动时报错


Launching application: Ray.AnimationProject/Ray.AnimationProject.MainActivity.
DEVICE SHELL COMMAND: am start -n "Ray.AnimationProject/Ray.AnimationProject.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=Ray.AnimationProject/.MainActivity }
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=Ray.AnimationProject/.MainActivity } from null (pid=7282, uid=2000) not exported from uid 10238
at android.os.Parcel.readException(Parcel.java:1428)
at android.os.Parcel.readException(Parcel.java:1382)
at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:1941)
at com.android.commands.am.Am.runStart(Am.java:503)
at com.android.commands.am.Am.run(Am.java:110)
at com.android.commands.am.Am.main(Am.java:83)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
at dalvik.system.NativeStart.main(Native Method)


看了看提示,貌似启动的还是原本的MainActivity,但是搜索全文也没找到这个类设为启动项


搜索了一下,有些可能因为在AndroidManifest.xml中配置同名Activity的也出现此种错误,但是并不与我相同


终于最后发现在IDEA和AndroidStudio这种编译器中,如果创建新项目时,

默认配置是指定创建时的Acitvity作为启动Acitvity,是在编译环境中配置的

java.lang.SecurityException: Permission Denial: starting Intent {} from null not exported from uid_第1张图片




所以把这项配置改为Launch default Activity即可,即从程序配置的默认中启动即可



问题不大,影响不小,希望我的文章能够帮助更多的人!


你可能感兴趣的:(Android)