我有一个评级栏类如下。
class Rating extends FieldAndroid {
@Override
public String register() {
return register("rating");
}
@Override
protected Object createControl() {
LinearLayout layout = new LinearLayout(getContext());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
final RatingBar ratingBar = new android.widget.RatingBar(getContext());
ratingBar.setStepSize((float) 1.0);
if (getEditable())
ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar, float rating,
boolean fromUser) {
ratingBar.setRating(rating);
}
});
layout.addView(ratingBar, params);
return layout;
}
当我安装apk时,通过在任何模拟器中运行,它工作得很好。但是当我使用我的密钥库生成签名的apk时,我的评级栏不会显示。
你知道可能出现什么问题吗?
答案 0 :(得分:1)
打开 proguard-rules.pro
添加
-keep class * {
public private *;
}
<强> FYI 强>
如果您想添加 Rating
类,那么
-keep public class yourPackage.Rating
然后 Clean-Rebuild-Run
。
注意强>
如果您设置 minifyEnabled false
buildTypes {
release {
minifyEnabled false