ACRA / acra

Application Crash Reports for Android

Home Page:https://www.acra.ch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ACRA service crashes on start up on Android 19 and earlier.

danepowell opened this issue · comments

I recently set up ACRA reporting to Cloudant as detailed in the wiki. It works great on a Nexus 5 running Android 6, but on a Galaxy S4 Mini running Android 4.4.2, the ACRA service crashes on application startup with this error:

java.lang.ClassNotFoundException: Didn't find class "org.acra.annotation.ReportsCrashes" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

I have no idea why this class would be missing on one version of Android but not another, do you? I have these includes in my application class, and I'm pulling in ch.acra:acra:4.8.0 via Gradle/Maven:

import org.acra.*;
import org.acra.annotation.*;

One thing I noticed is that my Gradle / Maven config have this line (the Android studio default):

{include=[*.jar], dir=libs}

It strikes me that the ACRA documentation advises to add the .aar file, and the error above makes reference to a "lib" directory, not a "libs" directory... could either of these be related?

Does ACRA crash or does the ACRA SenderService?
Can you post the full stacktrace.

There is no reason for the ACRA class to be available on one device but not the other if both instances are from the same APK. Ie Did you build it twice and deploy 32 different versions?

I can't help you with Gradle config questions. IMHO Gradle is a nightmare that packs in all the things from Ant that Maven2 cut loose from 12 years ago.

ACRA is packaged as an aar. So you need to configure your project to consume an aar library. I don;t think that means bunging it into a lib/libs folder, but as I said, Gradle has issues.

It's specifically the SenderService crashing. Same APK on both devices. I'm using a completely vanilla Android Studio project setup, nothing funky.

Here's the full stacktrace.

FATAL EXCEPTION: IntentService[ACRA SenderService]
Process: :acra, PID: 1911
java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = org.acra.config.ACRAConfiguration)
at android.os.Parcel.readSerializable(Parcel.java:2219)
at android.os.Parcel.readValue(Parcel.java:2064)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2314)
at android.os.Bundle.unparcel(Bundle.java:249)
at android.os.Bundle.getBoolean(Bundle.java:858)
at android.content.Intent.getBooleanExtra(Intent.java:4490)
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:33)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: java.lang.ClassNotFoundException: org.acra.annotation.ReportsCrashes
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at java.io.ObjectInputStream.resolveProxyClass(ObjectInputStream.java:1744)
at java.io.ObjectInputStream.readNewProxyClassDesc(ObjectInputStream.java:1684)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:660)
at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1781)
at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:762)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1981)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1938)
at java.io.ObjectInputStream.readFieldValues(ObjectInputStream.java:1115)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:455)
at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1244)
at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1833)
at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:762)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1981)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1938)
at android.os.Parcel.readSerializable(Parcel.java:2213)
at android.os.Parcel.readValue(Parcel.java:2064) 
at android.os.Parcel.readArrayMapInternal(Parcel.java:2314) 
at android.os.Bundle.unparcel(Bundle.java:249) 
at android.os.Bundle.getBoolean(Bundle.java:858) 
at android.content.Intent.getBooleanExtra(Intent.java:4490) 
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:33) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
Caused by: java.lang.NoClassDefFoundError: org/acra/annotation/ReportsCrashes
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:251) 
at java.io.ObjectInputStream.resolveProxyClass(ObjectInputStream.java:1744) 
at java.io.ObjectInputStream.readNewProxyClassDesc(ObjectInputStream.java:1684) 
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:660) 
at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1781) 
at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:762) 
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1981) 
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1938) 
at java.io.ObjectInputStream.readFieldValues(ObjectInputStream.java:1115) 
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:455) 
at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1347) 
at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1244) 
at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1833) 
at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:762) 
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1981) 
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1938) 
at android.os.Parcel.readSerializable(Parcel.java:2213) 
at android.os.Parcel.readValue(Parcel.java:2064) 
at android.os.Parcel.readArrayMapInternal(Parcel.java:2314) 
at android.os.Bundle.unparcel(Bundle.java:249) 
at android.os.Bundle.getBoolean(Bundle.java:858) 
at android.content.Intent.getBooleanExtra(Intent.java:4490) 
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:33) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.acra.annotation.ReportsCrashes" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:251) 
at java.io.ObjectInputStream.resolveProxyClass(ObjectInputStream.java:1744) 
at java.io.ObjectInputStream.readNewProxyClassDesc(ObjectInputStream.java:1684) 
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:660) 
at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1781) 
at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:762) 
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1981) 
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1938) 
at java.io.ObjectInputStream.readFieldValues(ObjectInputStream.java:1115) 
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:455) 
at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1347) 
at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1244) 
at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1833) 
at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:762) 
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1981) 
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1938) 
at android.os.Parcel.readSerializable(Parcel.java:2213) 
at android.os.Parcel.readValue(Parcel.java:2064) 
at android.os.Parcel.readArrayMapInternal(Parcel.java:2314) 
at android.os.Bundle.unparcel(Bundle.java:249) 
at android.os.Bundle.getBoolean(Bundle.java:858) 
at android.content.Intent.getBooleanExtra(Intent.java:4490) 
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:33) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.os.HandlerThread.run(HandlerThread.java:61) 

That is *really weird. Do you get the same on a 4.4.2 emulator?

Yes, the same error occurs both on the emulator and a real device (Galaxy S4 Mini Android 4.4.2). No such error occurs on a real or emulated Nexus 5 (Android M).

When I downgrade to ACRA 4.7.0 the error goes away, so this seems to be a regression in 4.8.0. Although the actual error reporting fails in 4.7.0 with a 400 error, so it's not a great workaround :)

OK, if it fails on an emulator then I can reproduce and test. Just in case it is something specific to your project could you please create a cut down project showing the issue and post it to Github. I'll look at it tonight.

Here's a "minimum broken example":
https://github.com/danepowell/acra354

All I did was to create a new project containing a blank activity and follow the exact instructions in the ACRA wiki to install and initialize it.

I've narrowed it down just a little... the problem seems to be with API levels below 21. An emulated Nexus 5 on API 21+ works fine. An emulated Nexus 5 on API 19 or below crashes.

OK, I have replicated it. It's really weird.

OK. Think I have it. It'll take me a day or two.

I also got the same problem , its not working in android API level 19(4.4.2 AND 4.4.4), but working fine on api 21( 5.0) , I haven't implemented any senderService , so that may be the problem ,but its working fine on some devices , why ?

IN google analytics results this is the problem

ClassNotFoundException (@BaseDexClassLoader:findClass:56) {IntentService[ACRA SenderService]}

ClassNotFoundException (@BaseDexClassLoader:findClass:67) {IntentService[ACRA SenderService]}

This is the code i had written, giving crash report at starting on android 4.4.4 and i have not included senderservice in Androidmanifest.xml file

@ReportsCrashes(
formUri = "https://vooratarun.cloudant.com/acra-gingerbuds/_design/acra-storage/_update/report",
reportType = HttpSender.Type.JSON,
httpMethod = HttpSender.Method.POST,
formUriBasicAuthLogin = "tonsedsollsoonseciablest",
formUriBasicAuthPassword = "f6c7edefcf5cee94972d63d996be8ab3ee3b9f5d",
// formKey = "", // This is required for backward compatibility but not used
customReportContent = {
ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME,
ReportField.ANDROID_VERSION,
ReportField.PACKAGE_NAME,
ReportField.REPORT_ID,
ReportField.BUILD,
ReportField.STACK_TRACE,
ReportField.DEVICE_ID,
ReportField.CUSTOM_DATA,
ReportField.CRASH_CONFIGURATION,
ReportField.USER_APP_START_DATE,
ReportField.USER_COMMENT,
ReportField.USER_IP,
},
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.toast_crash

)

public class AppController extends Application {
private static AppController mInstance;
public static Context getContext() {
return mInstance;
}

@Override
public void onCreate() {
    super.onCreate();
    ACRA.init(this);

}

}

@danepowell Could you please check out master and confirm that it works for you too.

master works now, thanks!

Will you be rolling a new release for this or do we need to use master for a while?

I plan on rolling out a new release tonight :-)

4.81 has been released. Give it 2 hours to propagate through Maven Central.

Woot! I see it in Maven. Thanks!

thanks sir, its working fine. Its really apprecialble , with in less time you fixed the bug, Great job sir, this shows the ACRA' s importance.

@william-ferguson-au thats so quick, thank you very much.