「Android/HttpRequest通信/DefaultHttpClient/legacy」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/methods/HttpGet;エラーが出る場合== 以下追加 app/build.gradle andro...」) |
|||
(同じ利用者による、間の2版が非表示) | |||
行1: | 行1: | ||
==Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/methods/HttpGet;エラーが出る場合== | ==Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/methods/HttpGet;エラーが出る場合== | ||
+ | 以下追加 | ||
+ | app/build.gradle | ||
+ | dependencies { | ||
+ | implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.1' | ||
+ | } | ||
+ | |||
+ | 参考:https://stackoverflow.com/questions/41655015/java-and-httpclient-java-lang-noclassdeffounderror | ||
+ | |||
+ | ==file was found with OS independent path 'META-INF/DEPENDENCIES'エラーとなる場合は== | ||
以下追加 | 以下追加 | ||
app/build.gradle | app/build.gradle | ||
行14: | 行23: | ||
} | } | ||
} | } | ||
− | + | ==httpclient defines classes that conflict with classes now provided by Android.エラーとなる場合は== | |
− | + | 以下追加 | |
+ | app/build.gradle | ||
+ | configurations { | ||
+ | all { | ||
+ | exclude module: 'httpclient' | ||
+ | } | ||
} | } | ||
− | |||
− |
2018年8月6日 (月) 17:39時点における最新版
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/methods/HttpGet;エラーが出る場合
以下追加 app/build.gradle
dependencies { implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.1' }
参考:https://stackoverflow.com/questions/41655015/java-and-httpclient-java-lang-noclassdeffounderror
file was found with OS independent path 'META-INF/DEPENDENCIES'エラーとなる場合は
以下追加 app/build.gradle
android { packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/ASL2.0' } }
httpclient defines classes that conflict with classes now provided by Android.エラーとなる場合は
以下追加 app/build.gradle
configurations { all { exclude module: 'httpclient' } }