5

After updating my AppCompat library to 25 when I build release with proguard all of my FloatingActionButton backgrounds are transparent. When i build a debug build without proguard it is colored like it should be.

Layout

 <android.support.design.widget.FloatingActionButton
    android:id="@+id/fab_upload"
    android:visibility="gone"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    app:layout_anchor="@id/content_frame"
    app:layout_anchorGravity="bottom|right|end"
    app:borderWidth="0dp"
    android:src="@drawable/app_fab_upload"
    android:layout_margin="@dimen/big_padding"
    android:clickable="true"
    app:backgroundTint="@color/fab_social"/>

Gradle

compileSdkVersion = 25
buildToolsVersion = '25.0.0'
supportLibVersion = '25.0.0'

supportLibAppCompat = "com.android.support:appcompat-v7:$supportLibVersion"
supportLibCardView = "com.android.support:cardview-v7:$supportLibVersion"
supportLibRecyclerView = "com.android.support:recyclerview-v7:$supportLibVersion"
supportLibDesign = "com.android.support:design:$supportLibVersion"
supportLibPalette = "com.android.support:palette-v7:$supportLibVersion"
supportLibPercent = "com.android.support:percent:$supportLibVersion"

I don't have any references to AppCompat in my proguard config.

UPDATE

I just tried another one of my projects and it has the same issue. The issue seems to stem from updating Android Studio to 2.3 Canary build.

BigDX
  • 3,519
  • 5
  • 38
  • 52

2 Answers2

4

I have found and fixed the issue.

As stated in my update above the issue started when I updated to Android Studio 2.3 Canary. When doing that is updated my android build tools to 2.3 alhpa. I changed it back to

classpath 'com.android.tools.build:gradle:2.2.2'

and now the fab is as it should be.

To clarify I am still on Android Studio 2.3 Canary, I just did not update the android build tools.

BigDX
  • 3,519
  • 5
  • 38
  • 52
0

Try to replace backgroundTint to backgroundhere is an example which show the difference between background tint and background example.

So your code will be

<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_upload"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:layout_anchor="@id/content_frame"
app:layout_anchorGravity="bottom|right|end"
app:borderWidth="0dp"
android:src="@drawable/app_fab_upload"
android:layout_margin="@dimen/big_padding"
android:clickable="true"
android:background="@color/fab_social"/>
Community
  • 1
  • 1
Neelay Srivastava
  • 1,041
  • 3
  • 15
  • 46