当我将versionCode
设置为2时,应用仍会将其报告为1。
当我将versionCode
设置为3时,应用会检测到该问题。
alo 5,6但没有设置:
defaultConfig {
versionCode 2
不使用数字2,我已经清理了项目并重建但结果仍然相同。
我错过了什么?
我想检测一下使用此Firebase代码发布新应用版本的时间:请注意,我在Android Studio的调试中运行此版本
ValueEventListener systemListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
App app = dataSnapshot.getValue(App.class);
if (app.getVersionCode() > BuildConfig.VERSION_CODE) {
SettingsManager.setForceAppUpdate(true);
for (OnForceAppUpdateListener l : Application.getInstance()
.getUIListeners(OnForceAppUpdateListener.class))
l.onForceAppUpdate();
} else { // TODO for testing
SettingsManager.setForceAppUpdate(false);
for (OnForceAppUpdateListener l : Application.getInstance()
.getUIListeners(OnForceAppUpdateListener.class))
l.onForceAppUpdate();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
当我从versionCode 1转到versionCode 2时,我不是上面的BuildConfig.VERSION_CODE
是1
我也试试这个:
Application.getInstance().getPackageManager()
.getPackageInfo(Application.getInstance()
.getPackageName(), 0).versionCode;
同样为versionCode返回1
答案 0 :(得分:0)
你的问题不明确,但我会回答。您认为每个用户在发布新版本时都会更新其应用,但其中一些用户不会更新。旧版本用户报告错误等旧版本。
答案 1 :(得分:0)
答案不是在Build.Gradle文件中的注释
像这样:在删除评论时,它们都按预期工作了nonlocal
答案 2 :(得分:0)
我已经检查过我们不应该在Gradle配置文件中的内联注释中添加双引号。
例如:
public class StakePoolButton extends LinearLayout { //button used for both the stake and pool fragments.
private TextView buttonText;
private LinearLayout stakePoolBackground;
private Context context;
boolean stake; //false means pool
private Typeface font;
public StakePoolButton(Context context) {
super(context);
init(context);
}
public StakePoolButton(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context);
}
public StakePoolButton(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
public void init(Context context){
LayoutInflater.from(getContext()).inflate(
R.layout.pool_layout, this);
this.context = context;
this.font = Typeface.createFromAsset(context.getAssets(), "fonts/Cabin_Regular.ttf");
buttonText = findViewById(R.id.stakepool_name);
buttonText.setTypeface(font);
stakePoolBackground = findViewById(R.id.stakepool_background);
}
public void setData(Pool pool){
buttonText.setText(pool.code);
this.stake = false;
}
public void setData(Stake stake){
buttonText.setText(String.valueOf("£" + stake.getStake()));
this.stake = true;
}
是错误的并且在代码中读为1(如果使用2正确生成BuildConfig文件则无关紧要),但是:
buildConfigField "int", "DATABASE_VERSION", "2" // remember to update "repo/docs/sqlite-versions.md"
是正确的,在代码中读为2
INSANE