gpt4 book ai didi

android - 签署 APK : Failure [INSTALL_FAILED_DEXOPT]. 。更新

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:20:26 26 4
gpt4 key购买 nike

生成的“app-release.apk”……在我的设计中不起作用,但“app-debug.apk”运行良好,

更新:

转到我的应用程序的先前版本后:

在我的 MainActivity 中我有这个字符串:

public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

final String PREFS_NAME = "MyPrefsFile";

SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);

if (settings.getBoolean("my_first_time", true)) {
//the app is being launched for first time, do something

TeamModel pm;
DBHelper db;

String teamNames1= "Los Angeles Lakers";
String teamOpponent1= "Golden State Warriors";
String teamDate1= "2015-03-16 22:30";

String teamNames2= "Atlanta Hawks";
String teamOpponent2= "Sacramento Kings";
String teamDate2= "2015-03-16 20:00";

.
.

String teamNames348= "Charlotte Hornets";
String teamOpponent348= "Utah Jazz";
String teamDate348= "2015-03-16 21:00";


db = new DBHelper(getApplicationContext());
db.getWritableDatabase();
pm = new TeamModel();



pm.teamname= teamNames1;
pm.teamopponent=teamOpponent1;
pm.teamdate= teamDate1;

db.addTeam(pm);

pm.teamname= teamNames2;
pm.teamopponent=teamOpponent2;
pm.teamdate= teamDate2;

db.addTeam(pm);
.
.
pm.teamname= teamNames348;
pm.teamopponent=teamOpponent328;
pm.teamdate= teamDate348;

db.addTeam(pm);

Log.d("Comments", "First time");
settings.edit().putBoolean("my_first_time", false).commit();

从此 Activity 中删除字符串 1 到 107(teamNames、teamOpponent、teamdate)后,应用程序在我的设备上运行良好

为了解释更多,我的 MainActivity 变成了:

public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

final String PREFS_NAME = "MyPrefsFile";

SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);

if (settings.getBoolean("my_first_time", true)) {
//the app is being launched for first time, do something

TeamModel pm;
DBHelper db;

String teamNames107= "Los Angeles Lakers"; !!!
String teamOpponent107= "Golden State Warriors"; !!!
String teamDate107= "2015-03-16 22:30"; !!!

String teamNames108= "Atlanta Hawks";
String teamOpponent108= "Sacramento Kings";
String teamDate108= "2015-03-16 20:00";

.
.

String teamNames348= "Charlotte Hornets";
String teamOpponent348= "Utah Jazz";
String teamDate348= "2015-03-16 21:00";


db = new DBHelper(getApplicationContext());
db.getWritableDatabase();
pm = new TeamModel();



pm.teamname= teamNames107;
pm.teamopponent=teamOpponent107;
pm.teamdate= teamDate107;

db.addTeam(pm);

pm.teamname= teamNames108;
pm.teamopponent=teamOpponent108;
pm.teamdate= teamDate108;

db.addTeam(pm);
.
.
pm.teamname= teamNames348;
pm.teamopponent=teamOpponent328;
pm.teamdate= teamDate348;

db.addTeam(pm);

Log.d("Comments", "First time");
settings.edit().putBoolean("my_first_time", false).commit();

怎么了?我怎样才能在不删除字符串的情况下解决这个问题?

当我尝试通过终端在我的设备上安装 app-release.apk 时我的错误日志:

Failure [INSTALL_FAILED_DEXOPT]  

当我尝试在“build variant: release”的设备上安装时,我得到了这个:

enter image description here

Installation failed since the device possibly has stale dexed jars that don't match the current version (dexopt error). In order to proceed, you have to uninstall the existing application. WARNING: Uninstalling will remove the application data! Do you want to uninstall the existing application?

在确定或取消时我得到:

Failure [INSTALL_FAILED_DEXOPT]

注意:在模拟器上一切正常

最佳答案

如果您使用的是模拟器,请关闭模拟器。运行 AVD Manager 并点击编辑按钮删除模拟器的数据。在 android studio 中,您可以通过右键单击模拟器轻松删除模拟器。 enter image description here

如果它在您的真实设备中。然后转到设置>>应用程序>>然后搜索您的应用并做两件事。

  1. 清除数据
  2. 卸载

enter image description here

现在运行您的应用程序。它应该有效。

关于android - 签署 APK : Failure [INSTALL_FAILED_DEXOPT]. 。更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29021837/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com