Closed vdubedout closed 8 years ago
Your version of JavaPoet is being resolved incorrectly on the apt
classpath for reasons that I still can't figure out.
Adding
apt 'com.squareup:javapoet:1.7.0'
first will fix this
Whenever I've seen someone report it, it was because Dagger 2.2 bundles JavaPoet 1.6 in it's jar and doesn't shade it.
On Thu, 26 May 2016, 22:40 Jake Wharton, notifications@github.com wrote:
Your version of JavaPoet is being resolved incorrectly on the apt classpath for reasons that I still can't figure out.
Adding
apt 'com.squareup:javapoet:1.7.0'
first will fix this
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/rharter/auto-value-parcel/issues/64#issuecomment-221988132
Let's all agree to stop using Dagger 2.2! Dagger 2.4 people!
On Thu, May 26, 2016 at 4:49 PM Gabriel Ittner notifications@github.com wrote:
Whenever I've seen someone report it, it was because Dagger 2.2 bundles JavaPoet 1.6 in it's jar and doesn't shade it.
On Thu, 26 May 2016, 22:40 Jake Wharton, notifications@github.com wrote:
Your version of JavaPoet is being resolved incorrectly on the apt classpath for reasons that I still can't figure out.
Adding
apt 'com.squareup:javapoet:1.7.0'
first will fix this
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub < https://github.com/rharter/auto-value-parcel/issues/64#issuecomment-221988132
— You are receiving this because you commented.
Reply to this email directly or view it on GitHub https://github.com/rharter/auto-value-parcel/issues/64#issuecomment-221990166
Even apt 'com.squareup:javapoet:1.7.0'
won't fix it for me. Also I'm using Dagger 2.4.
apt
+--- com.google.dagger:dagger-compiler:2.4
| +--- com.google.dagger:dagger:2.4
| | \--- javax.inject:javax.inject:1
| +--- com.google.dagger:dagger-producers:2.4
| | +--- com.google.dagger:dagger:2.4 (*)
| | \--- com.google.guava:guava:19.0
| \--- com.google.guava:guava:19.0
+--- com.squareup:javapoet:1.7.0
+--- com.vanniktech:onactivityresult-compiler:0.4.0
| +--- com.vanniktech:onactivityresult-annotations:0.4.0
| +--- com.google.auto.service:auto-service:1.0-rc2
| | +--- com.google.auto:auto-common:0.3 -> 0.6
| | | \--- com.google.guava:guava:18.0 -> 19.0
| | \--- com.google.guava:guava:18.0 -> 19.0
| \--- com.squareup:javapoet:1.5.1 -> 1.7.0
+--- com.google.auto.value:auto-value:1.2
+--- com.ryanharter.auto.value:auto-value-parcel:0.2.2
| +--- com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.2
| +--- com.google.auto.value:auto-value:1.2
| +--- com.google.auto:auto-common:0.6 (*)
| +--- com.google.auto.service:auto-service:1.0-rc2 (*)
| +--- org.apache.commons:commons-lang3:3.4
| \--- com.squareup:javapoet:1.7.0
+--- com.google.android.gms:play-services-gcm:9.0.0
| +--- com.google.android.gms:play-services-base:9.0.0
| | +--- com.google.android.gms:play-services-basement:9.0.0
| | | \--- com.android.support:support-v4:23.0.0
+--- com.ryanharter.auto.value:auto-value-moshi:0.3.2
| +--- com.google.auto.value:auto-value:1.2
| +--- com.google.auto:auto-common:0.6 (*)
| +--- com.squareup.moshi:moshi:1.0.0 -> 1.1.0
| | \--- com.squareup.okio:okio:1.6.0
| +--- com.google.auto.service:auto-service:1.0-rc2 (*)
| \--- com.squareup:javapoet:1.7.0
+--- com.jakewharton:butterknife-compiler:8.0.1
| +--- io.reactivex:rxjava:1.1.3 -> 1.1.5
| +--- com.google.auto:auto-common:0.6 (*)
| +--- com.google.auto.service:auto-service:1.0-rc2 (*)
| +--- com.jakewharton:butterknife-annotations:8.0.1
| | \--- com.android.support:support-annotations:23.3.0 -> 23.4.0
| \--- com.squareup:javapoet:1.6.1 -> 1.7.0
+--- io.requery:requery-processor:1.0.0-beta18
| +--- org.eclipse.persistence:javax.persistence:2.1.1
| +--- io.requery:requery:1.0.0-beta18
| \--- com.squareup:javapoet:1.7.0
EDIT:
apt with auto-value-parcel 0.2.1
+--- com.ryanharter.auto.value:auto-value-parcel:0.2.1
| +--- com.squareup:javapoet:1.4.0 -> 1.7.0
| +--- com.google.auto:auto-common:0.6 (*)
| +--- com.google.auto.service:auto-service:1.0-rc2 (*)
| +--- org.apache.commons:commons-lang3:3.4
| +--- com.google.auto.value:auto-value:1.2-rc1 -> 1.2
| \--- com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.1
apt with auto-value-parcel 0.2.2
+--- com.ryanharter.auto.value:auto-value-parcel:0.2.2
| +--- com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.2
| +--- com.google.auto.value:auto-value:1.2
| +--- com.google.auto:auto-common:0.6 (*)
| +--- com.google.auto.service:auto-service:1.0-rc2 (*)
| +--- org.apache.commons:commons-lang3:3.4
| \--- com.squareup:javapoet:1.7.0
I'm using Dagger 2.4,
Adding javapoet:1.7.0 solved the problem. Commenting it back, problem back.
Thanks :)
If that can help
apt
+--- com.google.auto.value:auto-value:1.2
+--- com.squareup:javapoet:1.7.0
+--- com.ryanharter.auto.value:auto-value-parcel:0.2.2
| +--- com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.2
| +--- com.google.auto.value:auto-value:1.2
| +--- com.google.auto:auto-common:0.6
| | \--- com.google.guava:guava:18.0 -> 19.0
| +--- com.google.auto.service:auto-service:1.0-rc2
| | +--- com.google.auto:auto-common:0.3 -> 0.6 (*)
| | \--- com.google.guava:guava:18.0 -> 19.0
| +--- org.apache.commons:commons-lang3:3.4
| \--- com.squareup:javapoet:1.7.0
+--- com.ryanharter.auto.value:auto-value-gson:0.3.1
| +--- com.google.auto.value:auto-value:1.2
| +--- com.google.auto:auto-common:0.6 (*)
| +--- com.google.auto.service:auto-service:1.0-rc2 (*)
| +--- com.squareup:javapoet:1.7.0
| \--- com.google.code.gson:gson:2.6.2
+--- com.jakewharton:butterknife-compiler:8.0.1
| +--- io.reactivex:rxjava:1.1.3 -> 1.1.5
| +--- com.google.auto:auto-common:0.6 (*)
| +--- com.google.auto.service:auto-service:1.0-rc2 (*)
| +--- com.jakewharton:butterknife-annotations:8.0.1
| | \--- com.android.support:support-annotations:23.3.0 -> 23.4.0
| \--- com.squareup:javapoet:1.6.1 -> 1.7.0
+--- com.google.dagger:dagger-compiler:2.4
| +--- com.google.dagger:dagger:2.4
| | \--- javax.inject:javax.inject:1
| +--- com.google.dagger:dagger-producers:2.4
| | +--- com.google.dagger:dagger:2.4 (*)
| | \--- com.google.guava:guava:19.0
| \--- com.google.guava:guava:19.0
+--- com.github.hotchemi:permissionsdispatcher-processor:2.1.2
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.0.0
| | \--- org.jetbrains.kotlin:kotlin-runtime:1.0.0
| \--- com.squareup:javapoet:1.6.0 -> 1.7.0
+--- com.jakewharton.hugo:hugo-annotations:1.2.1
+--- com.android.support:design:23.4.0
| +--- com.android.support:recyclerview-v7:23.4.0
| | +--- com.android.support:support-annotations:23.4.0
| | \--- com.android.support:support-v4:23.4.0
| | \--- com.android.support:support-annotations:23.4.0
| +--- com.android.support:appcompat-v7:23.4.0
| | +--- com.android.support:animated-vector-drawable:23.4.0
| | | \--- com.android.support:support-vector-drawable:23.4.0
| | | \--- com.android.support:support-v4:23.4.0 (*)
| | +--- com.android.support:support-v4:23.4.0 (*)
| | \--- com.android.support:support-vector-drawable:23.4.0 (*)
| \--- com.android.support:support-v4:23.4.0 (*)
+--- com.android.support:appcompat-v7:23.4.0 (*)
+--- com.github.JakeWharton:ViewPagerIndicator:2.4.1
| \--- com.android.support:support-v4:23.1.+ -> 23.4.0 (*)
+--- com.github.chyrta:AndroidOnboarder:0.6
+--- com.google.android.gms:play-services-maps:8.4.0
| \--- com.google.android.gms:play-services-base:8.4.0
| \--- com.google.android.gms:play-services-basement:8.4.0
| \--- com.android.support:support-v4:23.0.0 -> 23.4.0 (*)
+--- com.squareup.picasso:picasso:2.5.2
+--- com.github.andrewlord1990:snackbarbuilder:0.5.0
| +--- com.android.support:appcompat-v7:23.1.1 -> 23.4.0 (*)
| \--- com.android.support:design:23.1.1 -> 23.4.0 (*)
+--- com.squareup.retrofit2:retrofit:2.0.2
| \--- com.squareup.okhttp3:okhttp:3.2.0
| \--- com.squareup.okio:okio:1.6.0
+--- com.squareup.retrofit2:retrofit-converters:2.0.2
+--- com.squareup.retrofit2:converter-gson:2.0.2
| +--- com.squareup.retrofit2:retrofit:2.0.2 (*)
| \--- com.google.code.gson:gson:2.6.1 -> 2.6.2
+--- com.squareup.okhttp3:okhttp:3.2.0 (*)
+--- com.google.code.gson:gson:2.6.2
+--- com.jakewharton:butterknife:8.0.1
| +--- com.jakewharton:butterknife-annotations:8.0.1 (*)
| \--- com.android.support:support-annotations:23.3.0 -> 23.4.0
+--- com.google.dagger:dagger:2.4 (*)
+--- com.j256.ormlite:ormlite-core:4.48
+--- com.j256.ormlite:ormlite-android:4.48
| \--- com.j256.ormlite:ormlite-core:4.48
+--- com.jakewharton.threetenabp:threetenabp:1.0.3
| \--- org.threeten:threetenbp:1.3.1
+--- io.reactivex:rxjava:1.1.5
+--- com.facebook.android:facebook-android-sdk:4.11.0
| +--- com.parse.bolts:bolts-android:1.4.0
| | +--- com.parse.bolts:bolts-tasks:1.4.0
| | \--- com.parse.bolts:bolts-applinks:1.4.0
| | \--- com.parse.bolts:bolts-tasks:1.4.0
| +--- com.android.support:support-v4:23.2.1 -> 23.4.0 (*)
| +--- com.android.support:cardview-v7:23.2.1
| \--- com.android.support:customtabs:23.2.1
| +--- com.android.support:support-v4:23.2.1 -> 23.4.0 (*)
| \--- com.android.support:support-annotations:23.2.1 -> 23.4.0
+--- com.github.hotchemi:permissionsdispatcher:2.1.2
| \--- com.android.support:support-v4:23.1.1 -> 23.4.0 (*)
+--- com.google.android.gms:play-services-location:8.4.0
| +--- com.google.android.gms:play-services-base:8.4.0 (*)
| \--- com.google.android.gms:play-services-maps:8.4.0 (*)
+--- io.nlopez.smartlocation:library:3.2.2
| +--- com.android.support:support-annotations:23.1.1 -> 23.4.0
| \--- com.google.android.gms:play-services-location:8.4.0 (*)
+--- com.github.orhanobut:logger:1.12
+--- com.google.android.gms:play-services-appindexing:8.4.0
| \--- com.google.android.gms:play-services-base:8.4.0 (*)
+--- com.jakewharton.auto.value:auto-value-annotations:1.2-update1
\--- org.glassfish:javax.annotation:10.0-b28
I ran into the same issue. You can downgrade to dagger 2.0.2 unless you need the bleeding edge.
So the solution here is to upgrade to Dagger 2.4. I'm going to close this as there is nothing for us to do.
The solution is to add :
apt 'com.squareup:javapoet:1.7.0'
I was already using dagger 2.4 on my code when the bug came out.
Nevermind issue seem be because of com.ryanharter.auto.value:auto-value-parcel:0.2.2
when going back to 0.2.1 every worked again.
I keep getting this error: java.lang.NoSuchMethodError: com.squareup.javapoet.TypeName.isBoxedPrimitive()Z
I updated to autovalue 1.3-rc1 and updated the parceler and gson extension also then I got this error which didn't go away even when adding apt 'com.squareup:javapoet:1.7.0'
to the dependencies. Now i'm switching back to 1.2 and the latest non RC parceler and gson extensions and I still keep getting this error. I already did a gradle clean and Android Studio invalidate cache and nothing seems to work. In External Libraries in AS I see the correct javapoet version 1.7.0 and when I go to the com.ryanharter.auto.value.parcel.Parcelables.java
there I can click throught to com.squareup.javapoet.TypeName.isBoxedPrimitive()
with cmd/ctrl click in the code? Anyone know what I'm doing wrong? btw I'm using Dagger 2.4
apt
+--- com.google.dagger:dagger-compiler:2.4
| +--- com.google.dagger:dagger:2.4
| | \--- javax.inject:javax.inject:1
| +--- com.google.dagger:dagger-producers:2.4
| | +--- com.google.dagger:dagger:2.4 (*)
| | \--- com.google.guava:guava:19.0
| \--- com.google.guava:guava:19.0
+--- com.google.auto.value:auto-value:1.2
+--- com.ryanharter.auto.value:auto-value-parcel:0.2.2
| +--- com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.2
| +--- com.google.auto.value:auto-value:1.2
| +--- com.google.auto:auto-common:0.6
| | \--- com.google.guava:guava:18.0 -> 19.0
| +--- com.google.auto.service:auto-service:1.0-rc2
| | +--- com.google.auto:auto-common:0.3 -> 0.6 (*)
| | \--- com.google.guava:guava:18.0 -> 19.0
| +--- org.apache.commons:commons-lang3:3.4
| \--- com.squareup:javapoet:1.7.0
+--- com.ryanharter.auto.value:auto-value-gson:0.3.1
| +--- com.google.auto.value:auto-value:1.2
| +--- com.google.auto:auto-common:0.6 (*)
| +--- com.google.auto.service:auto-service:1.0-rc2 (*)
| +--- com.squareup:javapoet:1.7.0
| \--- com.google.code.gson:gson:2.6.2
+--- com.squareup.auto.value:auto-value-redacted:1.0.0
| +--- com.google.auto.value:auto-value:1.2
| \--- com.squareup:javapoet:1.7.0
+--- com.jakewharton:butterknife-compiler:8.0.1
| +--- io.reactivex:rxjava:1.1.3 -> 1.1.5
| +--- com.google.auto:auto-common:0.6 (*)
| +--- com.google.auto.service:auto-service:1.0-rc2 (*)
| +--- com.jakewharton:butterknife-annotations:8.0.1
| | \--- com.android.support:support-annotations:23.3.0 -> 23.4.0
| \--- com.squareup:javapoet:1.6.1 -> 1.7.0
+--- com.google.dagger:dagger:2.4 (*)
+--- com.google.guava:guava:19.0
+--- com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.2
+--- com.crashlytics.sdk.android:crashlytics:2.5.5
| +--- com.crashlytics.sdk.android:answers:1.3.6
| | \--- io.fabric.sdk.android:fabric:1.3.10
| +--- com.crashlytics.sdk.android:crashlytics-core:2.3.8
| | +--- com.crashlytics.sdk.android:answers:1.3.6 (*)
| | \--- io.fabric.sdk.android:fabric:1.3.10
| +--- io.fabric.sdk.android:fabric:1.3.10
| \--- com.crashlytics.sdk.android:beta:1.1.4
+--- org.piwik.sdk:piwik-sdk:1.0.1
| +--- com.android.support:support-annotations:23.4.0
| \--- com.jakewharton.timber:timber:4.1.2
+--- io.requery:sqlite-android:3.13.0-2
| \--- com.android.support:support-v4:23.1.1 -> 23.4.0
| \--- com.android.support:support-annotations:23.4.0
+--- net.zetetic:android-database-sqlcipher:3.4.0
+--- com.android.support:appcompat-v7:23.4.0
| +--- com.android.support:animated-vector-drawable:23.4.0
| | \--- com.android.support:support-vector-drawable:23.4.0
| | \--- com.android.support:support-v4:23.4.0 (*)
| +--- com.android.support:support-v4:23.4.0 (*)
| \--- com.android.support:support-vector-drawable:23.4.0 (*)
+--- com.android.support:design:23.4.0
| +--- com.android.support:recyclerview-v7:23.4.0
| | +--- com.android.support:support-annotations:23.4.0
| | \--- com.android.support:support-v4:23.4.0 (*)
| +--- com.android.support:appcompat-v7:23.4.0 (*)
| \--- com.android.support:support-v4:23.4.0 (*)
+--- com.android.support:recyclerview-v7:23.4.0 (*)
+--- com.android.support:support-vector-drawable:23.4.0 (*)
+--- com.android.support:gridlayout-v7:23.4.0
| \--- com.android.support:support-v4:23.4.0 (*)
+--- com.android.support.constraint:constraint-layout:1.0.0-alpha3
| \--- com.android.support.constraint:constraint-layout-solver:1.0.0-alpha3
+--- com.google.android.gms:play-services-base:9.0.2
| +--- com.google.android.gms:play-services-basement:9.0.2
| | \--- com.android.support:support-v4:23.0.0 -> 23.4.0 (*)
| +--- com.google.firebase:firebase-common:9.0.2
| | +--- com.google.android.gms:play-services-basement:9.0.2 (*)
| | \--- com.google.android.gms:play-services-tasks:9.0.2
| | \--- com.google.android.gms:play-services-basement:9.0.2 (*)
| \--- com.google.android.gms:play-services-tasks:9.0.2 (*)
+--- com.google.code.gson:gson:2.6.2
+--- ch.halarious:halarious-core:0.14
| \--- com.google.code.gson:gson:2.2.4 -> 2.6.2
+--- com.jakewharton:butterknife:8.0.1
| +--- com.jakewharton:butterknife-annotations:8.0.1 (*)
| \--- com.android.support:support-annotations:23.3.0 -> 23.4.0
+--- com.jakewharton.timber:timber:4.1.2
+--- com.aurelhubert:ahbottomnavigation:1.2.3
| \--- com.android.support:design:23.2.1 -> 23.4.0 (*)
+--- com.squareup.okio:okio:1.8.0
+--- com.squareup.okhttp3:okhttp:3.3.0
| \--- com.squareup.okio:okio:1.8.0
+--- com.squareup.okhttp3:logging-interceptor:3.3.0
| \--- com.squareup.okhttp3:okhttp:3.3.0 (*)
+--- com.squareup.retrofit2:retrofit:2.0.2
| \--- com.squareup.okhttp3:okhttp:3.2.0 -> 3.3.0 (*)
+--- com.squareup.retrofit2:converter-gson:2.0.2
| +--- com.squareup.retrofit2:retrofit:2.0.2 (*)
| \--- com.google.code.gson:gson:2.6.1 -> 2.6.2
+--- com.squareup.retrofit2:adapter-rxjava:2.0.2
| +--- com.squareup.retrofit2:retrofit:2.0.2 (*)
| \--- io.reactivex:rxjava:1.1.1 -> 1.1.5
+--- com.squareup.picasso:picasso:2.5.2
+--- com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2
| +--- com.squareup.picasso:picasso:2.5.2
| \--- com.squareup.okhttp3:okhttp:3.0.1 -> 3.3.0 (*)
+--- io.reactivex:rxjava:1.1.5
+--- io.reactivex:rxandroid:1.2.0
| \--- io.reactivex:rxjava:1.1.4 -> 1.1.5
+--- nl.littlerobots.rxlint:rxlint:1.0
+--- com.artemzin.rxjava:proguard-rules:1.1.5.0
+--- com.squareup.sqldelight:runtime:0.3.2
| \--- com.android.support:support-annotations:23.1.1 -> 23.4.0
+--- com.android.support:support-annotations:23.1.1 -> 23.4.0
\--- javax.annotation:jsr250-api:1.0
As outlined, the problem is dagger. You need to add apt 'com.squareup:javapoet:1.7.0'
to your code.
When I have this in my dependencies I get the error. I
def daggerVersion = '2.4'
apt "com.google.dagger:dagger-compiler:${daggerVersion}"
compile "com.google.dagger:dagger:${daggerVersion}"
provided 'javax.annotation:jsr250-api:1.0'
compile 'com.google.guava:guava:19.0'
apt 'com.squareup:javapoet:1.7.0'
provided 'com.squareup:javapoet:1.7.0'
// Code generation
def autoValueVersion = '1.2'
def autoValueParcelVersion = '0.2.2'
def autoValueGsonVersion = '0.3.1'
def autoValueRedactVersion = '1.0.0'
apt "com.google.auto.value:auto-value:${autoValueVersion}"
provided "com.google.auto.value:auto-value:${autoValueVersion}"
apt "com.ryanharter.auto.value:auto-value-parcel:${autoValueParcelVersion}"
provided "com.ryanharter.auto.value:auto-value-parcel:${autoValueParcelVersion}"
apt "com.ryanharter.auto.value:auto-value-gson:${autoValueGsonVersion}"
provided "com.ryanharter.auto.value:auto-value-gson:${autoValueGsonVersion}"
apt "com.squareup.auto.value:auto-value-redacted:${autoValueRedactVersion}"
provided "com.squareup.auto.value:auto-value-redacted:${autoValueRedactVersion}"
// Optionally for TypeAdapter support
compile "com.ryanharter.auto.value:auto-value-parcel-adapter:${autoValueParcelVersion}"
Try adding apt 'com.squareup:javapoet:1.7.0'
before dagger, otherwise the version bundled in dagger will be on the classpath.
thx that works.
I've observed the error when I had an incorrect AutoValue'd class definition, for example when my Builder definition does not match the data class definition.
Correcting the AutoValue definition fixed the error.
This was the error reported:
SomeRandomClass.java:27: error: package com.ryanharter.auto.value.gson does not exist import com.ryanharter.auto.value.gson.AutoValueGsonTypeAdapterFactory; ^ MyAutoValueClass.java:30: error: Parameter type of setter method should be int to match getter MyAutoValueClass.type Builder
type(@NonNull Type type); ^
My definition incorrectly had: public abstract int type();
- NB int
, not Type
.
I was using:
Hi,
I tried to update to the latest 0.2.2 and I have this error while compiling.
I use those AutoValue versions:
Everything ok on 0.2.1