_067_android_androidStudio沒有httpclient的解決辦法
阿新 • • 發佈:2018-12-21
轉自https://blog.csdn.net/u014727233/article/details/51985429,感謝作者的無私分享。
1.build.gradle(module:app)中新增下列兩行程式碼
android { compileSdkVersion 24 buildToolsVersion "23.0.3" useLibrary 'org.apache.http.legacy' defaultConfig { applicationId "com.newbest.smarthome.howtoaddhttpclient" minSdkVersion 18 targetSdkVersion 24 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.0.0' compile "org.apache.httpcomponents:httpcore:4.3.2" }
2.點選頂部選單欄的"sync project with gradle files",整理gradle完畢即可使用httpclient