FloatingActionButton与小吃吧和CoordinatorLayout不会与proguard的工作
问题描述:
这简单的代码将不工作打算使用ProGuard启用:FloatingActionButton与小吃吧和CoordinatorLayout不会与proguard的工作
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/show"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="40dp"
android:text="Show snackbar" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@drawable/ic_save_white_24dp"
app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout>
希望的行为具有FloatingActionButton
被推过SnackBar
时被示出,但它不会发生,直到我禁用proguard。
没有教程还介绍本作的新项目已经proguard的默认禁用)
有谁知道设计支持库ProGuard的配置?
答
试试这个:
# support design
-dontwarn android.support.design.**
-keep class android.support.design.** { *; }
-keep interface android.support.design.** { *; }
-keep public class android.support.design.R$* { *; }
答
谷歌已经固定在AAR嵌入式的ProGuard配置这个bug。 只需将build.gradle中的设计库依赖关系更新为23+。
这不适合我。请检查这个问题[启用Proguard文件后默认主题不工作](http://stackoverflow.com/questions/35340610/default-theme-is-not-working-after-enable-proguard-fileminifyenabled-true) –