3

I am trying to port my gradle.build over to gradle experimental. I have modified my existing android configuration over as below:

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

However, upon compiling, I seem to get the error:

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

Probably since I am unsure what has useLibrary been modified to. If I comment this out, the build goes on for a significant till it fails to find the http methods it might be expecting from the above library. Can someone please provide some pointers on how do I got about including this library in gradle experimental?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
learn_develop
  • 1,735
  • 4
  • 15
  • 33

2 Answers2

0

This should work to use "org.apache.http.legacy" both regular gradle and gradle-experimental

Remove the useLibrary line:

useLibrary "org.apache.http.legacy"

Add to gradle(module):

dependencies {
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
}
fatih ergin
  • 265
  • 4
  • 10
-1

Hope not too late. Put org.apache.http.legacy.jar file under libs folder... And include this in your dependencies

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}
rajindroid
  • 31
  • 3