当我运行项目时,为什么会发生此错误?

时间:2019-01-07 08:54:46

标签: android-studio

01-07 14:19:21.816 9861-9861 /? I / art:后期启用-Xcheck:jni

我无法纠正此错误,

01-07 14:19:22.168 9861-9861 / com.example.krishna.androideatit W /系统:ClassLoader引用的未知路径:/data/app/com.example.krishna.androideatit-1/lib/arm64     01-07 14:19:22.202 9861-9861 / com.example.krishna.androideatit I / art:启动阻止GC的HeapTrim

 01-07 14:19:22.211 9861-9861/com.example.krishna.androideatit I/InstantRun: starting instant run server: is main process
    01-07 14:19:22.463 9861-9861/com.example.krishna.androideatit W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
    01-07 14:19:22.615 9861-9861/com.example.krishna.androideatit D/skia: SkJpegCodec::onGetPixels +
    01-07 14:19:22.620 9861-9861/com.example.krishna.androideatit D/skia: SkJpegCodec::onGetPixels -
    01-07 14:19:22.665 9861-9872/com.example.krishna.androideatit I/art: Enter while loop.
    01-07 14:19:22.741 9861-9861/com.example.krishna.androideatit D/AndroidRuntime: Shutting down VM
    01-07 14:19:22.747 9861-9861/com.example.krishna.androideatit E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                    Process: com.example.krishna.androideatit, PID: 9861
                                                                                    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.krishna.androideatit/com.example.krishna.androideatit.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724)
                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)
                                                                                        at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:110)
                                                                                        at android.os.Looper.loop(Looper.java:203)
                                                                                        at android.app.ActivityThread.main(ActivityThread.java:6251)
                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
                                                                                     Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
                                                                                     Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
                                                                                     Caused by: java.lang.reflect.InvocationTargetException
                                                                                        at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                                        at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                                                                                        at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
                                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
                                                                                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
                                                                                        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
                                                                                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
                                                                                        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                                                                                        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
                                                                                        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                                                                                        at com.example.krishna.androideatit.MainActivity.onCreate(MainActivity.java:18)
                                                                                        at android.app.Activity.performCreate(Activity.java:6666)
                                                                                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)
                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)
                                                                                        at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:110)
                                                                                        at android.os.Looper.loop(Looper.java:203)
                                                                                        at android.app.ActivityThread.main(ActivityThread.java:6251)
                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
                                                                                     Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5
                                                                                        at android.content.res.TypedArray.getColor(TypedArray.java:466)
                                                                                        at info.hoang8f.widget.FButton.parseAttrs(FButton.java:116)
                                                                                        at info.hoang8f.widget.FButton.<init>(FButton.java:52)
                                                                                        at java.lang.reflect.Constructor.newInstance0(Native Method) 
                                                                                        at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
                                                                                        at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
                                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 
                                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
                                                                                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 
                                                                                        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
                                                                                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 
                                                                                        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 
                                                                                        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
                                                                                        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
                                                                                        at com.example.krishna.androideatit.MainActivity.onCreate(MainActivity.java:18) 
                                                                                        at android.app.Activity.performCreate(Activity.java:6666) 
                                                                                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 
                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677) 
                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789) 
                                                                                        at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527) 
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:110) 
                                                                                        at android.os.Looper.loop(Looper.java:203) 
                                                                                        at android.app.ActivityThread.main(ActivityThread.java:6251) 
                                                                                        at java.lang.reflect.Method.invoke(Native Method) 
                                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) 
                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924) 

1 个答案:

答案 0 :(得分:0)

在这里清楚地写到异常是由于

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.krishna.androideatit/com.example.krishna.androideatit.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton

请提供更多帮助的代码