Build with dependency on support-appcompat-v7.

Thanks to the awesome work of mvdan, this was mostly ready to roll.
However, I had to wrestle for a while for two reasons:

 1) I forgot to add the dependency in the build.gradle file (it was
    already present in settings.gradle)
 2) My IDE was unable to read the ANDROID_HOME env variable, and
    despite my internet-search-fu, I couldn't figure out how to
    make IntelliJ specify env variables for a gradle build. It took
    a while to figure out, because it was failing silently in weird
    ways.

After slaving away on a nice method to parse both the ANDROID_HOME
and the local.properties file (looking for sdk.dir), and then emmiting
nice error messages if neither were found or pointed to an invalid
location, I discovered it had already be done:

android.plugin.sdkDirectory ends up here:

https://android.googlesource.com/platform/tools/build/+/master/gradle/src/main/groovy/com/android/build/gradle/internal/Sdk.groovy#161

Which does exactly all that and more. So now sdkLoc is initialized to
the value of android.plugin.sdkDirectory.
This commit is contained in:
Peter Serwylo 2014-05-20 12:41:50 +10:00 committed by Peter Serwylo
parent 728d1467b9
commit 58ff02a3f4
2 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,7 @@
android:versionName="0.69-test" > android:versionName="0.69-test" >
<uses-sdk <uses-sdk
android:minSdkVersion="5" android:minSdkVersion="7"
android:targetSdkVersion="19" /> android:targetSdkVersion="19" />
<supports-screens <supports-screens

View File

@ -7,16 +7,18 @@ buildscript {
} }
} }
def toolVersion = "19.1"
apply plugin: 'android' apply plugin: 'android'
sdkLoc = System.getenv("ANDROID_HOME") def toolVersion = "19.1"
sdkLoc = android.plugin.sdkDirectory
FileCollection getAndroidPrebuilt(String apiLevel) { FileCollection getAndroidPrebuilt(String apiLevel) {
files("$sdkLoc/platforms/android-$apiLevel/android.jar") files("$sdkLoc/platforms/android-$apiLevel/android.jar")
} }
dependencies { dependencies {
compile project(':support-v4') compile project(':support-v4')
compile project(':support-appcompat-v7')
compile project(':extern:AndroidPinning') compile project(':extern:AndroidPinning')
compile project(':extern:UniversalImageLoader:library') compile project(':extern:UniversalImageLoader:library')
compile project(':extern:MemorizingTrustManager') compile project(':extern:MemorizingTrustManager')
@ -137,4 +139,3 @@ subprojects {
} }
} }
} }