Android: resolved error when launch activity changes

I have an android application that I am trying to run and it gives me an 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

I get this error when I try to change the launch activity in the manifest. Also, I do not get this error when I run it on the emulator, but when I try to run it on the device. I tried this 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"/>

Initially, the activity of Launcher was active under the name Main. Then I created a new action called MainActivity and made a launcher class.

+3
source share
4 answers

As stated by Jomia :

java.lang.SecurityException , , . .

, , MainActivity Project- > Clean...

+7

MainActivity AndroidManifest.xml . :

<activity android:exported="true" android:name=".MainActivity" android:screenOrientation="portrait" android:label="MainActivity">
+4

, null SecurityException , . , . , <intent-filter>.

+1

If you use GIT:
Delete the entire repository folder and re-sync with your git server.

0
source

All Articles