已签名的 APK:失败 [INSTALL_FAILED_DEXOPT].. 更新 [英] signed APK: Failure [INSTALL_FAILED_DEXOPT].. Updated

查看:31
本文介绍了已签名的 APK:失败 [INSTALL_FAILED_DEXOPT].. 更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

the "app-release.apk" generated ... is not working on my devise, but the "app-debug.apk" is working perfectly,

更新:

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

after going to the previous version of my App:

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

in my MainActivity i have this strings:

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();

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

After deleting Strings 1 to 107 (teamNames, teamOpponent, teamdate) from this Activity the App worked fine on my device

解释更多我的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();

怎么了?如何在不删除字符串的情况下解决此问题?

what's wrong? how can i fix this without deleting Strings?

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

My error log when i try to install app-release.apk on my device by terminal:

Failure [INSTALL_FAILED_DEXOPT]  

当我尝试在构建变体:发布"的设备上安装时,我得到了这个:

When i try to install on the devise on 'build variant: release' i got this:

安装失败,因为设备可能有与当前版本不匹配的过时 dexed jar(dexopt 错误).为了继续,您必须卸载现有的应用程序.警告:卸载将删除应用程序数据!您要卸载现有的应用程序吗?

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]

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

推荐答案

如果您正在使用 Emulator,请关闭模拟器.运行 AVD Manager 并点击编辑按钮擦除模拟器的数据.在 android studio 中,您可以通过右键单击模拟器轻松擦除模拟器.

If you are using Emulator then close the emulator. Run AVD Manager and Wipe data of the emulator clicking on edit button. In android studio you can easily wipe you emulator by right clicking on the emulator.

如果它在您的真实设备中.然后转到设置>>应用程序>>然后搜索您的应用并执行 2 件事.

If it is in your real device. Then go to Settings>>Applications>> Then search your app and do 2 things.

  1. 清除数据
  2. 卸载

现在运行您的应用程序.它应该可以工作.

Now run you application. It should work.

这篇关于已签名的 APK:失败 [INSTALL_FAILED_DEXOPT].. 更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆