Showing posts with label errors. Show all posts
Showing posts with label errors. Show all posts

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!

Thursday, February 3, 2011

Tip: New Layout Editor Exceptions

Does your Android Eclipse layout editor look like Figure 1? Does it show "Missing theme." or perhaps an error in the logs (perhaps something to do with "com.android.ide.eclipse.editors.layout.LayoutEditor")? These are frequent occurrences on the very latest Android SDK Tools.
Figure 1
Layout Editor errors
 (Click for large view)
If you're having these types of issues, the solution may be simple. See that empty dropdown on the far right? Perhaps it's not empty, but shows the Android version? Yeah, the one highlighted in Figure 2 shown below... Click on this dropdown and pick one of the options.
Figure 2
Layout Editor Drop Down
(Click for large view)
Does your layout editor now look like Figure 3? If so, you're all set. If not, you'll need more than just this tip.
Figure 3
Layout Editor, no errors
(Click for large view)
Why the new dropdown? We believe that it will show what a layout should look like on various versions of Android platform. So, presumably, you'll want to pick your Target SDK most of the time and if, during testing, you find a problem outside the target SDK, this drop down may help speed up layout debugging.

Happy Android Coding!