Android Studio中App卡在ic_launcher图标,Main Activity无法启动
App卡在启动图标界面,Main Activity无法加载(无报错)
- 物理设备上通过Android Studio启动App时,卡在ic_launcher图标界面,Main Activity始终未能加载
- 未修改代码,且控制台无报错信息
日志信息
2024-09-22 13:28:29.041 14576-14576 AppCompatDelegate com...dev91.hotornot_getyourratings D Checking for metadata for AppLocalesMetadataHolderService : Service not found 2024-09-22 13:28:29.192 14576-14576 DecorView com...dev91.hotornot_getyourratings I setWindowBackground: isPopOver=false color=ff141218 d=android.graphics.drawable.ColorDrawable@d87aefd ...
启动截图

AndroidManifest文件
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <application android:allowBackup="true" android:hardwareAccelerated="false" android:largeHeap="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/<ThemeName>" tools:targetApi="31"> <activity android:name=".MainActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
排查建议
- 检查主题配置:确认Manifest中
android:theme="@style/<ThemeName>"的<ThemeName>是否为实际存在的主题名称,避免拼写错误或主题资源缺失 - 清理重建项目:执行
Build > Clean Project,再Build > Rebuild Project,同时清除设备上的App缓存和数据 - 查看完整错误日志:切换Logcat的日志级别为Error,或者导出完整启动日志,可能存在被截断的异常信息
- 调整硬件加速设置:尝试将
android:hardwareAccelerated="false"改为true,部分设备禁用硬件加速可能导致启动卡顿 - 检查MainActivity初始化逻辑:排查
onCreate方法中是否有耗时同步操作、死循环或未捕获的异常
内容的提问来源于stack exchange,提问作者Indie Dev
相关产品推荐
相关产品推荐

