Java Can';t解决警告:找不到可选库:org.apache.http.legacy
我正在遵循一个教程,它一开始运行得很顺利,但出现了一些不推荐的问题。我是编程新手,我尝试了一些我读过的解决方案,但没有一个解决了这个问题。我还尝试在org.apache.http.legacy上粘贴一些代码,它位于C:\Users\Username\AppData\Local\Android\sdk\platforms\Android-23\optional。。但是我不知道如何打开那个文件,所以我试着用记事本打开它。。。。代码如下所示Java Can';t解决警告:找不到可选库:org.apache.http.legacy,java,android,apache,android-studio,deprecated,Java,Android,Apache,Android Studio,Deprecated,我正在遵循一个教程,它一开始运行得很顺利,但出现了一些不推荐的问题。我是编程新手,我尝试了一些我读过的解决方案,但没有一个解决了这个问题。我还尝试在org.apache.http.legacy上粘贴一些代码,它位于C:\Users\Username\AppData\Local\Android\sdk\platforms\Android-23\optional。。但是我不知道如何打开那个文件,所以我试着用记事本打开它。。。。代码如下所示 [ { "name": "org.apache
[
{
"name": "org.apache.http.legacy",
"jar": "org.apache.http.legacy.jar",
"manifest": false
}
]
我还在usebrary'org.apache.http.legacy'上添加了一个扩展文件名。。像usebrary'org.apache.http.legacy.jar'
但是什么也没发生
还可以更改不同的类路径,如
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.android.tools.build:gradle:1.3.0'
即使是在
compileSdkVersion 23
buildToolsVersion "23.0.2"
很多人都在尝试粘贴、更改、删除、剪切和替换,但都有一些尝试和错误。。我做的这件事是一个评论,因为我有一个里亚尔和他们的错误
// compile fileTree(dir: 'libs', include: ['*.jar'])
// compile files('libs/org.apache.http.legacy.jar')
///////////////
//compile 'com.google.http-client:google-http-client-android:+'
//
//compile 'com.google.api-client:google-api-client-android:+'
//
//compile 'com.google.api-client:google-api-client-gson:+'
//
//compile 'com.google.code.gson:gson:2.2.4'
}
//apply plugin: 'com.android.application'
//
//android {
// compileSdkVersion 23
// buildToolsVersion "23.0.2"
//
// defaultConfig {
// applicationId "com.example.--------.-----------"
// minSdkVersion 19
// targetSdkVersion 23
// }
// buildTypes {
// release {
// minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// }
// }
//
//}
//
//dependencies {
//
// compile project(':comtaxibulgariamap_mapsforge_044201406271417533')
// compile fileTree(include: ['*.jar'], dir: 'libs')
//}
非常感谢您提供的任何帮助。请尝试下面的代码,它对我来说工作正常
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "calib.inspectionpro.app"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
}getDefaultProguardFile无法解析符号。。它仍然有一条消息警告:找不到可选库:org.apache.http.legacy它还突出显示了这一部分——编译“com.google.code.gson:gson:2.3”。。。你有什么建议吗?顺便说一句,谢谢你们的回复。很抱歉,我并没有找到任何解决方案。但我用上面的代码做了一个示例,并没有得到任何错误。看看这个。
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile files('libs/commons-lang-2.0.jar')
compile files('libs/commons-io-2.4.jar')
compile 'org.apache.commons:commons-lang3:3.1'
compile 'org.apache.commons:commons-lang3:3.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'