安卓:权限拒绝错误时,改变发射活动 [英] Android : Permission Denied Error when changing Launcher Activity

查看:127
本文介绍了安卓:权限拒绝错误时,改变发射活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序,我尝试推出,它给我的错误

I have an android app that I am trying to launch and it gives me the error

java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.hoosierag/.MainActivity } from null (pid=32395, uid=2000) not exported from uid 10125

我,当我试图改变发射活动清单中出现此错误。此外,我不要当我启动它在模拟器上得到这个错误,但是当我尝试推出它的设备上。我已经尝试过了3种不同的Andr​​oid设备,它给了同样的错误全部三次。这里是我的清单code:

I get this error when I try to change the launcher activity in the manifest. Also I dont get this error when I launch it on the emulator, but when I try to launch it on a device. I have tried it on 3 different android devices and it gave the same error all three times. Here is my manifest code :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.hoosierag"
      android:versionName="1.11" android:versionCode="4">
        <uses-sdk android:minSdkVersion="3"/>
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
        <uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
        <uses-permission android:name="android.permission.DISABLE_KEYGUARD"></uses-permission>
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>


    <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
        <activity android:name=".MainActivity" android:screenOrientation="portrait"
                  android:label="MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="Main" android:screenOrientation="portrait"/>
        <activity android:name="News" android:screenOrientation="portrait"/>
        <activity android:name="Audio" android:screenOrientation="portrait"/>

最初启动的活动被称为主要活动。然后,我创建了一个名为MainActivity新的活动和取得的发射器类。

Initially the Launcher Activity was the activity called Main. I then created a new activity called MainActivity and made that the launcher class.

推荐答案

由于由Jomia 说:

java.lang.SecurityException异常您看到的是,因为你可能   输入两个条目指向同一个活动。删除第二个和   你应该是好去。

The java.lang.SecurityException you are seeing is because you may enter two entries pointing to same activity. Remove the second one and you should be good to go.

终于从不断变化的主要活动MainActivity清单中清理项目后的项目 - >清除... 在设备上运行之前

and finally after changing Main activity to MainActivity in manifest Clean your Project from Project->Clean... before running on device

这篇关于安卓:权限拒绝错误时,改变发射活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆