I'm Running into a NoClassDefFoundError on Android 4.4, 4.3, and 4.2. I've tried all day to fix it to no avail. I've tried changing the targetSdkVersion, Parse version, importing the Parse library with a jar instead of Gradle, and cleaning and rebuilding the project. Everything works on Android 5.0 and up.
I'm using Parse version 1.12.0
CompileSdkVersion 23
buildToolsVersion 23.0.2
minSdkVersion 17
targetSdkVersion 23
Here is my stack trace. It crashes on the first attempt to register a subclass of ParseObject.
01-13 12:18:26.500 1347-1347/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.parse.ParseObject$1
at com.parse.ParseObject.<clinit>(ParseObject.java:316)
at com.company.myapp.utils.Application.onCreate(PensterApplication.java:36)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4444)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Here is the Application class where it crashes. I've altered the class names to post online here
public class myApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(this);
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Parse classes that need registering
ParseObject.registerSubclass(aaa.class); //error happens here
ParseObject.registerSubclass(bbb.class);
ParseObject.registerSubclass(ccc.class);
ParseObject.registerSubclass(ddd.class);
ParseObject.registerSubclass(eee.class);
ParseObject.registerSubclass(fff.class);
ParseObject.registerSubclass(ggg.class);
ParseObject.registerSubclass(hhh.class);
ParseObject.registerSubclass(iii.class);
ParseObject.registerSubclass(jjj.class);
Parse.initialize(this, PARSE_APPLICATION_ID, PARSE_CLIENT_KEY);
//set a default acl so that default is not public read.write
if (ParseUser.getCurrentUser() != null) {
ParseACL defaultACL = new ParseACL(ParseUser.getCurrentUser());
defaultACL.setPublicReadAccess(false);
defaultACL.setPublicWriteAccess(false);
ParseACL.setDefaultACL(defaultACL, true);
}
// Save this installation
ParseInstallation.getCurrentInstallation().saveInBackground();
ParseFacebookUtils.initialize(this);
ParseTwitterUtils.initialize(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET);
}
}
Any idea what's going wrong would be much appreciated.