Android Run Config does not see MAIN action in intent-filter

I am working on an Android application rewrite where we had to use an activity-alias to maintain the original codename. The problem is that when me added the activity alias it caused the IntelliJ run configuration to complain with an error, saying "The intent-filter of the activity must contain android.intent.action.MAIN action". The error is harmless, though annoying, in that run configuration will work on my device or emulator irregardless but I am constantly prompted wether I wish to continue anyway when launching. Here's an example of a manifest from an example project that illustrates the problem:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"           package="com.craig.example.Drawing"           android:versionCode="1"           android:versionName="1.0">     <uses-sdk android:minSdkVersion="10"/>     <application         android:label="@string/app_name"         android:icon="@drawable/ic_launcher">         <activity             android:name=".MainActivity"             android:exported="true"             android:label="@string/app_name">         </activity>         <activity-alias                        android:name="com.craig.example.Main"                        android:targetActivity=".MainActivity">                     <intent-filter>                         <action android:name="android.intent.action.MAIN" />                         <category android:name="android.intent.category.LAUNCHER" />                     </intent-filter>                   </activity-alias>     </application> </manifest>


In this manifest I alias the ".MainActivity" with a name "com.craig.example.Main". See the attached screenshot which illustrates the run configuration and the error I see.screenshot.tiff

Is there a work-around or a way I can mitigate the constant prompting for error correction when launching my app?

4 comments

I should add that Idea is likely parsing the activity element from the manifest and not seeing the intent-filter definition as it is included under the alias instead. Is this a known bug or issue?

0

Are there any workarounds to this issue? Should I file a bug?

0

Sorry about the delay. I've answered you in the issue you submitted: http://youtrack.jetbrains.com/issue/IDEA-113328

0

Thanks Eugene. I've upoaded my example project ot the issue. You say the issue is resolved in an upcoming EAP release of Idea 13? I've downloaded/installed the EAP about a week ago or so. Though I haven't been using it much I'll keep my eye open for udpdates. I've been focusing more on getting my arms around Android Studio. Maybe this isn't the best place to ask but how far apart are the two? Thanks again for your reply and for your help!

0

Please sign in to leave a comment.