Support Topics Documentation Slack YouTube Blog

java.lang.NoClassDefFoundError: weborb.types.Types

I’m having the same problem as here, but solution from those topic not worked for me.
In my app i’m using Backendless, Google Analytics and some UI libraries. There was problem to build app, but it solved by adding “multiDexEnabled true” into build.gradle file.
When i add another libraries (from ad networks, another 8 *.jar files), which have dependencies from play-services-ads, i get exception when call Backendless.initApp(…);


Caused by: java.lang.NoClassDefFoundError: weborb.types.Types
    at com.backendless.UserService.<init>(UserService.java:56)
     at com.backendless.UserService.<clinit>(UserService.java:47)
    at com.backendless.Backendless.<clinit>(Backendless.java:42) 
    at com.mypackage.activity.MyActivity.onCreate(MyActivity.java:36) 

I found out that problem not directly from play-service, seems it happens when there are too many libraries in project.
For example, when i’m add 5 more *.jar files (one of them add play-services-ads dependence), app works. But when i add 6 app crash. And there is no differense which library i add.

What can i do? I’m already use only those parts of libraries that i need. I can send you my project and *.jar libraries to reproduce issue.


...
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
...

Please zip up your project and upload to Google Drive or Dropbox and send link to file to support@backendless.com

Ready, i send you email.

Thanks, we received the email. A ticket has been assigned to a developer

Hi Ranzed,
Try adding this to your android closure in your build.gradle file:

dexOptions {
    javaMaxHeapSize "4g"
}

Let us know if it fixes the problem.

Hi Mark.
Without this statement project build fails with “java.lang.OutOfMemoryError: GC overhead limit exceeded”, i wrote it in email.

Adding this statement does not fix the problem (project successfully builds and after launch app crash with described exception).

Hi Ranzeed,

The problem is not really related to Backendless. It occurs when there are a lot of libraries and frameworks in the project. Here’s a related discussion on stackoverflow:

Regards,
Mark

There’s a working answer in http://support.backendless.com/t/java-lang-noclassdeffounderror-weborb-types-types-and-java-lang-exceptionininitializererror

(just for all that arrive to this thread in first place, xD )