【Android】修改权限后应用出现各种异常?

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/mortal_li/article/details/78805975

解决完了这个bug,还有下一个,永远改不完。

趁此赶紧来记录一下这个问题的解决办法。

 

问题:

最近写的是一个即使通讯的产品,早上来到公司突然发现邮箱里多了一个bug:

  • 在设置-应用-权限管理中禁用读写手机存储,app出现异常,用户掉线

what?什么鬼?

马上自测,果然,用户的登录状态变成了离线。。。

而实例对象也被置为null。。。

 

处理办法:

应用被系统杀死时,会自动调用OnSaveInstanceState,把一些页面和fragment保存进去。当执行OnCreate时,其形参bundle会把保存的数据释放出来。此时bundle不为null。

那么就可以在baseActivity的OnCreate中判断形参bundle是否为null。让其再次重新启动应用就好了。

下面是代码:

@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (savedInstanceState != null) {
            reLoadApp();
        }
    }

private void reLoadApp() {
        App.finishAllAct();
        skipActivity(StartActivity.class);
    }

 

展开阅读全文

Android代码混淆后出现AbstractMethodError异常

11-03

log日志:rn[code=java]java.lang.AbstractMethodError: abstract method "android.view.WindowInsets android.view.View$OnApplyWindowInsetsListener.onApplyWindowInsets(android.view.View, android.view.WindowInsets)"rn at android.view.View.dispatchApplyWindowInsets(View.java:7816)rn at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:6647)rn at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:6651)rn at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:6651)rn at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:6651)rn at android.view.ViewRootImpl.dispatchApplyInsets(ViewRootImpl.java:1662)rn at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1783)rn at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1487)rn at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7450)rn at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920)rn at android.view.Choreographer.doCallbacks(Choreographer.java:695)rn at android.view.Choreographer.doFrame(Choreographer.java:631)rn at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906)rn at android.os.Handler.handleCallback(Handler.java:739)rn at android.os.Handler.dispatchMessage(Handler.java:95)rn at android.os.Looper.loop(Looper.java:158)rn at android.app.ActivityThread.main(ActivityThread.java:7225)rn at java.lang.reflect.Method.invoke(Native Method)rn at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)rn at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)[/code]rn问题描述:rn项目中使用了表情包[code=html]https://github.com/w446108264/XhsEmoticonsKeyboard(emoji工具地址)[/code],代码混淆之后就会出现上述问题,就是在弹出表情键盘得时候奔溃,加上-keep public class还是会出现这个问题,问下大家在开发时使用emoji的时候有碰到过这个问题吗?要怎么解决呢 论坛

提交表单后出现异常???

11-22

type Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: /afterRegister.jsp(3,0) The value for the useBean class attribute java.UserInfoBean is invalid.rn org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)rn org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)rn org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)rn org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1229)rn org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178)rn org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)rn org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)rn org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)rn org.apache.jasper.compiler.Node$Root.accept(Node.java:495)rn org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)rn org.apache.jasper.compiler.Generator.generate(Generator.java:3440)rn org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)rn org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn看了很多有关处理方法,不是很懂,哪位帮忙说下如何解决该问题,,,3Q 论坛

没有更多推荐了,返回首页