Comments (16)
a temporary fix would be to add a dependency to android.jar
apt files('sdkdir/platforms/android-25/android.jar')
from auto-value-gson.
https://github.com/hister/AutoValueGsonIssue80
this is a simple project demonstrating this issue.
as I understood it this problem happens when a property witch is Parcelable in one of the dependencies
from auto-value-gson.
This started happening when I upgraded to the newer versions
From:
autoValueVersion = '1.3-rc2'
avAnnotationsVersion = '1.2-update1'
avParcelVersion = '0.2.3-rc2'
avGsonVersion = '0.4.2'
avWithVersion = '1.0.0-rc1'
To:
autoValueVersion = '1.3'
avAnnotationsVersion = '1.3'
avParcelVersion = '0.2.5'
avGsonVersion = '0.4.3'
avWithVersion = '1.0.0-rc1'
from auto-value-gson.
Can you look in the build
directory to see what's actually being generated? You should be able to find it in build/generated/source/apt
.
from auto-value-gson.
I see that out of all the @autovalue classes, only a handful have their implementations generated.
Not sure if this is comprehensible. Let me know if more details are needed.
from auto-value-gson.
If the processor fails at some point, that might be expected. We need to find the source of the android/os/Parcelable
. Since the error is Caused by: java.lang.ClassNotFoundException: android.os.Parcelable
, I'm expecting that the source is formatted correctly. Can you please check the generated source files to verify?
from auto-value-gson.
There are only 3 AutoValue classes whose sources have been generated.
And here's the interesting part: One could only generate a $$AutoValue_Name (auto-value) and didn't proceed further. $AutoValue_Name should have been generated by the gson extension and AutoValue_Name by the parcel extension.
AutoValue class:
package com.example;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.auto.value.AutoValue;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.example.data.User;
@AutoValue
public abstract class Request implements Parcelable {
public static Request create(@NonNull User user, @Nullable String description) {
return new AutoValue_Request(user, description);
}
public static TypeAdapter<Request> typeAdapter(Gson gson) {
return new AutoValue_Request.GsonTypeAdapter(gson);
}
@NonNull
public abstract User user();
@Nullable
public abstract String description();
}
auto-value generated: $$AutoValue_Request
package com.example;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.example.data.User;
abstract class $$AutoValue_Request extends Request {
private final User user;
private final String description;
$$AutoValue_Request(
User user,
@Nullable String description) {
if (user == null) {
throw new NullPointerException("Null user");
}
this.user = user;
this.description = description;
}
@NonNull
@Override
public User user() {
return user;
}
@Nullable
@Override
public String description() {
return description;
}
@Override
public String toString() {
return "Request{"
+ "user=" + user + ", "
+ "description=" + description
+ "}";
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof Request) {
Request that = (Request) o;
return (this.user.equals(that.user()))
&& ((this.description == null) ? (that.description() == null) : this.description.equals(that.description()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= this.user.hashCode();
h *= 1000003;
h ^= (description == null) ? 0 : this.description.hashCode();
return h;
}
}
auto-value-gson: $AutoValue_Request
None
auto-value-parcel: AutoValue_Request
None
Note: User class is also an AutoValue and a Parcelable.
from auto-value-gson.
This is an Android module, right? As opposed to a java only module?
from auto-value-gson.
That's correct.
from auto-value-gson.
@rharter Did this information help you get anywhere?
from auto-value-gson.
I haven't been able to repro this one. Can you make a simple project demonstrating this issue, please?
from auto-value-gson.
@Hister Thanks a lot for posting the example project.
Using your solution for now.
@rharter This project produces the exact error I am having. Hope it is useful in debugging.
from auto-value-gson.
@rharter could you take a look at this ?
from auto-value-gson.
I have the same issue, and @Hister 's workaround works.
from auto-value-gson.
Per talking with the android tools team, a future version of the android gradle plugin's annotationProcessor
configuration will have the android jar on the classpath, so this will just have to wait until then.
Ref: https://code.google.com/p/android/issues/detail?id=231914
from auto-value-gson.
If you prefer simple export, you can use this
apt files("$android.sdkDirectory.path/platforms/android-26/android.jar")
from auto-value-gson.
Related Issues (20)
- Parse json object with varying data types
- RV_RETURN_VALUE_IGNORED findbugs error HOT 3
- Build failed in the generated read method for a generic class HOT 1
- Originating element not set HOT 3
- Generate proguard rules HOT 1
- Generic base types cause compile errors HOT 2
- Allow custom opt-in annotation for factory HOT 2
- AutoValueGsonExtension fails on immutable collections. HOT 1
- "Unable to get public no-arg constructor" simply when adding auto-value-gson dependency HOT 3
- auto-value-gson-from-rharter-generated-invalid-code HOT 6
- What dependency AutoValue annotation is in ? HOT 1
- Non-deterministic generation of TypeAdapterFactory HOT 2
- Issue using @GenerateTypeAdapter with maven HOT 2
- `@Nullable` doesn't work correctly with nested types
- NullPointerException processing ImmutableList.Builder Builder method
- Compilation error in Eclipse/maven
- Handling unrecognized json properties HOT 1
- @AutoValue.Builder generates objects with all fields HOT 2
- 也许这个方案更加好 HOT 1
- Could not instantiate annotation processor 'com.ryanharter.auto.value.gson.AutoValueGsonAdapterFactoryProcessor'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auto-value-gson.