I attempted to add an Android library from source as shown in the accepted answer to:
Adding Library Source into Android Studio
I'm getting an error in the build.gradle file:
Error:(4, 0) Could not get unknown property 'supportLibVersion' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Here is my build.gradle file:
apply plugin: 'com.android.library'
dependencies {
compile "com.android.support:support-annotations:${supportLibVersion}"
compile "com.android.support:support-v4:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile rootProject.ext.dep.timber
compile rootProject.ext.dep.okhttp3
compile rootProject.ext.dep.lost
...
I can see the library has a file named dependencies.gradle that contains the following:
ext {
minSdkVersion = 15
targetSdkVersion = 25
compileSdkVersion = 25
buildToolsVersion = "25.0.2"
versionCode = 11
versionName = "5.0.0"
supportLibVersion = "25.2.0"
...
It appears this is where the property is defined, but I think it isn't being seen during the build process. The dependencies.gradle is one level above the build.gradle file, and this may explain why the property isn't seen after I imported the Gradle project. The original library source can be found at:
What is the best way to fix this?
Thanks
Mitch