无法启动活动ComponentInfo android.view.InflateException

时间:2015-01-20 05:02:51

标签: android exception view android-inflate

我正在开发一个由模拟仪表组成的应用程序,我从here的模拟仪表中找到了库。当我将库添加到下载的项目时,它已成功添加并正常工作。但是当谈到我的项目时,当我通过项目属性向我的项目添加相同的仪表视图库时 - > android-> add->选择library-> ok。当我点击确定它在库旁边显示一个红色的十字标记,我也试图添加库的jar文件,但它不会成功我显示 java.lang.RuntimeException:无法启动活动ComponentInfo {com .lakshman.samplelibraryproj / com.lakshman.samplelibraryproj.MainActivity}:android.view.InflateException:二进制XML文件行#6:错误膨胀类org.codeandmagic.android.gauge.GaugeView 。请帮助我,因为我从4个小时起就尝试了这个。

这是我的Xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

       <org.codeandmagic.android.gauge.GaugeView
        android:id="@+id/gauge_view1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />


</RelativeLayout>

这是我的logcat:

01-02 00:24:36.600: E/AndroidRuntime(4126): FATAL EXCEPTION: main
01-02 00:24:36.600: E/AndroidRuntime(4126): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lakshman.samplelibraryproj/com.lakshman.samplelibraryproj.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class org.codeandmagic.android.gauge.GaugeView
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.os.Looper.loop(Looper.java:137)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.app.ActivityThread.main(ActivityThread.java:5103)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at java.lang.reflect.Method.invokeNative(Native Method)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at java.lang.reflect.Method.invoke(Method.java:525)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at dalvik.system.NativeStart.main(Native Method)
01-02 00:24:36.600: E/AndroidRuntime(4126): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class org.codeandmagic.android.gauge.GaugeView
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.view.LayoutInflater.createView(LayoutInflater.java:620)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.app.Activity.setContentView(Activity.java:1895)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at com.lakshman.samplelibraryproj.MainActivity.onCreate(MainActivity.java:21)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.app.Activity.performCreate(Activity.java:5133)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
01-02 00:24:36.600: E/AndroidRuntime(4126):     ... 11 more
01-02 00:24:36.600: E/AndroidRuntime(4126): Caused by: java.lang.reflect.InvocationTargetException
01-02 00:24:36.600: E/AndroidRuntime(4126):     at java.lang.reflect.Constructor.constructNative(Native Method)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at android.view.LayoutInflater.createView(LayoutInflater.java:594)
01-02 00:24:36.600: E/AndroidRuntime(4126):     ... 22 more
01-02 00:24:36.600: E/AndroidRuntime(4126): Caused by: java.lang.NoClassDefFoundError: org.codeandmagic.android.gauge.R$styleable
01-02 00:24:36.600: E/AndroidRuntime(4126):     at org.codeandmagic.android.gauge.GaugeView.readAttrs(GaugeView.java:183)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at org.codeandmagic.android.gauge.GaugeView.<init>(GaugeView.java:170)
01-02 00:24:36.600: E/AndroidRuntime(4126):     at org.codeandmagic.android.gauge.GaugeView.<init>(GaugeView.java:175)
01-02 00:24:36.600: E/AndroidRuntime(4126):     ... 25 more

0 个答案:

没有答案