Android FloatingActionButton is suddenly transparent only to build ProGuard

After upgrading my AppCompat library to 25, when I create a release using proguard, all of my FloatingActionButton backgrounds are transparent. When I build a debug assembly without proguard, it is painted, as it should be.

Markup

<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 have no references to AppCompat in my proguard configuration.

UPDATE

I just tried another of my projects and it has the same problem. The problem seems to be related to updating Android Studio to version 2.3 Canary.

+5
source share
2 answers

I found and fixed the problem.

As indicated in my update, the problem started when I upgraded to Android Studio 2.3 Canary. When this update is updated, my tools for building android to 2.3 alhpa. I changed it to

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

and now fab is just as it should be.

To clarify that I'm still on Android Studio 2.3 Canary, I just did not update the Android build tools.

+4
source

Try replacing backgroundTint with background here is an example that shows the difference between background and background.

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"/> 
0
source

Source: https://habr.com/ru/post/1259741/


All Articles