google-maps-services-java
google-maps-services-java copied to clipboard
java.lang.NoClassDefFoundError: okhttp3/Interceptor
java.lang.NoClassDefFoundError: okhttp3/Interceptor
at com.google.maps.GeoApiContext$Builder.<init>(GeoApiContext.java:389)
Caused by: java.lang.ClassNotFoundException: okhttp3.Interceptor
at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 9 more
Environment details
- Java 11
- Mac OS X 12.3.1
-
com.google.maps:google-maps-services:2.1.0
Code example
new GeoApiContext.Builder().apiKey("...")
Additional information
The issue does not exist on com.google.maps:google-maps-services:2.0.0
Happens on java 8 also An error occurred while executing a save: java.lang.NoClassDefFoundError: okhttp3/Interceptor] (APNX-1-4198-000)
I see the okhttp 5.0.0-alpha7 jar has no class files in it. Is this a Java 9 modules thing? An issue with how okhttp published it?
❯ zipinfo okhttp-5.0.0-alpha.7.jar
Archive: okhttp-5.0.0-alpha.7.jar
Zip file size: 13361 bytes, number of entries: 20
drwxr-xr-x 2.0 unx 0 b- defN 22-Apr-27 03:58 META-INF/
-rw-r--r-- 2.0 unx 25 b- defN 22-Apr-27 03:58 META-INF/MANIFEST.MF
-rw-r--r-- 2.0 unx 811 b- defN 22-Apr-27 03:58 META-INF/kotlin-project-structure-metadata.json
drwxr-xr-x 2.0 unx 0 b- defN 22-Apr-27 03:58 commonMain/
drwxr-xr-x 2.0 unx 0 b- defN 22-Apr-27 03:58 commonMain/default/
drwxr-xr-x 2.0 unx 0 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/
drwxr-xr-x 2.0 unx 0 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/root_package/
-rw-r--r-- 2.0 unx 12 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/root_package/0_.knm
drwxr-xr-x 2.0 unx 0 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/package_okhttp3.internal.http/
-rw-r--r-- 2.0 unx 2751 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/package_okhttp3.internal.http/1_http.knm
-rw-r--r-- 2.0 unx 910 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/package_okhttp3.internal.http/0_http.knm
drwxr-xr-x 2.0 unx 0 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/package_okhttp3/
-rw-r--r-- 2.0 unx 8627 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/package_okhttp3/0_okhttp3.knm
drwxr-xr-x 2.0 unx 0 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/package_okhttp3.internal/
-rw-r--r-- 2.0 unx 650 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/package_okhttp3.internal/0_internal.knm
-rw-r--r-- 2.0 unx 1589 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/package_okhttp3.internal/2_internal.knm
-rw-r--r-- 2.0 unx 6109 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/package_okhttp3.internal/1_internal.knm
-rw-r--r-- 2.0 unx 75 b- defN 22-Apr-27 03:58 commonMain/default/linkdata/module
-rw-r--r-- 2.0 unx 95 b- defN 22-Apr-27 03:58 commonMain/default/manifest
drwxr-xr-x 2.0 unx 0 b- defN 22-Apr-27 03:58 commonMain/default/resources/
20 files, 21654 bytes uncompressed, 10097 bytes compressed: 53.4%
okhttp 4.9.3 has class files
@arriolac is there any update or timeline for a fix?
okhttp Version 5.0.0-alpha.4 is the first version without class files.
New: Change the build from Kotlin-JVM to Kotlin-multiplatform (which includes JVM). Both native and JavaScript platforms are unstable preview releases and subject to backwards-incompatible changes in forthcoming releases.
I filed #839, which should resolve this issue.
If it is related to the kotlin-multiplatform change, that's here - https://github.com/square/okhttp/commit/3ad1912f783e108b3d0ad2c4a5b1b89b827e4db9.
@swankjesse, do you have any insight, could this NoClassDefFoundError be related to that commit
We’re tracking this here: https://github.com/square/okhttp/issues/7339
In 5.x we adopted a Gradle feature for resolving artifacts that doesn’t work in Maven, so we’re going to update our builds to not require that feature.
thanks! Does that issue apply even when just the library (google-maps-services-java) depends on okhttp3 and the app does not?
Any updates on the fix?
It would be nice if one of the maintainers had a look at #839.
Same problem here, due to this issue we can't update the jar from 2.0.0 to 2.1.0
:tada: This issue has been resolved in version 2.1.1 :tada:
The release is available on:
-
v2.1.1
- GitHub release
Your semantic-release bot :package::rocket:
Any reason why the latest maven release is still v2.1.0?
https://search.maven.org/search?q=a:google-maps-services
https://mvnrepository.com/artifact/com.google.maps/google-maps-services
Any reason why the latest maven release is still v2.1.0?
https://search.maven.org/search?q=a:google-maps-services
https://mvnrepository.com/artifact/com.google.maps/google-maps-services
+1
Oops - looks like something borked in the release action. Just published as 2.1.2
I just cloned the repo, built a jar with gradlew that's labeled 2.1.2 but I'm getting this error when I move the JAR to another project:
Exception in thread "main" java.lang.NoClassDefFoundError: okhttp3/Interceptor
at com.google.maps.GeoApiContext$Builder.
Any ideas?
getting the same error with 2.2.0.
Caused by: java.lang.ClassNotFoundException: okhttp3.Interceptor not found by google-maps-2.1.0 [642] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1597) at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1982) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 158 common frames omitted