Hi, guys:
I got an issue when upgrade realm from 1.0.1 to 1.1.0 and choose run button in Android Studio 2.1.2(app running perfect with 1.0.1):
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.
errors in AS run history:
Failure [INSTALL_FAILED_DEXOPT]
After uninstall the existing app, AS ask to uninstall existing app again(the app has already uninstalled), and got another error _DELETE_FAILED_INTERNAL_ERROR_
This uninstall dialog appears every time when running app and got the same error _INSTALL_FAILED_DEXOPT_
When I back to realm 1.0.1 and sync the project, the app running perfect.
I have tried to _clean the project_, or _delete all build directory_, or _invalidate caches/restart AS_, but can not fix it.
is there any other advice?
Thanks!
Realm version(s): 1.1.0
Android Studio version: 2.1.2
Which Android version and device: Samsung Note3, Android 5.0

Hi @HsiangLeekwok,
I think this might not be a Realm specific issue. In case you are facing an issue with upgrading, here are few tips I can suggest.
adb rm -rf /data/data/<package path> command.Then see if this issue persists.
Sorry @stk1m1
I have tried to do all your steps(as i said in my issue), and I also try to enable/disable multidex in build.gradle, but still has not effects.
Thanks a lot!
internal note: relevant apk can be found at https://secure.helpscout.net/conversation/223136058/5190/?folderId=366141
Hi @HsiangLeekwok
The apk works fine with me. It asks three permissions and then shows a splash screen. It then moves to login page.
internal notes: more information(gradle logs,proxy source code) https://secure.helpscout.net/conversation/223218504/5196/?folderId=366141
Hi @HsiangLeekwok
I've sent you a feedback. Could you please check if it works out? We'll keep looking into this. Thanks!
Hi, @stk1m1
Sorry to reply you too late.
I have tried to follow your steps and add command line "dex.force.jumbo=true", the error still exist.
And:
Again:
@HsiangLeekwok
We've tested your apk on following devices and they all generated INSTALL_FAILED_DEXOPT.
On Samsung device with Android 6.0, this issue does not appear. I can only say this is very much a device + version specific issue at this point. We are still looking into it and see what's the root cause of it. Meanwhile, I'd suggest to reduce the field for now. Thanks!
Thanks!
@HsiangLeekwok
Could you please make a small sample project (with code) that produces the same error you've experienced? We are trying to generate same issue with our examples but it has not been successful. I'd really appreciate it.
Hi, @stk1m1
This is the sample project:
https://github.com/HsiangLeekwok/Realm110FailedDexopt
I created a class which has 79 fields(in models/TempClass.class), and it is definitely install failed with error INSTALL_FAILED_DEXOPT on Samsung Galaxy Note3
@HsiangLeekwok
Thanks for the sample. We'll look into it!
I'm moving this to P2 as it requires more investigation.
Internal Note
dex2oat issue testing is summarized here in wiki.
what happened at last? I have same issue, What is the solution?
@AmirMehr
Let your properties count less than 64(or 62) would be ok(Samsung devices).
Closing as this is a device specific issue, that can only be solved by reducing the number of properties in the class.
targetSdkVersion 22//17==========================> set this number less then or equal to the version of Android OS on devices might help
defaultConfig {
applicationId "software.nhut.personalutilitiesforlife"
minSdkVersion 16
targetSdkVersion 22//17==========================> set this number less then or equal to the version of Android OS on devices might help
versionCode 5
versionName "1.26"
// Enabling multidex support.
multiDexEnabled true
}
I saw how much space the emulator had and was almost nothing so I deleted some apps and with this, my problem was resolved.!!
Ah yeah you can actually change the amount of space available for the poor Emulator device in the Emulator settings. It starts out with 800 MB I think which is maxed out by absolutely nothing.
dex2oat issue testing is summarized here in wiki.
Hi @stk1m1 we're having the same issue with Android 5.0 devices and Kotlin coroutines update.
Could you please share dex2oat investigation? The link is not working anymore...
Most helpful comment
Ah yeah you can actually change the amount of space available for the poor Emulator device in the Emulator settings. It starts out with 800 MB I think which is maxed out by absolutely nothing.