Android studio的错误记录

主要用来记录在做AS项目时候遇到的问题。

问题1:原本的工程是可以运行的,但是在使用databinding之后,就莫名出现下面的问题。

  Error:(47, 5) 错误: 方法不会覆盖或实现超类型的方法

  Error:(50, 24) 错误: 不兼容的类型: Context无法转换为Activity

  

  在网上也没怎么收到解决方案:唯一找到的说是:JDK引入版本错误,重新更新版本就可以了(我觉得我的不是这个问题)。连接:http://www.myexception.cn/ruby-rails/1312454.html

问题2:主要报错Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #3: <item> tag requires a 'drawable' attribute or child tag defining a drawable

 

  解决方案参考:http://blog.csdn.net/zhuhai__yizhi/article/details/50766083  

FATAL EXCEPTION: main
                  Process: com.liefengtech.merchants, PID: 4636
                  java.lang.RuntimeException: Unable to resume activity {com.liefengtech.merchants/com.liefengtech.camera.MainActivity}: android.view.InflateException: Binary XML file line #3: Error inflating class <unknown>
                      at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2774)
                      at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2803)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2238)
                      at android.app.ActivityThread.access$800(ActivityThread.java:135)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:136)
                      at android.app.ActivityThread.main(ActivityThread.java:5001)
                      at java.lang.reflect.Method.invokeNative(Native Method)
                      at java.lang.reflect.Method.invoke(Method.java:515)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:815)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
                      at dalvik.system.NativeStart.main(Native Method)
                   Caused by: android.view.InflateException: Binary XML file line #3: Error inflating class <unknown>
                      at android.view.LayoutInflater.createView(LayoutInflater.java:620)
                      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.setAddDeviceBtn(MainFragmentV2.java:198)
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.initview(MainFragmentV2.java:107)
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.onCreateView(MainFragmentV2.java:78)
                      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
                      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
                      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
                      at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)
                      at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:495)
                      at android.app.Activity.performResume(Activity.java:5356)
                      at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2764)
                      at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2803) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2238) 
                      at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:136) 
                      at android.app.ActivityThread.main(ActivityThread.java:5001) 
                      at java.lang.reflect.Method.invokeNative(Native Method) 
                      at java.lang.reflect.Method.invoke(Method.java:515) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:815) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631) 
                      at dalvik.system.NativeStart.main(Native Method) 
                   Caused by: java.lang.reflect.InvocationTargetException
                      at java.lang.reflect.Constructor.constructNative(Native Method)
                      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                      at android.view.LayoutInflater.createView(LayoutInflater.java:594)
                      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
                      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669) 
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:469) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.setAddDeviceBtn(MainFragmentV2.java:198) 
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.initview(MainFragmentV2.java:107) 
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.onCreateView(MainFragmentV2.java:78) 
                      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
                      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) 
                      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
                      at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339) 
                      at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:495) 
                      at android.app.Activity.performResume(Activity.java:5356) 
                      at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2764) 
                      at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2803) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2238) 
                      at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:136) 
                      at android.app.ActivityThread.main(ActivityThread.java:5001) 
                      at java.lang.reflect.Method.invokeNative(Native Method) 
                      at java.lang.reflect.Method.invoke(Method.java:515) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:815) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631) 
                      at dalvik.system.NativeStart.main(Native Method) 
                   Caused by: android.content.res.Resources$NotFoundException: File res/drawable/background_border.xml from drawable resource ID #0x7f020071
                      at android.content.res.Resources.loadDrawable(Resources.java:2096)
                      at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
                      at android.view.View.<init>(View.java:3559)
                      at android.view.View.<init>(View.java:3489)
                      at android.view.ViewGroup.<init>(ViewGroup.java:464)
                      at android.widget.RelativeLayout.<init>(RelativeLayout.java:236)
                      at java.lang.reflect.Constructor.constructNative(Native Method) 
                      at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                      at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
                      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
                      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669) 
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:469) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.setAddDeviceBtn(MainFragmentV2.java:198) 
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.initview(MainFragmentV2.java:107) 
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.onCreateView(MainFragmentV2.java:78) 
                      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
                      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) 
                      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
                      at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339) 
                      at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:495) 
                      at android.app.Activity.performResume(Activity.java:5356) 
                      at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2764) 
                      at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2803) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2238) 
                      at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:136) 
                      at android.app.ActivityThread.main(ActivityThread.java:5001) 
                      at java.lang.reflect.Method.invokeNative(Native Method) 
                      at java.lang.reflect.Method.invoke(Method.java:515) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:815) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631) 
                      at dalvik.system.NativeStart.main(Native Method) 
                   Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable
                      at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:181)
                      at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:937)
                      at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
                      at android.content.res.Resources.loadDrawable(Resources.java:2092)
                      at android.content.res.TypedArray.getDrawable(TypedArray.java:602) 
                      at android.view.View.<init>(View.java:3559) 
                      at android.view.View.<init>(View.java:3489) 
                      at android.view.ViewGroup.<init>(ViewGroup.java:464) 
                      at android.widget.RelativeLayout.<init>(RelativeLayout.java:236) 
                      at java.lang.reflect.Constructor.constructNative(Native Method) 
                      at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                      at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
                      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
                      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669) 
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:469) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.setAddDeviceBtn(MainFragmentV2.java:198) 
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.initview(MainFragmentV2.java:107) 
                      at com.liefengtech.camera.monitor.fragment.MainFragmentV2.onCreateView(MainFragmentV2.java:78) 
                      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
                      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) 
                      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
                      at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339) 
                      at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:495) 
                      at android.app.Activity.performResume(Activity.java:5356) 
                      at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2764) 
                      at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2803) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2238) 
                      at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:136) 
                      at android.app.ActivityThread.main(ActivityThread.java:5001) 
                      at java.lang.reflect.Method.invokeNative(Native Method) 
                      at java.lang.reflect.Method.invoke(Method.java:515) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:815) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631) 
                      at dalvik.system.NativeStart.main(Native Method) 

 问题3:一般来说这是因为环境路径没有配置好的原因,我这里只是因为没有更新项目版本

  

 问题4:android.view.InflateException: Binary XML file line #79: Error inflating class <unknown>

  这里其实已经把错误的位置告诉了我们,这里一般是xml中相关定义的错误。

  参考博客:http://www.crifan.com/android_textview_android_view_inflateexception_binary_xml_file_line_error_inflating_class_unknown/

  

 

问题5:在插件中可以运行,但是跑到宿主里面运行就报错:

 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.liefengtech.tv.launcher/com.ryg.dynamicload.DLProxyFragmentActivity}: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = com.liefeng.plugin.restapi.vo.propertytvbox.AppHomeImageVo)

 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.liefeng.plugin.restapi.vo.propertytvbox.AppHomeImageVo" on path: DexPathList[[zip file "/data/app/com.liefengtech.tv.launcher-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.liefengtech.tv.launcher-1, /system/lib]]

  

  因为尝试了很多方法都没有成功,于是将传递的AppHomeImageVo分解成了简单的String类型来传递。

 

问题6:运行clean时报错:

 Unable to delete file: E:\android\Project\lfxx-android-tv\lfxxapp\plugin2\build\intermediates\exploded-aar\com.android.support\animat
ed-vector-drawable\24.2.0\jars\classes.jar

  查了一下,都说是权限的问题,这里我直接将文件下的jar包删除了。然后就没有报错。

 问题7:关于使用viewpager内存溢出

  这里主要在生成view的时候,出现内存溢出的情况。

  报错代码:View introduceView6 = getLayoutInflater().inflate(R.layout.healthkl6, null);

  这里生成了许多个view,当view数量比较少的时候没有问题,当view达到一定数量出现内存溢出的现象。此外,在运行在真机上时,会出现内存溢出,但是跑到虚拟机上不会 出现内存溢出,跑到宿主中也不会出现内存溢出。

 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.liefengtech.government/com.liefengtech.launcher.CourtShootingActivity}: android.view.InflateException: Binary XML file line #5: Error inflating class <unknown>
                                                                                
   Caused by: android.view.InflateException: Binary XML file line #5: Error inflating class <unknown>

   Caused by: java.lang.reflect.InvocationTargetException

   Caused by: java.lang.OutOfMemoryError

  

 

  

 

posted @ 2017-03-17 16:12  sloth_ccc  阅读(755)  评论(0编辑  收藏  举报