android.support.v4.widget.DrawerLayout;
在測試應用程序時未在我的手機上找到。爲什麼會發生這種情況,我該如何解決?java android.support.v4.widget.DrawerLayout未找到
我還不知道,但我想我可能會遇到與android.support.v4.view.GravityCompat;
和android.support.v4.app.ActionBarDrawerToggle;
相同的問題,如果它們確實會導致任何問題。
我從來沒有任何問題android.support.v4.*;
之前,但現在它不工作。 我有android.support.v4 lib(可能是一個)。
編輯:更好的錯誤消息
我的錯誤
05-27 19:46:21.230: E/jdwp(11659): Failed sending reply to debugger: Broken pipe
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve virtual method 30: Landroid/support/v4/widget/DrawerLayout;.closeDrawer (Landroid/view/View;)V
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve virtual method 27: Landroid/support/v4/app/ActionBarDrawerToggle;.onConfigurationChanged (Landroid/content/res/Configuration;)V
05-27 19:46:21.290: E/dalvikvm(11659): Could not find class 'android.support.v4.widget.DrawerLayout', referenced from method com.MainActivity.onCreate
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve check-cast 16 (Landroid/support/v4/widget/DrawerLayout;) in Lcom/MainActivity;
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve virtual method 28: Landroid/support/v4/app/ActionBarDrawerToggle;.onOptionsItemSelected (Landroid/view/MenuItem;)Z
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve virtual method 29: Landroid/support/v4/app/ActionBarDrawerToggle;.syncState()V
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve virtual method 31: Landroid/support/v4/widget/DrawerLayout;.isDrawerOpen (Landroid/view/View;)Z
05-27 19:46:21.290: W/dalvikvm(11659): Unable to resolve superclass of Lcom/MainActivity$1; (14)
05-27 19:46:21.290: W/dalvikvm(11659): Link of class 'Lcom/MainActivity$1;' failed
05-27 19:46:21.340: W/dalvikvm(11659): threadid=1: thread exiting with uncaught exception (group=0x40bc71f8)
05-27 19:16:42.404: E/dalvikvm(10623): Could not find class 'android.support.v4.widget.DrawerLayout', referenced from method com.MainActivity.onCreate
05-27 19:16:42.464: E/AndroidRuntime(10623): FATAL EXCEPTION: main
05-27 19:16:42.464: E/AndroidRuntime(10623): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MainActivity}: android.view.InflateException: Binary XML file line #3: Error inflating class android.support.v4.widget.DrawerLayout
問題是在xml佈局中,設置爲內容視圖。您需要發佈xml。 – Neoh
我嘗試了谷歌代碼後,看我是否可以得到它的工作,所以我加載他們的源代碼,我仍然有一個錯誤。 http://developer.android.com/training/implementing-navigation/nav-drawer.html – Spik330
您是否已更新到最新的支持庫版本? – Neoh