使用proguard混淆后,CardView阴影不会出现在Lollipop中

Ign*_*asi 5 android proguard android-cardview

应用Proguard后,我的CardView阴影在Lollipop设备上消失了.我没有定义任何保护这个库的规则,因为我没有阅读它是必要的.

我附上了几个屏幕截图,首先是没有运行proguard,然后是运行后的secon.

屏幕截图没有proguard

带有proguard的屏幕截图

这是我的xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin"
            android:paddingBottom="@dimen/activity_vertical_margin"
            tools:context=".MainActivity">

    <android.support.v7.widget.CardView
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_margin="4dp"
        app:contentPadding="10dp"
        app:cardUseCompatPadding="true">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Text 1"/>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_margin="4dp"
        app:contentPadding="10dp"
        app:cardUseCompatPadding="false">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Text 2"/>
    </android.support.v7.widget.CardView>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

Activity仅将xml设置为内容,不再执行任何操作.正如您所看到的,我正在使用两种可能性cardUseCompatPadding,但它并没有解决问题,因为它在此线程中定义.

有谁知道为什么proguard打破我的阴影?

Ign*_*asi 8

在库包中潜水后,我编写了一条规则来保护android.support上的所有内容.**现在我终于保护了android.support.v7.widget.RoundRectDrawable.

因此,如果您遇到麻烦,只需在proguard配置中添加下一条规则:

-keep class android.support.v7.widget.RoundRectDrawable { *; }
Run Code Online (Sandbox Code Playgroud)