Cannot Instant Run: legacy multi-dex on Dalvik runtime

2.6k views Asked by At

When I ran my app, it said that

Cannot Instant Run: legacy multi-dex on Dalvik runtime

Does it means that I can't use Instant Run when I use multi-dex?

I'm using Android Studio beta4.

3

There are 3 answers

1
Rajeev On

Just remove this line from your ProjectName/app/build.gradle

android { defaultConfig { multiDexEnabled true } }

remove multiDexEnabled true and you will able to instant run.

0
Kruti Parekh On

As mentioned in the documentation Instant Run is disabled by Android Studio in case multidex is enabled for API level 20 or lower and app is deployed on API level 20 or lower.

Documentation link

4
Tieru On

In order to activate multiDex at old android versions you have to set multiDexEnabled to true, add dependency and extend your application class from MultiDexApplication or launch MultiDex.install(this) in your application class, which will cause legacy multiDex installation.

However since Intant Run can't work with legacy multiDex you have to use normal one. All you need is removing all that code above except of multiDexEnabled flag set to true. This method is only supported by devices with API 21 and above.

Feel free to correct me if something is wrong.