2015-12-03 71 views
2

我正在開發一個android/PHP應用程序,我正在使用MySQL數據庫。當我執行代碼時,我發現了這個問題。我添加了庫android_http_client-0.2-sources.jar,但我仍然有同樣的問題。 這就是我在logcat中獲得:無法找到可選庫

warning:unable to findoptional library:android_http_client-0.2-sources.jar 

這是build.gradle

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 'Google Inc.:Google APIs:23' 
buildToolsVersion "23.0.2" 

defaultConfig { 
    applicationId "com.example.mouna.androidproject" 
    minSdkVersion 15 
    targetSdkVersion 23 
    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:23.1.1' 
compile 'com.android.support:design:23.1.1' 
} 
android { 
useLibrary 'android_http_client-0.2-sources.jar' 
} 
+1

歡迎StackOverf低!我剛剛編輯您的帖子以刪除「tks尋求幫助」。 「希望這會有所幫助」,「謝謝」和「你好」等表達的禮貌在技術寫作中都是同樣存在問題的。 **堆棧溢出作爲問答網站,致力於成爲類似於百科全書的技術資源。這種寫作風格使其作爲一種技術資源非常有用,排除了愉快和形式。**除去「謝謝」的原因與「希望這有助於」的原因完全相同,並不在每個維基百科頁面的底部。 http://meta.stackoverflow.com/questions/288160/no-thanks-damn-it – naXa

回答

0

試試這個

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 'Google Inc.:Google APIs:23' 
    buildToolsVersion "23.0.2" 
    useLibrary 'org.apache.http.legacy' 
... 

,並在底部刪除:

android { 
    useLibrary 'android_http_client-0.2-sources.jar' 
} 
+0

謝謝你,盧卡,這是工作 – mouna