moghaf
moghaf

Reputation: 53

Android java.lang.IllegalArgumentException "Invalid primitive conversion from long to int" Exception just in release build

I'm developing an android application using kotlin and everything was fine till now that I'm getting the java.lang.IllegalArgumentException: Invalid primitive conversion from long to int exception on some android devices.

The exception is occurring just in the release build of the application and unfortunately, I have no clue how to debug or properly analyze the stack trace to get to know the exact problem.

The stack trace is as below:

java.lang.IllegalArgumentException: Invalid primitive conversion from long to int
    at java.lang.reflect.Field.getInt(Field.java)
    at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:946)
    at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:360)
    at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1054)
    at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1384)
    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
    at android.os.Parcel.writeSerializable(Parcel.java:1463)
    at android.os.Parcel.writeValue(Parcel.java:1416)
    at android.os.Parcel.writeArrayMapInternal(Parcel.java:686)
    at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1376)
    at android.os.Bundle.writeToParcel(Bundle.java:1079)
    at android.os.Parcel.writeBundle(Parcel.java:711)
    at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3216)
    at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3496)
    at android.os.Handler.handleCallback(Handler.java:742)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:157)
    at android.app.ActivityThread.main(ActivityThread.java:5653)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:746)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)

Any help would be appreciated.

Upvotes: 1

Views: 1015

Answers (1)

moghaf
moghaf

Reputation: 53

For anyone who may have this problem, in my case, it has been solved by removing -overloadaggressively from the proguard-rules.pro file.

Upvotes: 1

Related Questions