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

I am using PaperParcel with Kotlin but i get a crash "java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.b.h.b, parameter schoolName" #179

Open
oianmol opened this issue May 29, 2017 · 6 comments

Comments

@oianmol
Copy link

oianmol commented May 29, 2017

I am passing data to some fragment in bundle and while receiving it throws the exception "java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.b.h.b, parameter schoolName"

java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.b.h.b, parameter schoolName
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2426)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.b.h.b, parameter schoolName
at com.model.login.ProfileData.(ProfileData.kt)
at com.model.login.PaperParcelProfileData$1.createFromParcel(PaperParcelProfileData.java:147)
at com.model.login.PaperParcelProfileData$1.createFromParcel(PaperParcelProfileData.java:59)
at android.os.Parcel.readParcelable(Parcel.java:2367)
at android.os.Parcel.readValue(Parcel.java:2264)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2614)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.Bundle.getParcelable(Bundle.java:786)
at com.ui.profile.c.h.onCreate(ProfileBioFragment.kt:48)
at android.support.v4.app.q.performCreate(Fragment.java:2172)
at android.support.v4.app.w.a(FragmentManager.java:1243)
at android.support.v4.app.w.e(FragmentManager.java:1523)
at android.support.v4.app.w.a(FragmentManager.java:1585)
at android.support.v4.app.w.m(FragmentManager.java:2827)
at android.support.v4.app.q.restoreChildFragmentState(Fragment.java:1289)
at android.support.v4.app.q.onCreate(Fragment.java:1260)
at com.ui.home.y.onCreate(HomeFragment.java:44)
at com.ui.profile.c.f.onCreate(NewProfileFragment.kt:44)
at android.support.v4.app.q.performCreate(Fragment.java:2172)
at android.support.v4.app.w.a(FragmentManager.java:1243)
at android.support.v4.app.w.e(FragmentManager.java:1523)
at android.support.v4.app.w.a(FragmentManager.java:1585)
at android.support.v4.app.w.m(FragmentManager.java:2827)
at android.support.v4.app.q.restoreChildFragmentState(Fragment.java:1289)
at android.support.v4.app.q.onCreate(Fragment.java:1260)
at com.home.y.onCreate(HomeFragment.java:44)
at com.home.NewsFeedViewPagerFragment.onCreate(NewsFeedViewPagerFragment.java:72)
at android.support.v4.app.q.performCreate(Fragment.java:2172)
at android.support.v4.app.w.a(FragmentManager.java:1243)
at android.support.v4.app.w.e(FragmentManager.java:1523)
at android.support.v4.app.w.a(FragmentManager.java:1585)
at android.support.v4.app.w.m(FragmentManager.java:2827)
at android.support.v4.app.t.f(FragmentController.java:190)
at android.support.v4.app.r.onCreate(FragmentActivity.java:353)
at com.home.HomeActivity.onCreate(HomeActivity.java:136)
at android.app.Activity.performCreate(Activity.java:6245)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5443) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 

@oianmol oianmol changed the title I am using PaperParcel with Kotlin but i get a crash "java.lanw I am using PaperParcel with Kotlin but i get a crash "java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.b.h.b, parameter schoolName" May 29, 2017
@grandstaish
Copy link
Owner

Hey, could you please send the ProfileData class? I'll take a look

@grandstaish
Copy link
Owner

@Anmol92verma are you able to post that class, or alternatively some other code that demonstrates the issue?

@oianmol
Copy link
Author

oianmol commented Jun 14, 2017

@PaperParcel
data class ProfileData(
val id: String,
@SerializedName("first_name")
val firstName: String,
@SerializedName("last_name")
val lastName: String,
@SerializedName("user_name")
val userName: String,
@SerializedName("email_id")
val email: String,
@SerializedName("school_name")
val schoolName: String,
@SerializedName("class_of")
var classOf: String,
var dob: String,
val address: String,
val city: String,
val state: String,
val zip: String,
val country: String,
@SerializedName("phone_number")
val phoneNumber: String,
val picture: String,
var height: String,
var isfavorite: Boolean,
var isInTeam: Boolean,
val status: String,
val website: String,
val cover: String,
@SerializedName("user_type")
val userType: String,
@SerializedName("graduation_year")
var graduationYear: String,
var weight: String,
val team: String,
val position: String,
val sport: String,
var gender: String,
@SerializedName("created")
val profileCreatedAt: String,
@SerializedName("modified")
val profileLastModifiedAt: String,
@SerializedName("player_number")
val playerNumber: String,
@SerializedName("isFollowing")
var isfollow: Boolean,
@SerializedName("followedByCount")
var followedByCount: String,
@SerializedName("followingCount")
val followingCount: String,
@SerializedName("sport_p")
var sportModel: AttributeData,
@SerializedName("playerAttributes")
val playerAttributes: ArrayList,
@SerializedName("tptUrls")
val tptUrls: HashMap<String, ArrayList>,

    @SerializedName("about_me")
    val aboutMe: Stats,

    @SerializedName("goal")
    val goal: Stats,

    @SerializedName("notification_status")
    val notificationStatus: Boolean,


    @SerializedName("favSports")
    val favSports: ArrayList<AttributeData>,

    @SerializedName("showcase")
    val showcase: ArrayList<ShowcaseResponse>,

    @SerializedName("favProfessionalTeams")
    val favProfessionalTeams: ArrayList<AttributeData>,

    @SerializedName("favColleges")
    val favColleges: ArrayList<AttributeData>,

    @SerializedName("favApparel")
    val favApparel: ArrayList<AttributeData>,

    @SerializedName("favMusic")
    val favMusic: ArrayList<AttributeData>,

    @SerializedName("favFitnessCenter")
    val favFitnessCenter: ArrayList<AttributeData>,

    @SerializedName("favActivities")
    val favActivities: ArrayList<AttributeData>,

    @SerializedName("workout")
    val workouts: ArrayList<AllMediaProfile>,

    @SerializedName("media")
    val media: ArrayList<AllMediaProfile>,

    @SerializedName("coaches")
    val coachesList: ArrayList<CoachesBody>,

    @SerializedName("favUsers")
    val favUsers: ArrayList<Player>,

    @SerializedName("myTeam")
    val myTeam: MyTeam?,

    val isblockedByMe: Boolean,

    val imBlockedBy: Boolean,
    val verified: Boolean,
    val postPermit: Boolean) : PaperParcelable {
companion object {
    @JvmField val CREATOR = PaperParcelProfileData.CREATOR
}

}

@ghost
Copy link

ghost commented Oct 25, 2017

Hello.

I have the same problem. I see this error when I'm building the release project with proguard.

Have you got a solution?

@grandstaish
Copy link
Owner

@Slik1002 you won't need any special proguard rules for this library. It sounds as though you have a kotlin model, but it's being instantiated incorrectly (probably through the usage of Gson or Moshi). Just a guess!

If that is the case, then your model object was instantiated with a null value in a non-nullable field, then that null value got Parcelled, then my library tried to unparcel it. At that point kotlin throws an exception because that field should never have been null in the first place.

@AnandaDwiprayoga
Copy link

same problem here java.lang.IllegalArgumentException: Parameter specified as non-null is null: method g.z.c.h.f, parameter msg

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

3 participants