Android Onslaught: Permission Denial / Not Exported / Debug Info Unavailable (bug)
When starting a debug session for a newly-created LoginActivity project in Android Studio (AS) 0.8.11, on OSX Mavericks, the default activity is not created. AS detects this and presents a dialog (but only once) where you may select LoginActivity as the activity to launch, which then doesn't create the Intent.
Launch fails with a vague hint (is it security, related to the null, something exported or a conflict with the debugger?): Waiting for device. Target device: (hardware name) Uploading file local path: (apk) remote path: (/data/local/tmp/appname) Launching application: ... java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN } cat=[android.intent.category.LAUNCHER] ... from null ... not exported from uid ... at android.os.Parcel.readException(Parcel.java:...) ... Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse Restart ADB integration and try again Waiting for process: (app name) It waits forever and the app doesn't launch. To resolve, edit your new application's manifest.xml and add (to the application's activity tag; the one with android:name="...LoginActivity"): <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
A vast multitude of posts about this issue in various forms exist on StackOverflow (example). The lesson in all of them is: the build system has to launch something (once you stub your toes on this a few times, you wonder why the project generator misses it, so it's a bug). The other reported issues, including the recommendation to restart ADB, are superfluous.
* These posts are intended to document various Android issues (and hopefully solutions), ranging from Android Studio to the build system. Often it's a toss-up whether the author did something wrong or it's the tools; sometimes the author's understanding will be wrong. Also, by the time you read this, the issues may no longer exist in the same form, or at all.









