AndroidJavaException: java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.tencent.mm.opensdk.openapi.IWXAPI.isWXAppInstalled()' on a null object reference java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.tencent.mm.opensdk.openapi.IWXAPI.isWXAppInstalled()' on a null object reference
【安卓】新版SDK isWXAppInstalled() 抛出异常,无法使用第三方登录,无法支付异常日志: java.lang.IllegalStateException isWXAppInstalled fail, WXMsgImpl has been detached com.tencent.mm.opensdk.openapi.BaseWXApiImplV10.isWXAppInstalled(Unknown Source) .platform.weixin.WXManager.judegeWX(WXManager.java:251) .platform.weixin.WXManager.onLoginWithWX(WXManager.java:48) .activity.LoginAndRegisterActivity.btnWeiXinLogin(LoginAndRegisterActivity.java:254) .activity.LoginAndRegisterActivity$$ViewBinder$5.doClick(LoginAndRegisterActivity$$ViewBinder.java:64) butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22) android.view.View.performClick(View.java:5231) android.view.View$PerformClick.run(View.java:21240) android.os.Handler.handleCallback(Handler.java:739) android.os.Handler.dispatchMessage(Handler.java:95) android.os.Looper.loop(Looper.java:179) android.app.ActivityThread.main(ActivityThread.java:5769) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674) 涉及机型: [图片] SDK版本: com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.3.1 关键代码: /** * 检测判断合法性 */ private void judegeWX(){ if (mAPI == null){ if (mListener != null){ mListener.onError("createWXAPI error!"); } return; } if (!mAPI.isWXAppInstalled()){ if (mListener != null){ mListener.onError("WeChat is not install!"); } return; } } 客户微信版本不清楚
2021-09-26