Android NoClassDefFoundError crash after new couchbase Lite Jars added - android

The the same crash happened after I imported Couchbase Lite Android using either Gradle or jars.
Couldn't really figure out what's going on here as I didn't touch the code and only dropped the jars into the "libs" folder.
// inside Custom Application class
#Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics()); // <===== Crash here!
}
Trace:
07-07 19:37:43.785 15247-15247/? E/AndroidRuntime﹕
FATAL EXCEPTION: main
Process: sg.com.bigspoon.www, PID: 15247
java.lang.NoClassDefFoundError: io.fabric.sdk.android.services.common.ExecutorUtils
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:202)
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:197)
at sg.com.bigspoon.www.data.BigSpoon.onCreate(BigSpoon.java:121)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4541)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
at dalvik.system.NativeStart.main(Native Method)
EDIT:
Although this is "fixed". But it is still very bizarre why this is happening. I would enlighten me and I would mark it as correct answer instead.

This is solved by enabling multiDex in build.gradle
android {
defaultConfig {
// Lower than 14 doesn't support multidex
minSdkVersion 14
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
SOURCE and more details -->
https://github.com/chrisjenx/Calligraphy/issues/136
https://developer.android.com/tools/building/multidex.html

Related

Android Fabric crashlytics issue

After adding the fabric crashlytics i'm getting error as no class definition found error for MultiPartBuildEntry in android 4.4
java.lang.NoClassDefFoundError: org.apache.http.entity.mime.MultipartEntityBuilder
at clovewearable.commons.social.server.SignUpService.generateMultiPartPayload(SignUpService.java:171)
at clovewearable.commons.social.server.SignUpService.triggerAPICall(SignUpService.java:110)
at clovewearable.commons.social.ui.SignUpFragment.triggerAPICall(SignUpFragment.java:585)
at clovewearable.commons.social.ui.SignUpFragment.validateNormalSignIn(SignUpFragment.java:388)
at clovewearable.commons.social.ui.SignUpFragment.onClick(SignUpFragment.java:427)
at android.view.View.performClick(View.java:4640)
at android.view.View$PerformClick.run(View.java:19421)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5476)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
your Application.class should be extended from MultiDexApplication
For that you should add such code in you gradle
android {
defaultConfig {
...
multiDexEnabled true
}
dependencies {
...
compile 'com.android.support:multidex:1.0.2'
}
To initialize the fabric inside a class we have to start the fabric catalyst.
Use the following line inside onCreate to initialize fabric:
Fabric.with(this, new Crashlytics());

java.lang.VerifyError: com/adobe/creativesdk/aviary/internal/account/BillingContentFactory

I am new to adobe creative SDK for android, I have integrated adobe creative SDK with my application successfully. Its running successfully on Android 5.0 and up.
But when tried to run on 4.0, 4.1, 4.4, 4.4.2 and 4.4.4 it gives error like :-
java.lang.VerifyError: com/adobe/creativesdk/aviary/internal/account/BillingContentFactory
at com.adobe.creativesdk.aviary.AdobeImageBillingService.<init>(AdobeImageBillingService.java:41)
at com.adobe.creativesdk.aviary.AdobeImageBillingService.getInstance(AdobeImageBillingService.java:220)
at com.adobe.creativesdk.aviary.internal.account.AdobeAccountConnection.<init>(AdobeAccountConnection.java:31)
at com.adobe.creativesdk.aviary.AdobeImageEditorActivityAbstract.createAdobeAccountConnection(AdobeImageEditorActivityAbstract.java:552)
at com.adobe.creativesdk.aviary.AdobeImageEditorActivityAbstract.onCreate(AdobeImageEditorActivityAbstract.java:535)
at com.adobe.creativesdk.aviary.AdobeImageEditorActivity.onCreate(AdobeImageEditorActivity.java:29)
at android.app.Activity.performCreate(Activity.java:5447)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2393)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2493)
at android.app.ActivityThread.access$800(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5590)
at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1280)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1096)
at dalvik.system.NativeStart.main(Native Method)
Any help will be great.
I am facing the same issue regarding Creative SDK, but I resolved same with the use of multidex. Please below steps for solving this error.
Enable Multidex and add gradel support to your app level gradel file
defaultConfig {
multiDexEnabled true
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
Now initialize Multidex at application level
#Override
public void onCreate() {
MultiDex.install(this);
}
This solution works for me, I hope this will help you also.

Why I can't build app with for a lower Android version?

I use Android Studio, with SDK version 23 in the beginning to code and build app and everything is running ok. But the app only work on cellphone will android 5.0 and above.
I want to make a new version for Andriod 4.4. So I download SDK 19 in Android Studio, And then click app -> open modules settings -> flavours -> miniSdkversion to be 19. Can compile, but don't work when run and get the follow errors.
Then I also set targetSDK Version to be 19. the same, Get the following error:
29 20:17:44.698 3699-3699/com.hanjing.flocking E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1307]: 1874 cannot locate 'rand'...
at java.lang.Runtime.loadLibrary(Runtime.java:370)
at java.lang.System.loadLibrary(System.java:535)
at com.example.mac.flocking.MainActivity.<clinit>(MainActivity.java:37)
at java.lang.Class.newInstanceImpl(Native Method) 
at java.lang.Class.newInstance(Class.java:1319) 
at android.app.Instrumentation.newActivity(Instrumentation.java:1068) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) 
at android.app.ActivityThread.access$700(ActivityThread.java:140) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4921) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) 
at dalvik.system.NativeStart.main(Native Method) 
If I also set compile version and the buildtool version to be 19, errors show when compile.
So I don't really know what I should do. I just want to make a new version which can run on a lower Android cellphone.
Pls help! Thank you very much!
Jing
This is the build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Check for the error:
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1307]: 1874 cannot locate 'rand'...
Do you use any code which is not available in a lower android version?

google GCM android crashes ( java.lang.NoClassDefFoundError: com.google.android.gms.R$string )

I am developing an app using the Google GCM service and it seems to be crashing on all pre-lollipop devices at Launch.. I Have followed google tutorial... and its working on lollipop and marshmallow
here are my project level dependencies
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:1.5.0'
}
I have this in my app level gradle file
compile 'com.google.android.gms:play-services:8.4.0'
and this
apply plugin: 'com.google.gms.google-services'
I have also setup android manifest.. and service classes accordingly and receiving GCM on marshmallow device.
I am having this error.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: itcurves.driver, PID: 12788
java.lang.NoClassDefFoundError: com.google.android.gms.R$string
at com.google.android.gms.measurement.zza.<init>(Unknown Source)
at com.google.android.gms.measurement.zza.zzaR(Unknown Source)
at com.google.android.gms.measurement.internal.zzn.zziJ(Unknown Source)
at com.google.android.gms.measurement.internal.zzz.zza(Unknown Source)
at com.google.android.gms.measurement.internal.zzw.<init>(Unknown Source)
at com.google.android.gms.measurement.internal.zzaa.zzDj(Unknown Source)
at com.google.android.gms.measurement.internal.zzw.zzaT(Unknown Source)
at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
at android.app.ActivityThread.installProvider(ActivityThread.java:4889)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4476)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4413)
at android.app.ActivityThread.access$1500(ActivityThread.java:142)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1263)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5120)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
I had same problem.You are probably facing it on devices prior 5.0 version.The reason why this happen is that version prior to android 5.0 use Dalvik and by default, Dalvik limits apps to a single classes.dex bytecode file per APK.The solution is to use multidex support.
Include in your build.gradle dependencies this:
compile 'com.android.support:multidex:1.0.0'
public class MyApp extends MultiDexApplication {
#Override
public void onCreate() {
super.onCreate();
}
}
than in your Manifest add MultiDexApplication class
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name=".MyApp">
...
</application>
</manifest>
Note: If you already have your application class just extend it with MultiDexApplication class

NoClassDefFoundError when trying to build google api client

today i added the google play services library to my project. I have followed the instructions which are given on http://developer.android.com/google/play-services/setup.html#ensure
Screenshot of my Settings: https://drive.google.com/file/d/0Bwe9sI6XZ6rcZGZzdmlaQjVheDA/edit?usp=sharing
The problem is when I try to execute the following code, a noclassdeffounderror exception raises.
public class MainActivity extends Activity {
private GoogleApiClient mGoogleClient;
#Override
protected void onCreate(Bundle savedInstanceState) {
mGoogleClient = new GoogleApiClient.Builder(this)
.addApi(Games.API)
.addScope(Games.SCOPE_GAMES)
.setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL)
.build();
In the logcat the exception looks like
threadid=1: thread exiting with uncaught exception (group=0x40d02930)
FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.gms.common.api.GoogleApiClient$Builder
at com.gmail.mhofer4991.at.taptorotate.MainActivity.onCreate(MainActivity.java:104)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2147)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$600(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5074)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Force finishing activity com.example.taptorotate/com.gmail.mhofer4991.at.taptorotate.MainActivity
I also have cleaned and rebuilt the project.
It's driving me crazy that i cannot solve the problem. I know there are already other threads with the same topic and I also tried some solutions which were suggested there but none of them worked for me. Please help me out!
I also had same problem,
java.lang.NoClassDefFoundError:
com.google.android.gms.common.api.GoogleApiClient$Builder
I was using the below dependency on the application build.gradle file.
compile 'com.google.android.gms:play-services:7.8.0'
I changed it to
compile 'com.google.android.gms:play-services-plus:7.8.0'
I updated the Google Play Services (Rev 26) and Google Repository(Rev 20).
After that the exception doesn't occur.
Try to use individual APIs and corresponding build.gradle descriptions as mensioned in the following page,
https://developers.google.com/android/guides/setup#ensure
Try to add obfuscation rules for the Google API's if you have minifyEnabled or ProGuard set to true:
ProGuard Configuration
tryin to work with an implementation of Google Drive in Android i´ve found this error message pointing some classes like:
java.lang.ClassNotFoundException: com.google.android.gms.common.api.Scope
Caused by: java.lang.ClassNotFoundException: Didn't find class
I have found that the real problem is the limit of 64K references when we add dependencies related to GoogleApiClient, so adding multidex support solved my problem:
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
...
...
multiDexEnabled true
}
...
...

Categories

Resources