我最近安装了android SDK 5.1后,我收到了以前没见过的新错误,例如App没有安装错误。如果用户点击设备中的应用图标,就会出现此错误。你能建议吗?如何解决这个问题这是我的清单代码
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.srikanth"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<!-- Internet permission -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<application
android:name="com.srikanth.utils.AppController"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" >
<activity
android:name="com.srikanth.SplashActivity"
android:label="@string/app_name"
android:exported="true"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/APP_ID" />
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider1234"
android:exported="true" />
<activity android:name="com.srikanth.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.srikanth.EditProfile" >
</activity>
<activity android:name="com.srikanth.UnlockActivity" >
</activity>
<activity android:name="com.srikanth.FacebookFriends" >
</activity>
<activity android:name="com.srikanth.HomeActivity" >
</activity>
<activity android:name="com.srikanth.SplashActivity" >
</activity>
</application>
这是控制台中的错误报告
[2015-04-20 13:01:08 - InstaScene] Starting activity com.instascene.SplashActivity on device EBAZFG148859
[2015-04-20 13:01:09 - InstaScene] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.instascene/.SplashActivity }
[2015-04-20 13:01:09 - InstaScene] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.instascene/.SplashActivity } from null (pid=8344, uid=2000) not exported from uid 10131
[2015-04-20 13:01:09 - InstaScene] ActivityManager: at android.os.Parcel.readException(Parcel.java:1472)
[2015-04-20 13:01:09 - InstaScene] ActivityManager: at android.os.Parcel.readException(Parcel.java:1426)
[2015-04-20 13:01:09 - InstaScene] ActivityManager: at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:2712)
[2015-04-20 13:01:09 - InstaScene] ActivityManager: at com.android.commands.am.Am.runStart(Am.java:680)
[2015-04-20 13:01:09 - InstaScene] ActivityManager: at com.android.commands.am.Am.onRun(Am.java:270)
[2015-04-20 13:01:09 - InstaScene] ActivityManager: at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
[2015-04-20 13:01:09 - InstaScene] ActivityManager: at com.android.commands.am.Am.main(Am.java:76)
[2015-04-20 13:01:09 - InstaScene] ActivityManager: at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
[2015-04-20 13:01:09 - InstaScene] ActivityManager: at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
[2015-04-20 13:01:09 - InstaScene] ActivityManager: at dalvik.system.NativeStart.main(Native Method)
我已经通过stackoverflow检查了这个问题并尝试了解决方案,但这里没有运气是我尝试过的参考链接link1 link2
答案 0 :(得分:2)
您已经注册了SplashActivity
两次。
<activity android:name="com.srikanth.SplashActivity" >
</activity>
<activity
android:name="com.srikanth.SplashActivity"
android:label="@string/app_name"
android:exported="true"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
所以只需删除其中一个并添加android:exported="true"
答案 1 :(得分:1)
检查是否按照 here 的安全说明将 android:exported 设置为 false。如果是,那么您需要将其设置为 true 以使用 USB 调试测试手机上的应用,如下所示:
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>