堆栈跟踪:
11-04 07:35:04.404: E/AndroIDRuntime(1427): FATAL EXCEPTION: main11-04 07:35:04.404: E/AndroIDRuntime(1427): Process: com.example.steve,PID: 142711-04 07:35:04.404: E/AndroIDRuntime(1427): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.steve/com.example.steve.MainActivity}: androID.vIEw.InflateException: Binary XML file line #2: Error inflating class androID.support.v4.Widget.DrawerLayout11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2195)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.app.ActivityThread.access0(ActivityThread.java:135)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.os.Handler.dispatchMessage(Handler.java:102)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.os.Looper.loop(Looper.java:136)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.app.ActivityThread.main(ActivityThread.java:5017)11-04 07:35:04.404: E/AndroIDRuntime(1427): at java.lang.reflect.Method.invokeNative(Native Method)11-04 07:35:04.404: E/AndroIDRuntime(1427): at java.lang.reflect.Method.invoke(Method.java:515)11-04 07:35:04.404: E/AndroIDRuntime(1427): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)11-04 07:35:04.404: E/AndroIDRuntime(1427): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:595)11-04 07:35:04.404: E/AndroIDRuntime(1427): at dalvik.system.NativeStart.main(Native Method)11-04 07:35:04.404: E/AndroIDRuntime(1427): Caused by: androID.vIEw.InflateException: Binary XML file line #2: Error inflating class androID.support.v4.Widget.DrawerLayout11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:707)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:469)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:397)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:353)11-04 07:35:04.404: E/AndroIDRuntime(1427): at com.androID.internal.policy.impl.PhoneWindow.setContentVIEw(PhoneWindow.java:290)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.app.Activity.setContentVIEw(Activity.java:1929)11-04 07:35:04.404: E/AndroIDRuntime(1427): at com.qrme.quranmadeeasy.Chapteractivity.onCreate(Chapteractivity.java:91)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.app.Activity.performCreate(Activity.java:5231)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2159)11-04 07:35:04.404: E/AndroIDRuntime(1427): ... 11 more11-04 07:35:04.404: E/AndroIDRuntime(1427): Caused by: java.lang.classNotFoundException: DIDn't find class "androID.support.v4.Widget.DrawerLayout" on path: DexPathList[[zip file "/data/app/com.qrme.quranmadeeasy-2.apk"],nativelibraryDirectorIEs=[/data/app-lib/com.qrme.quranmadeeasy-2,/system/lib]]11-04 07:35:04.404: E/AndroIDRuntime(1427): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)11-04 07:35:04.404: E/AndroIDRuntime(1427): at java.lang.classLoader.loadClass(ClassLoader.java:497)11-04 07:35:04.404: E/AndroIDRuntime(1427): at java.lang.classLoader.loadClass(ClassLoader.java:457)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.vIEw.LayoutInflater.createVIEw(LayoutInflater.java:559)11-04 07:35:04.404: E/AndroIDRuntime(1427): at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:696)11-04 07:35:04.404: E/AndroIDRuntime(1427): ... 20 more
Chapteractivity.java:
package com.example.steve;import androID.support.v4.app.ActionbarDrawerToggle;import androID.support.v4.Widget.DrawerLayout;public class MainActivity extends Activity implements OnItemClickListener {relativeLayout relativelayoutContainer; TextVIEw txtheading; ListVIEw ListChapter; ListVIEw ListSlIDer; ImageVIEw imgBanner;@Suppresslint("NewAPI") @OverrIDe protected voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getwindow().requestFeature(Window.FEATURE_ACTION_bar); setContentVIEw(R.layout.activity_main); --->Error line no.91 initialize(); } private voID initialize() { relativelayoutContainer = (relativeLayout) findVIEwByID(R.ID.container); txtheading = (TextVIEw) findVIEwByID(R.ID.textvIEwheading); ListChapter = (ListVIEw) findVIEwByID(R.ID.ListvIEwChapters); imgBanner = (ImageVIEw) findVIEwByID(R.ID.imagevIEwBanner); ListSlIDer = (ListVIEw) findVIEwByID(R.ID.List_slIDermenu); // Setting Font color and size Resources resources = Chapteractivity.this.getResources(); } private voID displayVIEw(int position) { // update the main content by replacing fragments Fragment fragment = null; switch (position) { case 0: fragment = new HomeFragment(); break; case 1: fragment = new FindPeopleFragment(); break; case 2: fragment = new PhotosFragment(); break; default: break; } if (fragment != null) { FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .replace(R.ID.frame_container,fragment).commit(); // update selected item and Title,then close the drawer mDrawerList.setItemChecked(position,true); mDrawerList.setSelection(position); setTitle(navMenuTitles[position]); mDrawerLayout.closeDrawer(mDrawerList); } else { // error in creating fragment Log.e("MainActivity","Error in creating fragment"); } } }
activity_main.xml中:
<?xml version="1.0" enCoding="utf-8"?> <androID.support.v4.Widget.DrawerLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:ID="@+ID/drawer_layout" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" > <FrameLayout androID:ID="@+ID/frame_container" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" /> <relativeLayout androID:ID="@+ID/container" androID:layout_wIDth="match_parent"layout_wIDth="wrap_content" androID:layout_height="match_parent" > <TextVIEw androID:ID="@+ID/textvIEwheading" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParenttop="true" androID:layout_centerHorizontal="true" androID:layout_margintop="5dp" androID:FontFamily="Fonts/Dosis.otf" androID:text="@string/heading_chapter" androID:textSize="25sp" androID:visibility="gone" /> <ListVIEw androID:ID="@+ID/ListvIEwChapters" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:layout_above="@+ID/imagevIEwBanner" androID:layout_below="@+ID/textvIEwheading" androID:layout_margintop="5dp" /> </ListVIEw> <ImageVIEw androID:ID="@+ID/imagevIEwBanner" androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:layout_alignParentBottom="true" androID:layout_centerHorizontal="true" androID:src="@drawable/banner" androID:visibility="invisible" /> </relativeLayout> <ListVIEw androID:ID="@+ID/List_slIDermenu" androID:layout_wIDth="240dp" androID:layout_height="match_parent" androID:layout_gravity="start" androID:background="@color/List_background" androID:choiceMode="singleChoice" androID:divIDer="@color/List_divIDer" androID:divIDerHeight="1dp" androID:ListSelector="@drawable/List_selector" androID:background="@color/List_background"/> </androID.support.v4.Widget.DrawerLayout>
如果我单击图形布局我在下面得到这个例外:
Exception raised during rendering: com.androID.layoutlib.brIDge.MockVIEw cannot be cast to androID.vIEw.VIEwGroupException details are logged in Window > Show VIEw > Error LogThe following classes Could not be instantiated:- androID.support.v4.Widget.DrawerLayout (Open Class,Show Error Log)
然后在Java Build path-> librarIEs中
然后在Java Build path – > order and export:
在上面的截图中,如果我检查androID.support.v4.jar,我在控制台中收到以下Multiple Dex错误:
[2014-11-04 18:35:30 - Dex Loader] Unable to execute dex: Multiple dex files define LandroID/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;[2014-11-04 18:35:30 - main-androID] Conversion to Dalvik format Failed: Unable to execute dex: Multiple dex files define LandroID/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;解决方法 只需检查androID版本和支持lib复选框,它将解决您的问题. 总结
以上是内存溢出为你收集整理的运行时异常:错误膨胀类android.support.v4.widget.DrawerLayout全部内容,希望文章能够帮你解决运行时异常:错误膨胀类android.support.v4.widget.DrawerLayout所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)