3

我想將我的gradle.build移植到gradle實驗中。我已經修改了我現有的Android配置,以通過如下:什麼使用庫更改爲gradle實驗0.6.0-alpha1?

android { 
    compileSdkVersion = compileSdk 
    buildToolsVersion = buildTools 
    useLibrary "org.apache.http.legacy" 
    defaultConfig.with { 
     minSdkVersion.apiLevel = 13 
     targetSdkVersion.apiLevel = compileSdk 
     versionName = fullVersion 
     multiDexEnabled = true 
    } 
} 

然而,在編譯時,我似乎得到錯誤:因爲我不能確定什麼useLibrary被修改爲

Error:(148, 1) A problem occurred configuring root project.> Exception thrown while executing model rule:model.android @ build.gradle line 145, column 1> Could not find method useLibrary() for arguments [org.apache.http.legacy] on root project

可能。如果我對此作出評論,構建會繼續進行,直到它無法找到它可能從上述庫中期待的http方法。有人可以提供一些關於如何將這個庫包含在Gradle實驗中的指針嗎?

+0

可能,要去嘗試,如果http://stackoverflow.com/questions/34503431/no-such-property-uselibrary-for-class解決我的問題。 –

+0

任何想法傢伙?我一直無法解決這個問題。 –

回答

-1

希望不會太晚。把org.apache.http.legacy.jar文件libs文件夾下... ,包括這在你的依賴

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
} 
0

這應該使用「org.apache.http.legacy」包括經常和gradle這個的gradle - 實驗

卸下useLibrary行:

useLibrary "org.apache.http.legacy" 

添加到搖籃(模塊):

dependencies { 
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' 
} 
相關問題