2017-03-02 37 views
-2

我的项目有与org.apache.http库有关的编译错误,如image所示。该项目符合API编制25org.apache.http编译错误

我的build.gradle文件:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 

    defaultConfig { 
     applicationId "com.seffalabdelaziz.crazyman" 
     minSdkVersion 11 
     targetSdkVersion 25 
     compileOptions { 
      sourceCompatibility JavaVersion.VERSION_1_5 
      targetCompatibility JavaVersion.VERSION_1_5 
     } 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     } 
    } 
} 
+2

给予适当的标题,以帮助您更好地 – Noorul

回答

0

尝试添加

android { 
    useLibrary 'org.apache.http.legacy' 
} 

所以最后它变成

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    useLibrary 'org.apache.http.legacy' 

    defaultConfig { 
     applicationId "com.seffalabdelaziz.crazyman" 
     minSdkVersion 11 
     targetSdkVersion 25 
     compileOptions { 
      sourceCompatibility JavaVersion.VERSION_1_7 
      targetCompatibility JavaVersion.VERSION_1_7 
     } 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     } 
    } 
}