-
Notifications
You must be signed in to change notification settings - Fork 273
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
Gradle build error after updating to 1.1.11 from 1.1.6 #355
Comments
Hmm, do you have a class that you've annotated with |
Hi @johncarl81, does generic defined means is generic on the base class or generic on the field ? |
Could you share the full details of that class? I wonder if changing |
This is the example of full class: @Parcel
public class TestParcel extends BaseObservable {
protected LinkedHashMap<String, String> promo;
public TestParcel() {
promo = new LinkedHashMap<>();
}
@Bindable
public LinkedHashMap<String, String> getPromo() {
return promo;
}
public void setPromo(LinkedHashMap<String, String> promo) {
this.promo = promo;
notifyPropertyChanged(BR.promo);
}
} We use so many LinkedHashMap on the other class as well, do you think LinkedHashMap could be the problem here ? |
Ah, I think it's tripping up on something in @Parcel(analyze = TestParcel.class)
public class TestParcel extends BaseObservable {
protected LinkedHashMap<String, String> promo;
public TestParcel() {
promo = new LinkedHashMap<>();
}
@Bindable
public LinkedHashMap<String, String> getPromo() {
return promo;
}
public void setPromo(LinkedHashMap<String, String> promo) {
this.promo = promo;
notifyPropertyChanged(BR.promo);
}
} |
In general I opt for using the most general interface I can - typically using the interface over the implementation. In this case |
I just added |
|
Any success on this one @doniwinata0309 ? |
hi @johncarl81 , apologize for the late reply. |
I just check the documentation again, is it mandatory for these points after 1.1.6 ?
|
Hi @johncarl81, I just checked the version 1.1.17 -1.1.9 also failed with the same error. Then the version 1.1.10 has different error with 1.1.7, but the same with 1.1.11. |
Hi @doniwinata0309, could you produce a quick sample app to demonstrate the issue? That would help me greatly in debugging. |
sure, i will try to repro this from new project if possible. By the way, after checking the build folder, i just found out that the @Parcel
public class class1 {
protected String id;
protected myInnerClass myClass2;
@Parcel
public static class myInnerClass{
....
}
} Is this behaviour expected ? |
@doniwinata0309, still having issues with this? If not, I'd like to close. |
Yes we still facing the error, but i think we can close it for now. Aplogise for slow response. Thanks @johncarl81 |
By the way, do you have advice how to debugging the error ? I have no idea which file causing this null error. So far i know which module that causing the error, but it contains like hundred of classes with parceler annotation. It would be nice if we can pointing specific file that causing it. |
quite alright... I dont know, but I've heard of similar problems recently in Kotlin... are you trying to set up an |
Ping @doniwinata0309 |
Hi @johncarl81 , no we didn't use sealed class at all. I just checked my code, seems like it is different issue. |
hi @johncarl81 , we have found 2 files that causing error. it is something like this: @Parcel
public class ExampleClass<T extends Serializable> {
protected String titleExample;
//remove this, build success
protected List<ParcelableClassExample<T>> testList;
public List<ParcelableClassExample<T>> getChangeItems() {
return null;
}
public void setChangeItems(List<ParcelableClassExample<T>> changeItems) {
testList = changeItems;
}
public String getChangeTitle() {
return titleExample;
}
public void setChangeTitle(String changeTitle) {
titleExample = changeTitle;
}
} Do you know what might be wrong here ? |
Ah, it's because Parceler doesn't know what to do with the generic type here... it's undefined in terms of this particular class. Do you marshall (call Parcels.wrap/unwrap) |
Ah, interesting, it seems it's failing on lookup up the generic for the collection type: List<ParcelableClassExample<T>> Now, I think this is something to fix... |
Thanks @johncarl81, we marshal the class directly. |
Hi @johncarl81 , this object also causing the same error on our project |
For the time being, you can get around this issue by subclassing your class with generic parameters, specifying the concretes: @Parcel
public class StringExampleClass extends ExampleClass<String> {} This has its limitations - particularly when dealing with multiple classes in an object graph. But, I hope it would be a crutch for this issue until we can figure out a fix. |
Thank for your suggestion @johncarl81 ! |
If you could test a potential fix, I'd greatly appreciate it! I hope to
spend some timr on it this weekend.
…On Fri, Jan 11, 2019, 8:08 PM doniwinata0309 ***@***.*** wrote:
Thank for your suggestion @johncarl81 <https://github.com/johncarl81> !
Will try wether we can pass specifying object or not in our case.
Hopefully it will fixed soon since we need to use AGP 3.3, it requires
parceler 1.1.12 because of androidX migration. let me know if i can do
something to help you.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#355 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKMqY8UfuJcDXyXxlMZ_LFnA9eMiFDwks5vCVG_gaJpZM4XDWSd>
.
|
It is working perfectly @johncarl81 . i just trying your suggestion, so we put @parcel on subclass instead of the main class right ? so far it is good, but will need to test them on monday. |
hi @johncarl81 , do you have plan to do fix about this issue ? |
Hi,
I got this error after updating to parceler 1.1.11, while it is working fine on parceler 1.1.6
Android gradle plugin : 3.1.2
Kotlin: 1.2.40
androidSupport : 27.1.1
Databinding compiler: 27.1.1
Here some error log from logcat and please let me know if you need additional information. do you know what might be wrong with this ? thank you
The text was updated successfully, but these errors were encountered: