更改包名后崩溃的应用程序

时间:2015-10-15 15:48:28

标签: android

我尝试更改包名。首先,我重命名src文件夹包,然后在android工具菜单中选择重命名包名。现在运行应用程序时:崩溃应用程序。 Logcat错误:

10-15 15:35:19.747: E/AndroidRuntime(1272): FATAL EXCEPTION: main
10-15 15:35:19.747: E/AndroidRuntime(1272): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nabproduct.nabege/com.nabproduct.nabege.Collection_List_Activity}: java.lang.NullPointerException
10-15 15:35:19.747: E/AndroidRuntime(1272):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at android.os.Looper.loop(Looper.java:137)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at android.app.ActivityThread.main(ActivityThread.java:4745)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at java.lang.reflect.Method.invokeNative(Native Method)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at java.lang.reflect.Method.invoke(Method.java:511)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at dalvik.system.NativeStart.main(Native Method)
10-15 15:35:19.747: E/AndroidRuntime(1272): Caused by: java.lang.NullPointerException
10-15 15:35:19.747: E/AndroidRuntime(1272):     at com.nabproduct.nabege.DB_Nabege_helper.count_collection(DB_Nabege_helper.java:156)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at com.nabproduct.nabege.Collection_List_Activity.fill_listView(Collection_List_Activity.java:361)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at com.nabproduct.nabege.Collection_List_Activity.onCreate(Collection_List_Activity.java:199)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at android.app.Activity.performCreate(Activity.java:5008)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
10-15 15:35:19.747: E/AndroidRuntime(1272):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)

2 个答案:

答案 0 :(得分:0)

你应该改变很多事情。你有没有在gradle文件中更改应用程序ID?它不会自动改变。你有没有更新android清单文件? 试着考虑一下......

答案 1 :(得分:0)

我使用如下字符串设置数据库路径:“/ data / data / com.example.nabege / databases /”。我改变了它并解决了问题。谢谢你的回答