Senin, 28 Februari 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!

0 komentar:

Posting Komentar

ANDROID BOOK © 2008 Template by:
SkinCorner