2

I am getting java.lang.NoClassDefFoundError runtime error, when I run the app on pre-lollipop device. This works perfectly on lollipop device.

This error happens, if in runtime any class method does not found. This may be due missing jar or wrong classpath. But in my case, the same apk works well on lollipop devices and does not work on pre-lollipop device. Any clue, what is wrong?

I have enabled multidex support for the project, using AndroidStudio 2.1, gradle 2.1.0

Annada
  • 1,075
  • 1
  • 18
  • 21
  • 1
    I managed to resolve this issue, by modifying multidex code like below by calling MultiDex.install after super.onCreate public void onCreate(Bundle arguments) { super.onCreate(arguments); MultiDex.install(getTargetContext()); } The code was like below, was not working for pre-lollipop device, but it was working on lollipop device public void onCreate(Bundle arguments) { MultiDex.install(getTargetContext()); super.onCreate(arguments); } Which is correct implementation? – Annada May 10 '16 at 19:28
  • [Multidex documentation](http://developer.android.com/tools/building/multidex.html) explains it in detail (in addition to a tons of similar questions on SO). You can also check my [answer here](http://stackoverflow.com/q/15209831/26196397#26196397). Does it help? – Alex Lipov May 11 '16 at 08:40

0 Answers0