为什么我的应用在使用搜索视图时崩溃?

时间:2018-04-05 12:07:41

标签: android nullpointerexception

我是新手android我做了一个项目,并通过禁用minifyEnabled将其加载到Play商店中,当我下载并运行时它正常工作但是当我通过启用minifyEnabled上传apk时,应用程序崩溃显示以下错误< / p>

04-05 15:33:10.795 1524-1524/? E/AndroidRuntime: FATAL EXCEPTION: main

java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
    at com.asiczen.azlock.GuestListActivity.onCreateOptionsMenu(Unknown Source)
    at android.app.Activity.onCreatePanelMenu(Activity.java:3320)
    at android.support.v4.app.i.onCreatePanelMenu(Unknown Source)
    at android.support.v7.view.i.onCreatePanelMenu(Unknown Source)
    at android.support.v7.app.f$a.onCreatePanelMenu(Unknown Source)
    at android.support.v7.app.k.b(Unknown Source)
    at android.support.v7.app.k.f(Unknown Source)
    at android.support.v7.app.k$1.run(Unknown Source)
    at android.os.Handler.handleCallback(Handler.java:754)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:163)
    at android.app.ActivityThread.main(ActivityThread.java:6361)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)

1 个答案:

答案 0 :(得分:0)

也有这个错误。通过在proguard-rules.pro文件中添加以下内容来解决此问题

=HLOOKUP(1;CHOOSE({1,2};A1:C1;A3:C3);2;FALSE)