Android Fabric crashlytics issue - android

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());

Related

Application crash caused by lazy on API 19

I use singleton object in my app and provide context to it from Application class.
And i use by lazy {} delegate for set sharedPreferences field. It's working on API 21 and higher, but on API 19 i has a NoClassDefFoundError:
08-04 16:20:24.075 5576-5576/ru.maxim.barybians E/AndroidRuntime: FATAL EXCEPTION: main
Process: ru.maxim.barybians, PID: 5576
java.lang.NoClassDefFoundError: ru.maxim.barybians.repository.local.PreferencesManager$sharedPreferences$2
at ru.maxim.barybians.repository.local.PreferencesManager.<clinit>(PreferencesManager.kt:15)
at ru.maxim.barybians.App.onCreate(App.kt:14)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
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:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Singleton object
object PreferencesManager {
lateinit var context: Context
private val sharedPreferences: SharedPreferences by lazy { PreferenceManager.getDefaultSharedPreferences(context) }
App class
class App : Application() {
override fun onCreate() {
super.onCreate()
PreferencesManager.context = applicationContext
}
compileSdkVersion 29
buildToolsVersion "29.0.0"
minSdkVersion 19
targetSdkVersion 29
kotlin_version = '1.3.72'
Gradle Version = 6.1.1
Gradle Plugin Version = 4.0.1
Changing Gradle version or invalidating cache not working for me.
I will be grateful for any help
I finnaly foun the solution. Application crashes because class App inherited from Application. After i change it to MultiDexApplication, application began to work normally.
class App : MultiDexApplication()

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.

Firebase Crash Reporting : FirebaseApp with name [DEFAULT] doesn't exist

This an exception I encountered when trying to use FirebaseAuth and Firebase Crash Reporting. I am trying to sign in anonymously in my application onCreate
public class MainApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
firebaseAuth.signInAnonymously().addOnCompleteListener(task -> {
if (task.isSuccessful()) {
Log.wtf("TAG", "Signed signInAnonymously successful ");
}
});
}
}
I also want to use crash reporting so my gradle dependencies looks like this.
dependencies {
// other dependencies
// ...
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.firebase:firebase-storage:9.2.1'
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'com.google.firebase:firebase-config:9.2.1'
compile 'com.google.firebase:firebase-crash:9.2.1'
}
apply plugin: 'com.google.gms.google-services'
After a certain amount of time I will get a crash dialog and this exception. Its another process that crashes so the app itself will still run.
java.lang.RuntimeException: Unable to create application com.android.tools.fd.runtime.BootstrapApplication: java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4612)
at android.app.ActivityThread.access$1600(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1337)
at android.os.Handler.dispatchMessage(Handler.java:102)
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)
Caused by: java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at com.redstar.collectors.MainApplication.onCreate(MainApplication.java:22)
at com.android.tools.fd.runtime.BootstrapApplication.onCreate(BootstrapApplication.java:369)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4609)
at android.app.ActivityThread.access$1600(ActivityThread.java:169) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1337) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
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)
If I remove the firebase-crash dependency there will be no crash.
FirebaseApp with name [DEFAULT] doesn't exist is caused when you run Firebase code on the separate process that is created by Firebase Crash Reporting as your custom Application class is created for each process in your app.
You should move code from your Application class to somewhere else. This could be in your main activity (which would always be in your main process) or could be in the onCreate() of a separate ContentProvider you register in your Manifest (a ContentProvider's onCreate() is run once in the lifecycle of your app's process just like Application.onCreate(), but only runs in a single process).

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

Android NoClassDefFoundError crash after new couchbase Lite Jars added

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

Categories

Resources