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

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

问题描述

应用程序,release.apk产生......不工作对我的色器件,但APP-debug.apk工作完美,

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

更新:

Update:

将我的应用程序的previous版本之后:

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?

我的错误日志,当我尝试通过终端设备上安装应用程序,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罐子不符合当前版本(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]

注:在模拟器,一切都很好。

NB: on Emulator everything is fine

推荐答案

您必须在的build.gradle

apply plugin: 'com.android.application'

作为第一个,如果你想签你的钥匙您的应用程序,你应该添加在构建类型此密钥为如下所示:

As first if you want to sign your application by your key you should add this key in build types as is shown below:

buildTypes {
    release {
        signingConfig android.signingConfigs.config

    }
}

在您使用空的第二个 productFlavors 你不需要它,请删除它。

As the second you use empty productFlavors you don't need it please remove it.

当你用的方法做到这一点调用 assembleRelease任务形式控制台:

When you do this call assembleRelease task form console by method:

./gradlew task assembleRelease

您将在 apk文件{your_project} / {your_module [propadbly APK]} /建设/输出/ APK /

和去年你确保你使用正确的密钥。你的日志说:

And as last you make sure that you use proper key. Your logs says:

Failed to read key bbalarmkey from store "/Users/XXXXXXX/key.jks": Keystore was tampered with, or password was incorrect

这意味着该键不存在,或者你做一些错误在你的配置

this mean that the key doesn't exist or you make some wrong in your config

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

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