没有找到解决方案,先将问题抛出来。
#Android,Galaxy Nexus,4.0.3,网络:wifi,版本:1.8.3 for google play(v8)#
06-08 10:29:59.418: DEBUG/dalvikvm(15871): GC_CONCURRENT freed 2676K, 44% free 19681K/34631K, paused 11ms+6ms
06-08 10:29:59.418: ERROR/Launcher(15871):
Unable to launch. tag=ShortcutInfo(title=金蝶微博) intent=Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.kdweibo.google/.activities.ACT_Start bnds=[40,185][200,385] }
06-08 10:29:59.418: ERROR/Launcher(15871):
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.kdweibo.google/.activities.ACT_Start}; have you declared this activity in your AndroidManifest.xml?
06-08 10:29:59.418: ERROR/Launcher(15871): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
06-08 10:29:59.418: ERROR/Launcher(15871): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
06-08 10:29:59.418: ERROR/Launcher(15871): at android.app.Activity.startActivityForResult(Activity.java:3190)
06-08 10:29:59.418: ERROR/Launcher(15871): at com.android.launcher2.Launcher.startActivityForResult(Launcher.java:1297)
06-08 10:29:59.418: ERROR/Launcher(15871): at android.app.Activity.startActivity(Activity.java:3297)
06-08 10:29:59.418: ERROR/Launcher(15871): at com.android.launcher2.Launcher.startActivitySafely(Launcher.java:1772)
06-08 10:29:59.418: ERROR/Launcher(15871): at com.android.launcher2.Launcher.onClick(Launcher.java:1672)
06-08 10:29:59.418: ERROR/Launcher(15871): at android.view.View.performClick(View.java:3511)
06-08 10:29:59.418: ERROR/Launcher(15871): at android.view.View$PerformClick.run(View.java:14105)
06-08 10:29:59.418: ERROR/Launcher(15871): at android.os.Handler.handleCallback(Handler.java:605)
06-08 10:29:59.418: ERROR/Launcher(15871): at android.os.Handler.dispatchMessage(Handler.java:92)
06-08 10:29:59.418: ERROR/Launcher(15871): at android.os.Looper.loop(Looper.java:137)
06-08 10:29:59.418: ERROR/Launcher(15871): at android.app.ActivityThread.main(ActivityThread.java:4424)
06-08 10:29:59.418: ERROR/Launcher(15871): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 10:29:59.418: ERROR/Launcher(15871): at java.lang.reflect.Method.invoke(Method.java:511)
06-08 10:29:59.418: ERROR/Launcher(15871): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-08 10:29:59.418: ERROR/Launcher(15871): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-08 10:29:59.418: ERROR/Launcher(15871): at dalvik.system.NativeStart.main(Native Method)
#Android,U8860,2.3.6,网络:wifi,版本:1.8.4_beta3_0531(v8)#
U8860
从程序自动创建的桌面快捷方式进入,报 [没有找到Activity],log如下:
06-08 14:26:53.278: INFO/ActivityManager(202): Starting: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.kdweibo/.activities.ACT_Start bnds=[5,249][115,367] } from pid 298
---
而从手工创建的快捷方式进入,正常,log如下:
06-08 14:27:15.970: INFO/ActivityManager(202): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.kdweibo/.activities.ACT_Start bnds=[245,607][355,725] } from pid 298
06-08 14:27:16.010: INFO/ActivityManager(202): Start proc com.kdweibo for activity com.kdweibo/.activities.ACT_Start: pid=22876 uid=10072 gids={3003, 1015, 1007}
HTC HD G10(正常)
从程序自动创建的桌面快捷方式进入(OK)
06-08 14:26:50.628: INFO/ActivityManager(1284): Starting: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.kdweibo/.activities.ACT_Start bnds=[5,392][115,510] } from pid 1396
06-08 14:26:50.668: INFO/ActivityManager(1284): Start proc com.kdweibo for activity com.kdweibo/.activities.ACT_Start: pid=17227 uid=10159 gids={3003, 1015, 1007}
从手工创建的快捷方式进入(OK)
06-08 14:27:57.588: INFO/ActivityManager(1284): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.kdweibo/.activities.ACT_Start bnds=[5,553][115,671] } from pid 1396
06-08 14:27:57.668: INFO/ActivityManager(1284): Start proc com.kdweibo for activity com.kdweibo/.activities.ACT_Start: pid=17292 uid=10159 gids={3003, 1015, 1007}
比较华为U8860与HTC G10的log,发现华为荣耀系统出现快捷方式问题,是应为少了一步执行动作( Start proc com.kdweibo for activity com.kdweibo/.activities.ACT_Start: pid=17227 uid=10159 gids={3003, 1015, 1007}),如何解决?
Android创建快捷方式代码:
public void addShortCut(Activity act) {
Intent installShortCut = new Intent(
"com.android.launcher.action.INSTALL_SHORTCUT");
installShortCut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
getString(R.string.app_name));
installShortCut.putExtra("duplicate", false);
ComponentName comp = new ComponentName(
KDActivity.this.getPackageName(), "." + act.getLocalClassName());
installShortCut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(
Intent.ACTION_MAIN).setComponent(comp));
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(
act, R.drawable.app_icon);
installShortCut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes);
sendBroadcast(installShortCut);
}