Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
danepowell opened this issue Feb 1, 2016 · 18 comments
Closed

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

danepowell opened this issue Feb 1, 2016 · 18 comments

Comments

@danepowell
Copy link

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?

@william-ferguson-au
Copy link
Member

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.

@danepowell
Copy link
Author

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) 

@william-ferguson-au
Copy link
Member

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

@danepowell
Copy link
Author

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 :)

@william-ferguson-au
Copy link
Member

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.

@danepowell
Copy link
Author

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.

@danepowell
Copy link
Author

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.

@william-ferguson-au
Copy link
Member

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

@william-ferguson-au
Copy link
Member

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

@william-ferguson-au william-ferguson-au changed the title ACRA service crashes on certain devices ACRA service crashes on start up on Android 19 and earlier. Feb 2, 2016
@vooratarun
Copy link

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]}

@vooratarun
Copy link

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

}

}

@william-ferguson-au
Copy link
Member

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

@danepowell
Copy link
Author

master works now, thanks!

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

@william-ferguson-au
Copy link
Member

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

@william-ferguson-au
Copy link
Member

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

@danepowell
Copy link
Author

Woot! I see it in Maven. Thanks!

@vooratarun
Copy link

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.

@mpraki
Copy link

mpraki commented Feb 5, 2016

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

pfn added a commit to pfn/qicr that referenced this issue Feb 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants