Add local android support library to a gradle buil

2019-09-01 16:19发布

问题:

I'm having trouble figuring out how to add android support library to a gradle build, without using SDK Deployer to add the library to mavenLocal. The main problem is how to configure the build to use the location on a local file system to resolve support library dependencies specified in the build file.

回答1:

Figured this out. In case anyone else is trying to do the same, you need to add the local support library location to the gradle build repositories configuration in your build.gradle file, like so (substituting path_to_sdk, of course):

repositories {
    ... other repositories ...
    maven {
        url 'file://path_to_sdk/extras/android/m2repository'
    }
}