我已經在佈局文件中實現gooeymenu預防:怎樣的ProGuard從剝離陣列
<com.mschwartz.dailyflightbuddy.ui.GooeyMenu
android:id="@+id/gooeymenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@id/btn_text_cockpit"
android:layout_centerInParent="true"
android:alpha="0.8"
app:center_drawable="@drawable/ic_settings_white_48dp"
app:hide_on_start="true"
app:itemorientation="LEFT"
app:menu_reference="@array/gooeymenu_command_array" />
的menu_reference
標籤指向文件res/values/array.xml
,內容如下:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="gooeymenu_command_array">
<item>@drawable/gooey_info_item</item>
<item>@drawable/gooey_zoom_item</item>
<item>@drawable/gooey_center_item</item>
<item>@drawable/gooey_city_item</item>
<item>@drawable/gooey_airport_item</item>
<item>@drawable/gooey_configure_item</item>
</array>
</resources>
在運行時調試器一切正常,但從剝離的生產版本運行時,gooeymenu不顯示任何項目。
我曾嘗試幾個命令添加到proguard-rules.pro
包括以下內容:
-keepclassmembers class com.mschwartz.dailyflightbuddy.R$array {
*;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
但沒有到目前爲止任何運氣。所以我的問題是:
- 我如何可以驗證該領域確實已經從 生產APK剝離或我怎麼能保證如果包括字段(或更常見的一類/方法)?
- 如何命令proguard添加字段?