2

我正在使用FloatingActionButton,当我在我的 xml 中使用时,它会引发如下错误:

java.lang.NoSuchFieldError: FloatingActionButton_fab_colorNormal
at com.github.clans.fab.FloatingActionButton.init(FloatingActionButton.java:120)
at com.github.clans.fab.FloatingActionButton.(FloatingActionButton.java:109)
at com.github.clans.fab.FloatingActionButton.(FloatingActionButton.java:104)
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:475)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:262)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:220)
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.rInflate_Original(LayoutInflater.java:861)
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.rInflate_Original(LayoutInflater.java:861)
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:368)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:567)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:549)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:863)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:549)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$1(RenderTask.java:680)
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)

我是谷歌它,但我没有找到任何解决方案,我使用的是 android studio 2.3.1,reserches 发现它给出了错误 com.android.support:design not available,但我在我的依赖项中使用了这个版本

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

如果有人知道问题,请帮助我。谢谢

这是我的 build.gradle :

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
useLibrary 'org.apache.http.legacy'
defaultConfig {
    applicationId "com.wsolus.chathuranga.simplifya"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 22
    versionName "2.0.1"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
//compile 'com.android.support:appcompat-v7:24.2.1'
//compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile('org.apache.httpcomponents:httpmime:4.3') {
    exclude module: "httpclient"
}
//compile'org.apache.httpcomponents:httpmime:4.3'


compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.mlsdev.rximagepicker:library:1.3.1'
compile 'io.reactivex:rxjava:1.0.14'
compile 'org.apache.httpcomponents:httpclient:4.3'
compile 'org.apache.httpcomponents:httpcore:4.4.4'
compile 'joda-time:joda-time:2.1'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'org.roboguice:roboguice:3.0.1'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.android.support:palette-v7:24.2.0'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
testCompile 'junit:junit:4.12'
provided 'org.roboguice:roboblender:3.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.okhttp:okhttp:2.7.2'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.github.markushi:circlebutton:1.1'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'com.github.clans:fab:1.6.4'

}

应用插件:'com.google.gms.google-services'

这是我的xml:

    <?xml version="1.0" encoding="utf-8"?>     
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_home"         
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/windowBackground"
tools:context="com.wsolus.chathuranga.simplifya.Home">

<include             
android:id="@+id/tool_bar"
layout="@layout/tool_bar" />

<FrameLayout             
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/tool_bar"             
android:clickable="true">


<LinearLayout           
android:id="@+id/supermainlayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">


<LinearLayout             
android:id="@+id/LinearLayout1"
android:layout_width="500dp"             
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/windowBackground"
android:orientation="horizontal">


<LinearLayout              
android:id="@+id/lnname2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<LinearLayout              
android:id="@+id/lnname4"
android:layout_width="match_parent"               
android:layout_height="80dp"
android:orientation="horizontal">


<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/windowBackground"
android:orientation="horizontal">

<TextView
android:id="@+id/tvname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="20dp"
android:text="Appointment List"
android:textColor="@color/apptlistdark"
android:textSize="23sp" />


</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="15dp"
android:layout_weight="0.97"
android:background="@color/windowBackground"
android:gravity="center_vertical"
android:orientation="vertical">

<Spinner
android:id="@+id/spinnercmp"
android:layout_width="290dp"
android:layout_height="50dp"
android:layout_gravity="end"
android:background="@drawable/spinnerstyl" />


</LinearLayout>


</LinearLayout>

<View
android:layout_width="fill_parent"
android:layout_height="2px"
android:background="@color/listviewbackground" />

<LinearLayout
android:id="@+id/lnlayoutlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lnname4"
android:background="@drawable/border"
android:orientation="vertical">

<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layouttext"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.baoyz.swipemenulistview.SwipeMenuListView
android:id="@+id/lvappointments"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="3dp"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical" />


</android.support.v4.widget.SwipeRefreshLayout>

</LinearLayout>

<LinearLayout
android:id="@+id/lnlayoutnoapp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/lnname4"
android:background="@drawable/border"
android:orientation="horizontal"
android:visibility="gone">

<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ListView
android:id="@+id/lvnoapp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@color/listviewbackground"
android:dividerHeight="2dp"
android:paddingRight="3dp"
android:scrollbarStyle="outsideOverlay" />

</android.support.v4.widget.SwipeRefreshLayout>

</LinearLayout>


</LinearLayout>

</LinearLayout>


<LinearLayout
android:id="@+id/LinearLayout2" 
android:layout_width="0dp"                   
android:layout_height="match_parent"
android:layout_weight="1"  
android:orientation="vertical">                   

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">


<ImageView
android:id="@+id/flag"
android:layout_width="match_parent"
android:layout_height="280dp"
android:scaleType="centerCrop"
android:src="@drawable/img" />


<LinearLayout
android:id="@+id/lnrl1"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginTop="200dp"
android:alpha=".8" 
android:background="#4266A1"                           
android:orientation="vertical">

<TextView
android:id="@+id/tvdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="18dp"
android:textColor="@color/textColorPrimary"
android:textSize="15dp" />

<TextView
android:id="@+id/tvcmp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="@color/textColorPrimary"
android:textSize="17dp" />


</LinearLayout>


<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="@color/listviewbackground">

<LinearLayout
android:id="@+id/LinearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">


<Button
android:id="@+id/btndownload"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Left Button"
android:textColor="@color/textColorPrimary"
android:textStyle="bold"
android:visibility="gone" />


<Button
android:id="@+id/btnEdit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Right Button"
android:textColor="@color/textColorPrimary"
android:textStyle="bold"
android:visibility="gone" />

</LinearLayout>


</RelativeLayout>


<LinearLayout
android:id="@+id/lnraddr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/flag"
android:orientation="horizontal">


<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="@color/windowBackground"
android:orientation="vertical">

<TextView
android:id="@+id/tvaddr1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textColor="@color/appgry"
android:textSize="15dp" />

<TextView
android:id="@+id/tvaddr2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textColor="@color/appgry"
android:textSize="15dp" />

<TextView
android:id="@+id/tvfulcty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textColor="@color/appgry"
android:textSize="15dp" />


</LinearLayout>

<View
android:layout_width="2px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/listviewbackground" />


<LinearLayout
android:id="@+id/img_loc"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.50"
android:background="@color/windowBackground"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical">


</LinearLayout>


</LinearLayout>

<View
android:layout_width="fill_parent"
android:layout_height="2px"
android:layout_below="@+id/lnraddr"
android:background="@color/listviewbackground" />


<TextView
android:id="@+id/tvdetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/lnraddr"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="60dp"
android:textColor="@color/appgry"
android:textSize="17dp" />


</RelativeLayout>


</LinearLayout>

</LinearLayout>
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/material_design_android_floating_action_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="bottom"
android:layout_marginBottom="11dp"
android:layout_marginLeft="11dp"
android:layout_marginRight="11dp"
fab:menu_animationDelayPerItem="55"
fab:menu_backgroundColor="@android:color/transparent"
fab:menu_buttonSpacing="0dp"
fab:menu_colorNormal="@color/btnPending"
fab:menu_colorPressed="@color/btnPending"
fab:menu_colorRipple="#99d4d4d4"                
fab:menu_fab_size="normal"
fab:menu_icon="@drawable/fab_add"
fab:menu_labels_colorNormal="#333"
fab:menu_labels_colorPressed="#444"
fab:menu_labels_colorRipple="#66efecec"
fab:menu_labels_cornerRadius="3dp"
fab:menu_labels_ellipsize="none"
fab:menu_labels_hideAnimation="@anim/fab_slide_out_to_left"
fab:menu_labels_margin="0dp"                 
fab:menu_labels_maxLines="-1"
fab:menu_labels_padding="8dp"                 
fab:menu_labels_position="right"
fab:menu_labels_showAnimation="@anim/fab_slide_in_from_left"
fab:menu_labels_showShadow="false"
fab:menu_labels_singleLine="false"
fab:menu_labels_textColor="#f2f1f1"
fab:menu_labels_textSize="15sp"                 
fab:menu_openDirection="up"
fab:menu_shadowColor="#66aff198"                 
fab:menu_shadowRadius="4dp"
fab:menu_shadowXOffset="1dp"                 
fab:menu_shadowYOffset="4dp"
fab:menu_showShadow="false">

<com.github.clans.fab.FloatingActionButton
android:id="@+id/material_design_floating_action_menu_item1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_burger"                     
fab:fab_label="Menu Item1"                     
fab:fab_size="mini" />

<com.github.clans.fab.FloatingActionButton
android:id="@+id/material_design_floating_action_menu_item2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_camera"                     
fab:fab_label="Menu Item2"                     
fab:fab_size="mini" />

<com.github.clans.fab.FloatingActionButton
android:id="@+id/material_design_floating_action_menu_item3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_burger_blue"                     
fab:fab_label="MenuItem 3"                     
fab:fab_size="mini" />
</com.github.clans.fab.FloatingActionMenu>

</FrameLayout>


</RelativeLayout>
4

0 回答 0