facebook twitter hatena line email

「Android/HttpRequest通信/DefaultHttpClient/legacy」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(Admin がページ「Android/HttpRequest通信/apache」を「Android/HttpRequest通信/DefaultHttpClient/legacy」に、リダイレクトを残さずに移動しました)
 
行9: 行9:
  
 
==file was found with OS independent path 'META-INF/DEPENDENCIES'エラーとなる場合は==
 
==file was found with OS independent path 'META-INF/DEPENDENCIES'エラーとなる場合は==
 
 
以下追加
 
以下追加
 
app/build.gradle
 
app/build.gradle
行23: 行22:
 
         exclude 'META-INF/ASL2.0'
 
         exclude 'META-INF/ASL2.0'
 
     }
 
     }
 +
}
 +
==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'
   }
}