https://kotlinlang.org logo
Title
n

Nick

08/31/2021, 3:46 PM
Question 1: I’m starting to receive this error more and more frequently, I wiped out my cache yesterday and ran into tons of gradle issues after that, then once i fixed those issues I didn’t run into it again until just now:
java.lang.NoSuchFieldError: No static field ISO8601DATETIME of type Lcom/xxx/android/type/CustomType; in class Lcom/xxx/android/type/CustomType; or its superclasses (declaration of 'com.xxx.android.type.CustomType' appears in /data/data/com.xxx.android/code_cache/.overlay/base.apk/classes18.dex)
Do you think it’s related to this? https://github.com/apollographql/apollo-android/issues/2043
m

mbonnin

08/31/2021, 5:20 PM
That's hard to tell without more context. Does this happen at compile time or run time?
n

Nick

08/31/2021, 5:21 PM
run time
m

mbonnin

08/31/2021, 5:21 PM
Then it's most likely not the same issue
Maybe some R8 thing?
Do you have a full stack trace?
n

Nick

08/31/2021, 5:21 PM
sure, i’ll post it in here when it happens again
👍 1
java.lang.NoSuchFieldError: No static field ISO8601DATETIME of type Lcom/structionsite/android/type/CustomType; in class Lcom/structionsite/android/type/CustomType; or its superclasses (declaration of 'com.structionsite.android.type.CustomType' appears in /data/data/com.structionsite.android/code_cache/.overlay/base.apk/classes18.dex)
        at com.structionsite.android.PinMediaQuery$Node.<clinit>(PinMediaQuery.java:712)
        at com.structionsite.android.PinMediaQuery$Node$Mapper.map(PinMediaQuery.java:851)
        at com.structionsite.android.PinMediaQuery$PinMedia$Mapper$1$1.read(PinMediaQuery.java:692)
        at com.structionsite.android.PinMediaQuery$PinMedia$Mapper$1$1.read(PinMediaQuery.java:689)
        at com.apollographql.apollo.internal.response.RealResponseReader$ListItemReader.readObject(RealResponseReader.kt:274)
        at com.structionsite.android.PinMediaQuery$PinMedia$Mapper$1.read(PinMediaQuery.java:689)
        at com.structionsite.android.PinMediaQuery$PinMedia$Mapper$1.read(PinMediaQuery.java:686)
        at com.apollographql.apollo.internal.response.RealResponseReader.readList(RealResponseReader.kt:142)
        at com.structionsite.android.PinMediaQuery$PinMedia$Mapper.map(PinMediaQuery.java:686)
        at com.structionsite.android.PinMediaQuery$Pin$Mapper$1.read(PinMediaQuery.java:556)
        at com.structionsite.android.PinMediaQuery$Pin$Mapper$1.read(PinMediaQuery.java:553)
        at com.apollographql.apollo.internal.response.RealResponseReader.readObject(RealResponseReader.kt:118)
        at com.structionsite.android.PinMediaQuery$Pin$Mapper.map(PinMediaQuery.java:553)
        at com.structionsite.android.PinMediaQuery$Area$Mapper$1.read(PinMediaQuery.java:429)
        at com.structionsite.android.PinMediaQuery$Area$Mapper$1.read(PinMediaQuery.java:426)
        at com.apollographql.apollo.internal.response.RealResponseReader.readObject(RealResponseReader.kt:118)
        at com.structionsite.android.PinMediaQuery$Area$Mapper.map(PinMediaQuery.java:426)
        at com.structionsite.android.PinMediaQuery$Data$Mapper$1.read(PinMediaQuery.java:329)
        at com.structionsite.android.PinMediaQuery$Data$Mapper$1.read(PinMediaQuery.java:326)
        at com.apollographql.apollo.internal.response.RealResponseReader.readObject(RealResponseReader.kt:118)
        at com.structionsite.android.PinMediaQuery$Data$Mapper.map(PinMediaQuery.java:326)
        at com.structionsite.android.PinMediaQuery$Data$Mapper.map(PinMediaQuery.java:321)
        at com.apollographql.apollo.response.OperationResponseParser$1.read(OperationResponseParser.java:97)
        at com.apollographql.apollo.api.internal.json.ResponseJsonStreamReader.nextObject(ResponseJsonStreamReader.kt:59)
        at com.apollographql.apollo.response.OperationResponseParser.parse(OperationResponseParser.java:92)
        at com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor.parse(ApolloParseInterceptor.java:87)
        at com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor$1.onResponse(ApolloParseInterceptor.java:53)
        at com.apollographql.apollo.internal.interceptor.ApolloServerInterceptor$executeHttpCall$1.onResponse(ApolloServerInterceptor.kt:114)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
I should probably have it generate kotlin modules huh
m

mbonnin

08/31/2021, 5:26 PM
Yea, I was going to suggest that
It's super weird. If
CustomType.ISO8601DATETIME
were not present, I would expect the compilation to fail completely
n

Nick

08/31/2021, 5:27 PM
🤷‍♀️
w

wasyl

09/01/2021, 6:41 AM
Do you use R8 or Keeper plugin? Does it fail when you run the app normally or in instrumented tests?
n

Nick

09/01/2021, 7:48 AM
I did a release build today and received r8 errors at build time. so it must be something related to that.
i’m new to this project, they currently have all code in one module, and i started moving apollo to it’s own module. I assume that’s probably why because when i do a gradle build, I get the error:
ERROR:/Users/nickachtien/Projects/StructionSite_Android/struct_graphql/build/intermediates/runtime_library_classes_jar/release/classes.jar: R8: Type com.structionsite.android.type.CustomType is defined multiple times: /Users/nickachtien/Projects/StructionSite_Android/struct_graphql/build/intermediates/runtime_library_classes_jar/release/classes.jar:com/structionsite/android/type/CustomType.class, /Users/nickachtien/Projects/StructionSite_Android/app/build/intermediates/asm_instrumented_project_classes/prod/com/structionsite/android/type/CustomType.class
w

wasyl

09/01/2021, 8:08 AM
Moving to separate modules is a bug magnet for a lot of stuff 😕 I recommend using
--rerun-tasks
flag if you see such errors, it will rerun tasks but also populate build cache again with, hopefully, correct outputs
🙏 1
n

Nick

09/01/2021, 8:13 AM
eeek, ok thanks
m

Matt Kula

09/20/2021, 7:18 PM
@Nick any chance you were able to figure this out? Was it just a build cache issue? I'm seeing the same thing when trying to upgrade kotlin to add compose to my app
n

Nick

09/20/2021, 7:29 PM
Hi!! This was related to an android studio issue. Try turning off “build automatically “ in settings.
“Build automatically” will be removed in a future android studio version.
m

Matt Kula

09/20/2021, 7:31 PM
Dang that isn't checked for me and I usually do all my building through the command line
n

Nick

09/20/2021, 7:31 PM
(I believe this is it)
Oh shoot.
I haven't ran into issues in a while, but i have also been working on different tasks that wouldn't replicate this issue.