오류

2014-12-31 3 views
0

안드로이드 스튜디오에서 에뮬레이터에 내 응용 프로그램을 실행할 때 나는 치명적 오류를 받고 있어요 :오류

모듈 내 build.gradle의
java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/message/BasicLineFormatter; in class Lorg/apache/http/message/BasicLineFormatter; or its superclasses (declaration of 'org.apache.http.message.BasicLineFormatter' appears in /system/framework/ext.jar) 

:

apply plugin: 'com.android.application' 
android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.1" 

    defaultConfig { 
     applicationId "com.htw.roishachor.dbplanupdater" 
     minSdkVersion 19 
     targetSdkVersion 21 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
    } 
} 

내 코드 :

import org.apache.http.HttpEntity; 
import org.apache.http.client.methods.CloseableHttpResponse; 
import org.apache.http.impl.client.*; 
import org.apache.http.client.methods.HttpGet; 


public void myMethod() { 
     CloseableHttpResponse response = null; 
     try{ 
      CloseableHttpClient httpclient = HttpClients.createDefault(); 
      HttpGet httpget = new HttpGet(new URI(INITIAL_URL)); 
      response = httpclient.execute(httpget); 
      HttpEntity entity = response.getEntity(); 
      BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); .... 

이상한 일이

. 나는 그것과 관련이 있는지 모른다. 내 libs와 build 폴더는 AndroidStudio에서 볼 수 없기 때문에 익스플로러에서만 볼 수있다. 튜토리얼에서 각 .jar 파일을 마우스 오른쪽 버튼으로 클릭하고 라이브러리로 추가해야한다는 것을 알았습니다. 그것과 관련이 있습니까? 항아리 내 lib 폴더 안에있는,하지만 언급 한 바와 같이, 난 단지 그들이 내 탐험가에게

답변

0

검토 문서

here 물마루 추가 할 수는 그 chgs이 gradle.build 플러스 최고 수준의 gradle.build에 mavenCentral을 추가 할 수 ... .

allprojects { 
    repositories { 
     mavenCentral() 
    } 
} 

한 다음 m 후 (HC4의 suffx)

import org.apache.http.client.methods.HttpGetHC4; 
import org.apache.http.client.methods.HttpPostHC4; 
import org.apache.http.client.methods.HttpPutHC4; 
import org.apache.http.client.protocol.HttpClientContext; 
import org.apache.http.entity.BufferedHttpEntityHC4; 
import org.apache.http.entity.ByteArrayEntityHC4; 

아파치 버전을 사용해야하는 네임 스페이스 충돌을 확인 그 변화를 받아들이면 예측 결과를 얻어야합니다.