Monday, February 28, 2011

Tip: Installed Application Not Installed Error

Have you ever loaded up an application, ready to debug, but then seen a message along the lines of, "Application Not Installed" display? This usually has an accompanying LogCat error:
ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent
The cause and solution are very simple:
  • This error is most likely caused by a duplicate Activity class entry in the manifest file. 
 <activity  
   android:name=".MainActivity"  
   android:label="@string/app_name">  
   <intent-filter>  
     <action  
       android:name="android.intent.action.MAIN" />  
     <category  
       android:name="android.intent.category.LAUNCHER" />  
   </intent-filter>  
 </activity>  
 <!-- lots of stuff -->  
 <activity  
   android:name="MainActivity"></activity>  
The solution should be clear by now:
  • Remove the duplicate tag from the AndroidManifest.xml file 
  • Build the application again
  • Reload the application
This is quite the opposite of forgetting to add an Activity class to the manifest file. And, yet, it leads to a failure just the same. Proper maintenance of the manifest file is important. It's not a file to mess around with.

Happy Android Coding!

7 comments:

Leoriver42 said...

how can I open the window where I can edit the coding?

Shane Conder said...

Hi Leoriver42,

To be honest, I'm not at all sure what you're asking. Can you elaborate further?

Thanks!

Leoriver42 said...

hi!
In the post there is a kind of example box with some coding right? Where I am supposed to work in (edit it?)
How do I open that window and how do i
remove duplicate tag and build application again? I don't see any duplicate in there :-/

sorry for the bother, I just got my android and unfortunately I suck at these things
Thanx :P

Shane Conder said...

The example box shows a piece of the AndroidManifest.xml file with a duplicate activity setting. You'd edit this in whatever editor you used to create it for your application (most likely Eclipse).

Just to clarify... this is a tip for developers, not users. :)

Leoriver42 said...

ah ok... i'm a user xD
Thanks though :P

eZee.se said...

Hi again,
I am almost done with Sam's, I'm thinking of getting Wireless next...

A few quick questions:
Is Wireless good enough to learn some simple animation and "click change animation"? (Basically, I want a small 24px x 24px image to "drop down" from the top till around 25% of the screen, if the user clicks a button the image should be switched to another animation file so that the graphic can be seen to "explode")

I guess I will also need to brush up on threads and how to use them in Android.

Would you recommend Wireless for the above or some ohter book?

Thanks!

eZee.se said...

Hi again,
I am almost done with Sam's, I'm thinking of getting Wireless next...

A few quick questions:
Is Wireless good enough to learn some simple animation and "click change animation"? (Basically, I want a small 24px x 24px image to "drop down" from the top till around 25% of the screen, if the user clicks a button the image should be switched to another animation file so that the graphic can be seen to "explode")

I guess I will also need to brush up on threads and how to use them in Android.

Would you recommend Wireless for the above or some ohter book?

Thanks!