使用gradle构建一个java项目以集成到Android Studio项目中

时间:2014-08-31 19:53:38

标签: java android gradle spotify

我试图用Spotify(Java)web api包装器构建一个jar文件,然后将包装器作为模块集成到我的android studio项目中。

我试图构建的java项目在这里:  https://github.com/thelinmichael/spotify-web-api-java

到目前为止,我的build.gradle文件是这样的:

apply plugin: 'java'

repositories{
    mavenLocal()
    mavenCentral()
}

dependencies{
    compile "com.google.protobuf:protobuf-java:2.5.0"
    compile "net.sf.json-lib:json-lib:2.4:jdk15"
    compile "com.google.guava:guava:18.0"
    compile "commons-codec:commons-codec:1.5"
    compile "commons-httpclient:commons-httpclient:2.0.2"

    compile "org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-httpclient:2.0.2_1"


    compile "org.apache.geronimo.bundles:commons-httpclient:3.1_2"
    compile "org.apache.httpcomponents:httpclient:4.3.5"
    compile "org.apache.httpcomponents:httpmime:4.3.5"
    compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
 }

当我尝试运行gradle build时,我收到了以下错误:

Error:(46, 52) cannot find symbol variable BROWSER_COMPATIBILITY
Error:(46, 11) cannot find symbol method getParams()
Error:(47, 11) cannot find symbol method getParams()

Error:(69, 13) cannot find symbol method setRequestEntity(org.apache.commons.httpclient.methods.StringRequestEntity)

Error:(74, 52) cannot find symbol variable BROWSER_COMPATIBILITY
Error:(74, 11) cannot find symbol method getParams()
Error:(75, 11) cannot find symbol method getParams()

注意:某些输入文件使用未经检查或不安全的操作。

注意:使用-Xlint重新编译:取消选中以获取详细信息。

Error:Execution failed for task ':wrapper:compileReleaseJava'.
Compilation failed; see the compiler error output for details.
Information:
BUILD FAILED
Information:Total time: 4.266 secs
Information:8 errors
Information:30 warnings

完整的控制台输出在这里:

http://pastebin.com/vDeEzi8A

如何解决缺失的符号问题?我尝试直接在依赖关系中添加http-client的jar文件,如下所示:

compile files('libs/httpcore-4.3.5.jar')
compile files('libs/httpclient-4.3.5.jar')
compile files('libs/httpclient-cache-4.3.5.jar')
compile files('libs/httpmime-4.3.5.jar')
compile files('libs/commons-codec-1.6.jar')
compile files('libs/commons-logging-1.1.3.jar')
compile files('libs/fluent-hc-4.3.5.jar')

但它也没有用。我打算做的是获取生成的jar文件,然后将其添加到我的Android Studio项目并能够使用包装器。这也是将一个包装器添加到android项目的正确方法吗? 任何帮助非常感谢。

由于

0 个答案:

没有答案