在我的應用程序後,我在設備啓動其他應用程序,如:開始崩潰3d後黨的應用程序,該應用程序崩潰
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage(packageName);
if (LaunchIntent == null) return;
LaunchIntent.addCategory(Intent.CATEGORY_LAUNCHER);
LaunchIntent.setAction(Intent.ACTION_MAIN);
LaunchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
startActivity(LaunchIntent);
和所有工作正常,直到執行應用程序可能會崩潰。在這種情況下,我的應用程序也會關閉。
01-06 20:13:00.796 4560-4560/com.example.android.trivialdrivesample E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.trivialdrivesample/com.example.android.trivialdrivesample.MainActivity}: java.lang.RuntimeException: Please change the sample's package name! See README.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:850)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Please change the sample's package name! See README.
at com.example.android.trivialdrivesample.MainActivity.onCreate(MainActivity.java:146)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
... 11 more
01-06 20:13:00.804 1386-1520/? W/ActivityManager: Force finishing activity com.example.android.trivialdrivesample/.MainActivity
01-06 20:13:00.804 1386-1520/? W/ActivityManager: Force finishing activity com.digitalmediarevolutions.kfmobiledesktop/.activities.MainActivity
我應該怎麼做以防止強行關閉我的應用程序?
從logcat的:'請改變樣品包的名字!請參閱自述文件.' – Geobits
它與另一個應用程序有關,不適用於我的 – Bender