权限拒绝:启动意图

时间:2013-06-09 13:40:37

标签: android

logcat给了我这个错误:

ActivityManager
Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=zavrsni.android.app/.MainActivity } from ProcessRecord{b5506878 1527:com.android.launcher/u0a10002} (pid=1527, uid=10002) requires android.permission.INTERNET

Launcher
Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=zavrsni.android.app/.MainActivity }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity. tag=ApplicationInfo(title=ZavrsniApp) intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=zavrsni.android.app/.MainActivity }
Launcher
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=zavrsni.android.app/.MainActivity } from ProcessRecord{b5506878 1527:com.android.launcher/u0a10002} (pid=1527, uid=10002) requires android.permission.INTERNET
Launcher
    at com.android.launcher2.Launcher.startActivity(Launcher.java:2061)
Launcher
    at com.android.launcher2.Launcher.startActivitySafely(Launcher.java:2079)
Launcher
    at com.android.launcher2.AppsCustomizePagedView.onClick(AppsCustomizePagedView.java:577)

当我将应用程序从eclipse部署到模拟器时,它可以正常工作。当我关闭应用程序并尝试再次运行时出现问题,然后我收到消息:

App isn't installed

这是我的manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="zavrsni.android.app"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="17" />
    <uses-permission
        android:name="android.permission.INTERNET"/>    

    <application
        android:allowBackup="false"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name="zavrsni.android.app.MainActivity"
            android:permission="android.permission.INTERNET"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service
            android:name="zavrsni.android.app.service.GetAllNewData"
            android:exported="false"/>
    </application>

</manifest>

有人可以查看问题是什么吗?

非常感谢

1 个答案:

答案 0 :(得分:5)

android:permission="android.permission.INTERNET"元素中删除<activity>。这表示主屏幕需要保留INTERNET权限,而不是所有主屏幕都会。