[BUG] NoSuchFieldError / files found with path 'META-INF/DEPENDENCIES' error on android
See original GitHub issueDescribe the bug
Code fails for android. While compiling, we get files found with path 'META-INF/DEPENDENCIES'
error. If we resolve this by excluding dependencies by adding packaging Block, then gets a runtime error NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier
To Reproduce
Steps to reproduce the behavior:
Just call the as[Type]()
method and you will encounter this problem.
Expected behavior A request made to the URL
Stack trace
java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes2.dex)
Environmental Data:
- Java Version : 16
- Library Version : Latest
Additional context The main problem is that while building APK, we can’t include the META-INF/DEPENDENCIES’. And excluding it result in this error.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
Top Results From Across the Web
than one file was found with OS independent path 'META-INF ...
In my case it was enough to exclude only path 'META-INF/DEPENDENCIES' on yourProject/app/build.gradle inside android{} . Here it is
Read more >than one file was found with OS independent path 'META-INF ...
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > More than one file was found with OS ...
Read more >Known issues with Android Studio and Android Gradle Plugin
Scanning a large number of directories and files may lead to out of memory errors. For more information on this issue, read the...
Read more >How to Resolve the NoSuchFieldError in Java - Rollbar
NoSuchFieldError in Java is thrown when an application accesses or modifies a field of an object/class that no longer contains that field.
Read more >Custom BugChecker test error: java.lang.NoSuchFieldError
NoSuchFieldError : ANNOTATION_PROCESSOR_MODULE_PATH. I debugged and found that this exception comes from StandardLocation.java that is present on rt.jar ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m not really clear on what the issue is but it’s a problem with Apache HttpClient and not with Unirest
https://github.com/Kong/unirest-java/discussions/429