开发者社区> 问答> 正文

android startactivity 报错?报错

       at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NullPointerException
            at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:377)
            at android.app.LoadedApk.getClassLoader(LoadedApk.java:320)
            at android.app.LoadedApk.makeApplication(LoadedApk.java:493)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4238)
            at android.app.ActivityThread.access$1400(ActivityThread.java:140)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4935)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
            at dalvik.system.NativeStart.main(Native Method)
07-17 20:17:59.316  28301-28301/com.qingmedia.zhoudao E/LogUtils[error, 49]﹕ 检测到严重错误,程序即将退出
    java.lang.NullPointerException
            at com.zhy.android.percent.support.PercentLayoutHelper.shouldHandleMeasuredHeightTooSmall(PercentLayoutHelper.java:447)
            at com.zhy.android.percent.support.PercentLayoutHelper.handleMeasuredStateTooSmall(PercentLayoutHelper.java:422)
            at com.zhy.android.percent.support.PercentRelativeLayout.onMeasure(PercentRelativeLayout.java:89)
            at android.view.View.measure(View.java:15557)
            at android.widget.RelativeLayout.measureChild(RelativeLayout.java:602)
            at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:415)
            at com.zhy.android.percent.support.PercentRelativeLayout.onMeasure(PercentRelativeLayout.java:88)
            at android.view.View.measure(View.java:15557)
            at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
            at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
            at android.view.View.measure(View.java:15557)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5114)
            at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1396)
            at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
            at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
            at com.zhy.android.percent.support.PercentLinearLayout.onMeasure(PercentLinearLayout.java:29)
            at android.view.View.measure(View.java:15557)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5114)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
            at android.view.View.measure(View.java:15557)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5114)
            at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1396)
            at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
            at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
            at android.view.View.measure(View.java:15557)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5114)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2397)
            at android.view.View.measure(View.java:15557)
            at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
            at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1242)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1417)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1135)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4579)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
            at android.view.Choreographer.doCallbacks(Choreographer.java:555)
            at android.view.Choreographer.doFrame(Choreographer.java:525)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
            at android.os.Handler.handleCallback(Handler.java:615)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4935)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
            at dalvik.system.NativeStart.main(Native Method)


展开
收起
爱吃鱼的程序员 2020-06-12 15:45:57 528 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    出现同样的错误,

    而且不是每次都出现这个问题, 

     
      privatestaticboolean
      
       shouldHandleMeasuredHeightTooSmall(Viewview
       
        ,PercentLayoutInfoinfo){
        
         intstate=ViewCompat.
         
          getMeasuredHeightAndState(view)&ViewCompat.
          
           MEASURED_STATE_MASK
           
            ;
            
             returnstate==ViewCompat.
             
              MEASURED_STATE_TOO_SMALL&&info.
              
               heightPercent.
               
                percent>=
                
                 0&&info.
                 
                  mPreservedParams.
                  
                   height==ViewGroup.LayoutParams.
                   
                    WRAP_CONTENT
                    
                     ;}
                    
                   
                  
                 
                
               
              
             
            
           
          
         
        
       
      
     

    估计是info为null才报错的,

    能判断下就应该能解决这个问题

    2020-06-12 15:46:16
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
58同城Android客户端Walle框架演进与实践之路 立即下载
Android组件化实现 立即下载
蚂蚁聚宝Android秒级编译——Freeline 立即下载