Android Studio 3.5生成Release版APK无桌面启动图标问题求助
Hey Jonathan, I see exactly what's causing your issue here! Let's break it down and fix it quickly.
The Root Cause
Looking at your AndroidManifest.xml, your MainActivity's <intent-filter> includes a <data android:mimeType="text/plain" /> tag. This changes how the system interprets your launcher activity:
- The system launcher sends an implicit Intent with
android.intent.action.MAINandandroid.intent.category.LAUNCHER, but no data attached. - Your intent filter now requires the incoming Intent to have a
text/plainMIME type, so the launcher can't match it. That's why your app shows up in the settings app list but not on the home screen or app drawer. - Debug mode might have worked because Android Studio uses special debug hooks that bypass this strict intent filter matching, but Release mode follows the manifest rules strictly.
The Fix
Simply remove the <data> tag from your MainActivity's intent filter. Here's the corrected manifest section:
<activity android:name=".MainActivity" android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
Steps to Verify
- Clean your project (Build > Clean Project in Android Studio)
- Rebuild and generate a new signed Release APK
- Install the updated APK on your device—you should now see the launcher icon appear on your home screen/app drawer.
If you ever need that text/plain data filter for another use case, you can add a separate intent filter to the same activity instead of combining it with the launcher one. For example:
<activity android:name=".MainActivity" android:screenOrientation="landscape"> <!-- Launcher intent filter --> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <!-- Separate filter for text/plain data --> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain" /> </intent-filter> </activity>
This way, your launcher icon works as expected, and your activity still handles text/plain data intents when needed.
内容的提问来源于stack exchange,提问作者Jonathan Corbett

