Noclassdeffounderror Below Sdk 21

NoClassDefFoundError below SDK 21

I resolved the issue by adding this to my Application Class.

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}

Seems to be neccessary for android versions prior 5.

android ormlite NoClassDefFoundError on Samsung S4 API 21

I found the way to fix this. It should be a multidex issue. When I reduce the number of dependencies, this problem no longer happens.

In the end I changed

compile 'com.google.android.gms:play-services:10.0.1'

to

compile 'com.google.android.gms:play-services-maps:10.0.1'

as I only need maps and kept all other dependencies.

Still not sure why it behaves like this as clearly API 23 and 24 deals with Multidex in a different way from API 22 and below.

Hope this helps anyone with similar problem.

Failed to install android-sdk: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema

I had a similar problem this morning (trying to build for Android using Unity3D). I ended up uninstalling JDK9 and installing Java SE Development Kit 8u144.

  1. brew cask uninstall java # uninstall java9
  2. brew tap homebrew/cask-versions
  3. brew cask install java8 # install java8
  4. touch ~/.android/repositories.cfg # without this file, error will occur on next step
  5. brew install --cask android-sdk

Android java.lang.NoClassDefFoundError

Did you recently updated your eclipse android plugin (adt r17)? Then the following link might help:

How to fix the classdefnotfounderror with adt-17

Update: One year has passed since the question arose. I will keep the link, because even in 2013 it seem to help some people to solve the problem. But please take care what you are doing, see Erics comment below.
Current ADT-Version is 22, I recommend using the most current version.

java.lang.NoClassDefFoundError: android.support.v4.view.LayoutInflaterCompatHC in Android Studio

It looks like you have enabled multidex, but you are not using the multidex library.

Lollipop (API 21) introduced native support for multidexing, but for previous versions of Android you must use the multidex support library to properly support multidexing.

First, add the dependency to your build.gradle:

compile 'com.android.support:multidex:1.0.0'

Second, you need to enable multidex in your application code. If you are not using a custom Application class already, you can do so by registering the MultiDexApplication class in your manifest like so:

<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>

If you are using a custom application class, you should enable multidex in attachBaseContext() like so:

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);

MultiDex.install(this);
}

Source: Building Apps with over 65k Methods



Related Topics



Leave a reply



Submit