Signed APK: Crash [INSTALL_FAILED_DEXOPT] .. Updated

the created "app-release.apk" ... does not work on my application, but "app-debug.apk" works fine,

Update:

after switching to the previous version of my application:

in my MainActivity I have the following lines:

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

After deleting lines 1 to 107 (teamNames, teamOpponent, teamdate) from this operation, the application worked fine on my device

to explain more, my MainActivity become:

 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 the lines?

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

 Failure [INSTALL_FAILED_DEXOPT] 

When I try to install on devation to 'build variant: release', I got the following:

enter image description here

Installation error, because the device may have outdated jix banks that do not match the current version (dexopt error). To continue, you must uninstall the existing application. WARNING: Deletion will delete the application data! Do you want to delete an existing application?

in OK or cancel I received:

 Failure [INSTALL_FAILED_DEXOPT] 

NB: everything is fine on the emulator

+4
android android-studio gradle apk
source share
4 answers

If you are using an emulator, close the emulator. Launch AVD Manager and wipe the emulator data by clicking the edit button. In Android Studio, you can easily erase the emulator by right-clicking on the emulator. enter image description here

If it is in your real device. Then go to Settings → Applications → Then find your application and do 2 things.

  • Clear data
  • Delete

enter image description here

Now run the application. It should work.

+3
source share

You should add this plugin to the top of build.gradle

 apply plugin: 'com.android.application' 

As a first step, if you want to sign your application with your key, you must add this key to the assembly types, as shown below:

 buildTypes { release { signingConfig android.signingConfigs.config } } 

As the second you use empty productFlavors , you do not need it, please delete it.

When you make this call to the assembleRelease task form console method:

 ./gradlew task assembleRelease 

You will have an apk file in {your_project}/{your_module[propadbly apk]}/build/outputs/apk/

And as a last resort, you will be sure to use the correct key. Your magazines say:

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

this means that the key does not exist or you are mistaken in your configuration

+2
source share

in build.gradle compile and build to the latest version. and it worked for me.

=================

 android { compileSdkVersion 22 buildToolsVersion "22" 
+1
source share

Try uninstalling the application using adb . For example: adb uninstall <package_name> . Have you tried this with other phones?

+1
source share

All Articles