Can't start application after replacing main activity in Android

Nestor

I renamed my MainActivity class to DataActivity and added a new main activity class with IntelliJ IDEA. I changed the AndroidManifest.xml file to the following:

 <application android:label="@string/app_name" android:icon="@drawable/icon">
        <activity android:name=".DataActivity"
                  android:screenOrientation="portrait">
        </activity>
        <activity android:name=".MainActivity" android:screenOrientation="portrait"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
</application>

I uninstalled the app from my phone and deleted the compiler cache. At install, I get the following exception:

Launching application: com.example.DataTest/com.example.DataTest.DataActivity.

DEVICE SHELL COMMAND: am start -n "com.example.DataTest/com.example.DataTest.DataActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.DataTest/.DataActivity } from null (pid=5882, uid=2000) requires null

What else should I do?

Nestor

This post helped me where to look. In the comments, zeh claims that the SDK holds a refence to the original activity. I checked the launch configuration, and in my IDEA it has been altered from "Launch default activity" to "Launch activity: DataActivity". It works now okay.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

can't start activity in android

From Dev

Android can't start launcher activity programmatically

From Dev

Can't start a new activity with "findViewById" after updating

From Dev

Android can't open the activity_main.xml without an error

From Java

Android Studio can't start after installation

From Dev

Can't boot Android device after replacing system.img

From Dev

Can't able to start new activity from onPostExecute method in Android

From Dev

How to start a new activity from a thread other than the Main thread in an Android Application?

From Dev

Android main activity does not launch on start

From Dev

android - FATAL EXCEPTION: main unable to start Activity

From Dev

android: Activity won't start

From Dev

Android - extend application or run main activity

From Dev

Android - Intent to start an activity outside my application

From Dev

Choose the language of the android application on start of activity

From Dev

Unable to start an Activity from Application class - Android

From Dev

How to start an application from an activity in android?

From Dev

Android start activity after long time on minimize

From Dev

How to Start An Activity after call end in android?

From Dev

Android : Start Activity after button animation

From Dev

how to close main activity after closing another activity in android?

From Dev

How to launch main activity of one application from another application on Android

From Dev

Can't start second activity with "startActivityForResult"

From Dev

Can't start fragment from activity

From Dev

Can't start fragment from activity

From Dev

Can't add any items to activity_main.xml in Android Studio

From Dev

Why can't I drag anything onto 'activity_main.xml' in Android Studio?

From Dev

eclipse android main menu with button to start new activity(ies)

From Dev

Why can't I start an Activity from a page Notification on Android Wear?

From Dev

Android - How can I Attach a WebView to an Activity after creating it with the Application Context

Related Related

  1. 1

    can't start activity in android

  2. 2

    Android can't start launcher activity programmatically

  3. 3

    Can't start a new activity with "findViewById" after updating

  4. 4

    Android can't open the activity_main.xml without an error

  5. 5

    Android Studio can't start after installation

  6. 6

    Can't boot Android device after replacing system.img

  7. 7

    Can't able to start new activity from onPostExecute method in Android

  8. 8

    How to start a new activity from a thread other than the Main thread in an Android Application?

  9. 9

    Android main activity does not launch on start

  10. 10

    android - FATAL EXCEPTION: main unable to start Activity

  11. 11

    android: Activity won't start

  12. 12

    Android - extend application or run main activity

  13. 13

    Android - Intent to start an activity outside my application

  14. 14

    Choose the language of the android application on start of activity

  15. 15

    Unable to start an Activity from Application class - Android

  16. 16

    How to start an application from an activity in android?

  17. 17

    Android start activity after long time on minimize

  18. 18

    How to Start An Activity after call end in android?

  19. 19

    Android : Start Activity after button animation

  20. 20

    how to close main activity after closing another activity in android?

  21. 21

    How to launch main activity of one application from another application on Android

  22. 22

    Can't start second activity with "startActivityForResult"

  23. 23

    Can't start fragment from activity

  24. 24

    Can't start fragment from activity

  25. 25

    Can't add any items to activity_main.xml in Android Studio

  26. 26

    Why can't I drag anything onto 'activity_main.xml' in Android Studio?

  27. 27

    eclipse android main menu with button to start new activity(ies)

  28. 28

    Why can't I start an Activity from a page Notification on Android Wear?

  29. 29

    Android - How can I Attach a WebView to an Activity after creating it with the Application Context

HotTag

Archive