我有和Android应用程序,点击它的图标后显示> = 5秒。
单击图标后,我会在状态栏中看到带有应用程序名称的黑屏。 5秒钟后,出现主屏幕。
我在SO上提到了this post,我从堆栈跟踪中得到了以下结果
16:13:14.915: I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=packageName/.SelectType }
16:13:14.954: I/SurfaceFlinger(59):
16:13:14.954: I/SurfaceFlinger(59): SurfaceFlinger::createSurface() : layer->mIdentity=176, LayerName= Starting packageName
16:13:14.954: I/SurfaceFlinger(59): SurfaceFlinger::createSurface() : layer->clientIndex=2, surfaceHandle->mToken=0x2
16:13:16.026: D/AnrParser(184): Waiting kernel log . . .
16:13:16.614: D/dalvikvm(6890): GC_FOR_MALLOC freed 12274 objects / 785016 bytes in 135ms
16:13:17.784: D/dalvikvm(133): GC_EXTERNAL_ALLOC freed 415 objects / 21624 bytes in 1285ms
16:13:17.914: D/dalvikvm(6890): GC_FOR_MALLOC freed 5762 objects / 339024 bytes in 90ms
16:13:18.174: D/AnrParser(184): Waiting kernel log . . .
16:13:18.344: E/keystore(6966): chdir: /data/misc/keystore: Permission denied
16:13:19.693: D/dalvikvm(6890): GC_FOR_MALLOC freed 5994 objects / 372624 bytes in 93ms
16:13:20.173: D/AnrParser(184): Waiting kernel log . . .
16:13:22.173: D/AnrParser(184): Waiting kernel log . . .
16:13:22.743: I/SurfaceFlinger(59):
16:13:22.743: I/SurfaceFlinger(59): SurfaceFlinger::createSurface() : layer->mIdentity=177, LayerName= packageName/packageName.SelectType
16:13:22.743: I/SurfaceFlinger(59): SurfaceFlinger::createSurface() : layer->clientIndex=0, surfaceHandle->mToken=0x0
16:13:22.983: D/dalvikvm(6890): GC_FOR_MALLOC freed 21467 objects / 1097728 bytes in 119ms
16:13:23.403: E/keystore(6973): chdir: /data/misc/keystore: Permission denied
16:13:24.173: D/AnrParser(184): Waiting kernel log . . .
16:13:24.923: W/ActivityManager(59): Launch timeout has expired, giving up wake lock!
16:13:25.264: W/ActivityManager(59): Activity idle timeout for HistoryRecord{47f56388 packageName/.SelectType}
16:13:25.403: I/ActivityManager(59): Displayed activity packageName/.SelectType: 10206 ms (total 10206 ms)
正如您在上面的日志中看到的那样,第一个语句是16:13:14.915: I/ActivityManager(59): Starting activity
,最后一个语句是16:13:25.403: I/ActivityManager(59): Displayed activity
。
所以差距很大。 10到11秒。
任何帮助表示感谢。
答案 0 :(得分:2)
您可能正在执行活动的onCreate()或onResume()上的某些事情...尝试调试它以查看您是否直接在这些方法中执行数据库或I / O操作。您还可以激活StrictMode,以便更好地了解减慢应用的速度。