2014-11-01 87 views
0

在Android Studio項目中創建會產生錯誤,下面的錯誤堆棧。在創建自定義Nawigation抽屜活動後彈出錯誤。它可能是什麼?應用程序在android studio中編譯時出錯?

java.lang.ClassNotFoundException: android.support.v4.view.AccessibilityDelegateCompatIcs$AccessibilityDelegateBridge 
at org.jetbrains.android.uipreview.ProjectClassLoader.load(ProjectClassLoader.java:112) 
at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:52) 
at org.jetbrains.android.uipreview.ProjectClassLoader.findClass(ProjectClassLoader.java:73) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
at android.support.v4.view.AccessibilityDelegateCompat.<clinit>(AccessibilityDelegateCompat.java:296) 
at android.support.v4.widget.DrawerLayout.<init>(DrawerLayout.java:162) 
at android.support.v4.widget.DrawerLayout.<init>(DrawerLayout.java:256) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:408) 
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:379) 
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:99) 
at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:172) 
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207) 
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:478) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:381) 
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:400) 
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:329) 
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:333) 
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:674) 
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:663) 
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932) 
at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:663) 
at com.android.tools.idea.rendering.RenderService.render(RenderService.java:790) 
at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:480) 
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320) 
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310) 
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254) 
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269) 
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227) 
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217) 
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238) 
at com.intellij.util.Alarm$Request$1.run(Alarm.java:327) 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:745) 

還有就是我的XML,我得到錯誤:

<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --> 

<!-- As the main content view, the view below consumes the entire 
    space available using match_parent in both dimensions. --> 
<FrameLayout android:id="@+id/container" android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

<!-- android:layout_gravity="start" tells DrawerLayout to treat 
    this as a sliding drawer on the left side for left-to-right 
    languages and on the right side for right-to-left languages. 
    If you're not building against API 17 or higher, use 
    android:layout_gravity="left" instead. --> 
<!-- The drawer is given a fixed width in dp and extends the full height of 
    the container. --> 
<fragment android:id="@+id/navigation_drawer" 
    android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:name="com.tvitbook.dd.tvitbook.NavigationDrawerFragment" 
    tools:layout="@layout/fragment_navigation_drawer" /> 

image

+0

對不起,我的英語,我來自烏克蘭) – emigrantdd 2014-11-01 23:25:16

回答

1

我的猜測是,你沒有必要的做比較aibility Library(android.support.v4)。如果是這樣的話,把它添加到您的項目繼docs

  1. Make sure you have downloaded the Android Support Repository using the SDK Manager.
  2. Open the build.gradle file for your application.
  3. Add the support library to the dependencies section. For example, to add the v4 support library, add the following lines:

    dependencies { ... compile "com.android.support:support-v4:18.0.+" }

+0

它的doesen't工作。 – emigrantdd 2014-11-02 00:38:10