java.lang.NullPointerException: Attempt to invoke virtual method 'voID androID.support.v7.Widget.SearchVIEw.setqueryHint(java.lang.CharSequence)' on a null object reference at tm.veriloft.ertir.ui.SearchActivity.onCreateOptionsMenu(UnkNown Source) at androID.app.Activity.onCreatePanelMenu(Activity.java:2820) at androID.support.v4.app.o.onCreatePanelMenu(UnkNown Source) at androID.support.v7.app.e.a(UnkNown Source) at androID.support.v7.app.g.a(UnkNown Source) at androID.support.v7.Widget.as.a(UnkNown Source) at androID.support.v7.internal.a.a.j(UnkNown Source) at androID.support.v7.internal.a.b.run(UnkNown Source) at androID.os.Handler.handleCallback(Handler.java:739) at androID.os.Handler.dispatchMessage(Handler.java:95) at androID.os.Looper.loop(Looper.java:135) at androID.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:694)
要么
java.lang.NullPointerException: Attempt to invoke virtual method 'voID androID.support.v7.Widget.ah.a(androID.content.Intent)' on a null object reference at tm.veriloft.ertir.ui.BlogVIEwActivity.onCreateOptionsMenu(UnkNown Source) at androID.app.Activity.onCreatePanelMenu(Activity.java:2820) at androID.support.v4.app.o.onCreatePanelMenu(UnkNown Source) at androID.support.v7.app.e.a(UnkNown Source) at androID.support.v7.app.g.a(UnkNown Source) at androID.support.v7.Widget.as.a(UnkNown Source) at androID.support.v7.internal.a.a.j(UnkNown Source) at androID.support.v7.internal.a.b.run(UnkNown Source) at androID.os.Handler.handleCallback(Handler.java:739) at androID.os.Handler.dispatchMessage(Handler.java:95) at androID.os.Looper.loop(Looper.java:135) at androID.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:694)
我正在使用支持库和工具栏的最新版本. (通过设置setSupportActionbar(mToolbar)).
SearchVIEw xml:
<menu xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:ertir="http://schemas.androID.com/apk/res-auto"> <item androID:ID="@+ID/action_search" androID:title="@string/Title_activity_search" ertir:showAsAction="always" ertir:actionVIEwClass="androID.support.v7.Widget.SearchVIEw" /></menu>
Java的
@OverrIDe public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.search,menu); MenuItem searchItem = menu.findItem(R.ID.action_search); mSearchVIEw = (SearchVIEw) searchItem.getActionVIEw(); mSearchVIEw.setqueryHint(getString(R.string.search_hint)); mSearchVIEw.setFocusable(true); mSearchVIEw.setIconifIEd(false); mSearchVIEw.requestFocusFromtouch(); mSearchVIEw.setonqueryTextListener(new SearchVIEw.OnqueryTextListener() { @OverrIDe public boolean onqueryTextsubmit(String query) { mSearchVIEw.clearFocus(); //HIDe keyboard search(query,searchTypeArray.get(searchTypeSpinner.getSelectedItemposition()).getType()); return false; } @OverrIDe public boolean onqueryTextChange(String query) { if (searchTypeArray.get(searchTypeSpinner.getSelectedItemposition()).getType().equals("blogs")) searchAfter(1100,query,searchTypeArray.get(searchTypeSpinner.getSelectedItemposition()).getType()); else search(query,searchTypeArray.get(searchTypeSpinner.getSelectedItemposition()).getType()); return false; } }); return true; }
我怎样才能解决这个问题?如上所述,我只有在签署apk后才会收到错误.
解决方法 这是因为您没有适当地配置您的progaurd.在buildTypes和’release’下的build.gradle中,将runProguard更改为true,以runProguard为false并生成已烧录的APK并进行测试.如果它运作良好,请尝试学习适当配置progaurd 总结以上是内存溢出为你收集整理的android – 构建apk后的错误全部内容,希望文章能够帮你解决android – 构建apk后的错误所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)