无法找到可选库

时间:2015-12-03 10:38:57

标签: android mysql

我正在开发一个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 个答案:

答案 0 :(得分: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'
}