在手机上运行我的android应用程序时出现充气异常错误
希望有人能帮我。我已经尝试了几个小时来修复它-在下面的logcat中,我相信重要的一行是带有在手机上运行我的android应用程序时出现充气异常错误,android,runtime-error,android-xml,inflate-exception,Android,Runtime Error,Android Xml,Inflate Exception,希望有人能帮我。我已经尝试了几个小时来修复它-在下面的logcat中,我相信重要的一行是带有错误膨胀类的那一行。我已经在下面发布了我的代码。该软件包可以编译,但当我运行它时,手机会立即关闭 谢谢你的帮助 我在drawable或OutOfMemoryError解决方案中看到了类似的问题,但它们似乎都与我的问题无关 02-12 10:38:55.390 31692-31692/com.example.chris.sunil_gupta D/dalvikvm﹕ Late-enabling Check
错误膨胀类的那一行。我已经在下面发布了我的代码。该软件包可以编译,但当我运行它时,手机会立即关闭
谢谢你的帮助
我在drawable或OutOfMemoryError
解决方案中看到了类似的问题,但它们似乎都与我的问题无关
02-12 10:38:55.390 31692-31692/com.example.chris.sunil_gupta D/dalvikvm﹕ Late-enabling CheckJNI
02-12 10:38:55.400 31692-31698/com.example.chris.sunil_gupta E/jdwp﹕ Failed writing handshake bytes: Broken pipe (-1 of 14)
02-12 10:38:55.400 31692-31698/com.example.chris.sunil_gupta D/dalvikvm﹕ Debugger has detached; object registry had 0 entries
02-12 10:38:55.420 31692-31692/com.example.chris.sunil_gupta D/ActivityThread﹕ setTargetHeapUtilization:0.75
02-12 10:38:55.420 31692-31692/com.example.chris.sunil_gupta D/ActivityThread﹕ setTargetHeapConcurrentStart:2097152
02-12 10:38:55.450 31692-31692/com.example.chris.sunil_gupta D/AndroidRuntime﹕ Shutting down VM
02-12 10:38:55.450 31692-31692/com.example.chris.sunil_gupta W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x415998e0)
02-12 10:38:55.450 31692-31692/com.example.chris.sunil_gupta E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.chris.sunil_gupta/com.example.chris.sunil_gupta.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class linearlayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)
at android.app.ActivityThread.access$900(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1319)
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chris.sunil_gupta" >
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
活动\u main.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<listview android:id="@+id/listView_calldata"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</listview>
</linearlayout>
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<linearlayout android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical">
<textview android:id="@+id/textView_calltype"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
<textview android:id="@+id/textView_callnumber"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView_callnumber">
<textview android:id="@+id/textView_calldate"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
<textview android:id="@+id/textView_callduration"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
</textview>
</textview>
</textview>
</textview>
</linearlayout>
</linearlayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<ListView android:id="@+id/listView_calldata"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
</LinearLayout>
list_row.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<listview android:id="@+id/listView_calldata"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</listview>
</linearlayout>
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<linearlayout android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical">
<textview android:id="@+id/textView_calltype"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
<textview android:id="@+id/textView_callnumber"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView_callnumber">
<textview android:id="@+id/textView_calldate"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
<textview android:id="@+id/textView_callduration"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
</textview>
</textview>
</textview>
</textview>
</linearlayout>
</linearlayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<ListView android:id="@+id/listView_calldata"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
</LinearLayout>
您正在使用
<linearlayout> instead of <LinearLayout>
而不是
换掉它,再试一次!希望你会成功 您正在使用
<linearlayout> instead of <LinearLayout>
而不是
换掉它,再试一次!希望你会成功 您在activity\u main.xml
和list\u row.xml
文件中使用了错误的xmls标记,您需要更改它们:
linearlayout
->linearlayout
textview
->textview
listview
->listview
您在activity\u main.xml
和list\u row.xml
文件中使用了错误的xmls标记,您需要更改它们:
linearlayout
->linearlayout
textview
->textview
listview
->listview
更改
list_row.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView_calltype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<Textview
android:id="@+id/textView_callnumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView_callnumber" />
<TextView
android:id="@+id/textView_calldate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<TextView
android:id="@+id/textView_callduration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
活动\u main.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<listview android:id="@+id/listView_calldata"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</listview>
</linearlayout>
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<linearlayout android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical">
<textview android:id="@+id/textView_calltype"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
<textview android:id="@+id/textView_callnumber"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView_callnumber">
<textview android:id="@+id/textView_calldate"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
<textview android:id="@+id/textView_callduration"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
</textview>
</textview>
</textview>
</textview>
</linearlayout>
</linearlayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<ListView android:id="@+id/listView_calldata"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
</LinearLayout>
还要更正“活动”中的标记名。更改
list_row.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView_calltype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<Textview
android:id="@+id/textView_callnumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView_callnumber" />
<TextView
android:id="@+id/textView_calldate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<TextView
android:id="@+id/textView_callduration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
活动\u main.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<listview android:id="@+id/listView_calldata"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</listview>
</linearlayout>
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<linearlayout android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical">
<textview android:id="@+id/textView_calltype"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
<textview android:id="@+id/textView_callnumber"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView_callnumber">
<textview android:id="@+id/textView_calldate"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
<textview android:id="@+id/textView_callduration"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TextView">
</textview>
</textview>
</textview>
</textview>
</linearlayout>
</linearlayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<ListView android:id="@+id/listView_calldata"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
</LinearLayout>
也请更正“活动”中的标记名。其他标记的“不使用”和“相同”应以大写字母开头。@Christophe Harris:检查xml中使用的标记,因为它的名称,谢谢大家的帮助+1.结果是出现了一系列错误:linearlayout、textview和最后的结束标记不应该在那里。其他标记不使用和相同,也应该以大写字母开头。@Christophe Harris:检查xml中使用的标记,因为它非常有用,谢谢大家的帮助+1.结果是出现了一系列错误:linearlayout、textview和最后的结束标记不应该出现。太好了,谢谢。上面的许多答案都是正确的,但我认为这是最全面的答案,因为linearlayout、textview中的大写字母存在问题,并且您在这里提到了listrow.xmlPerfect中的那些导致错误的标记,谢谢。上面的许多答案都是正确的,但我认为这是最全面的答案,因为linearlayout、textview中的大写字母存在问题,并且您在这里提到了listrow.xml中那些导致错误的标记