错误膨胀FloatingActionButton的布局:NoSuchMethodException

所以我得到一个错误膨胀的布局,关于NoSuchMethodException。 我已经看过其他的解决scheme,我已经确定我已经做了以下,我有,我仍然得到例外。 有谁知道这可能是什么原因造成的? 我完全失去了,一切工作正常,然后我更新了我的android工作室,现在我得到这个错误。

我的活动是一个AppCompatActivity

我的应用程序布局,使用AppCompat:

<!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="windowNoTitle">true</item> </style> 

我的布局代码,使用应用程序名称空间来设置背景色调:

 <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@drawable/ic_add_white_18dp" app:backgroundTint="@color/colorPrimary" app:layout_behavior="Behaviors.ScrollAwareFABBehavior"/> <include layout="@layout/content_main" /> 

这是我的gradle构build文件:

 compile 'com.android.support:multidex:1.0.0' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.4.0' compile 'com.android.support:support-v4:23.4.0' compile 'com.android.support:recyclerview-v7:23.4.0' compile 'com.android.support:cardview-v7:23.4.0' compile 'com.google.android.gms:play-services:9.4.0' 

这是我的堆栈跟踪:

 java.lang.NoSuchMethodError: android.support.v7.widget.AppCompatImageHelper.<init>(Landroid/widget/ImageView;Landroid/support/v7/widget/AppCompatDrawableManager;)V at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:133) at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:110) 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:423) at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172) at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105) at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:334) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:345) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:245) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:834) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:197) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:902) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:854) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:834) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater.inflate(LayoutInflater.java:518) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429) at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389) at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548) at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$53(RenderTask.java:659) 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) 

Solutions Collecting From Web of "错误膨胀FloatingActionButton的布局:NoSuchMethodException"

我确实有一些问题,这是随机的,这是在Android的工作室select“确定”之后,今天是关于下载东西相关的东西。 :P

我试图提高SDK构build工具(不使用它们),并重build项目,但没有运气。

然后,我升级到JAVA 1.8,移动到compileSdkVersion 24和支持库24.2.1,它的工作。

所以Google有可能在上次更新时破坏了一些内容。

将compileSdkVersion设置为24,然后更改

编译'com.android.support:design:23.4.0'

编译'com.android.support:design:24.2.0'

然后同步你的项目,这将解决问题。

当我运行的应用程序! 我有更详细的错误!

 Caused by: java.lang.NoSuchMethodError: No direct method <init>(Landroid/widget/ImageView;Landroid/support/v7/widget/AppCompatDrawableManager;)V in class Landroid/support/v7/widget/AppCompatImageHelper; or its super classes (declaration of 'android.support.v7.widget.AppCompatImageHelper' appears in /data/data/com.weituotian.weituotianvideo/files/instant-run/dex/slice-com.android.support-appcompat-v7-25.0.0_850df7fcd98a57a963b231f15b37dc8c4ae3ee97-classes.dex) 

所以使用appcompatv7:25