diff --git a/.gitmodules b/.gitmodules
index a096fd79b..ae7580289 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -36,7 +36,7 @@
 	ignore = dirty
 [submodule "extern/android-support-v4-preferencefragment"]
 	path = extern/android-support-v4-preferencefragment
-	url = https://github.com/CyberEagle/android-support-v4-preferencefragment.git
+	url = https://github.com/kolavar/android-support-v4-preferencefragment.git
 	ignore = dirty
 [submodule "extern/zxing-core"]
 	path = extern/zxing-core
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e45eee306..bd0a7d225 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@
 
 * Show when packages are installed but not via F-Droid (mismatching signature)
 
+* Enable building F-Droid without having to build all dependencies yourself
+
 ### 0.78 (2014-12-31)
 
 * Fix repo updates on 5.0 (which caused no apps to show on clean installs)
diff --git a/F-Droid/AndroidManifest.xml b/F-Droid/AndroidManifest.xml
index 1a637a095..3cde9b343 100644
--- a/F-Droid/AndroidManifest.xml
+++ b/F-Droid/AndroidManifest.xml
@@ -7,6 +7,7 @@
     android:versionName="0.79-test" >
 
     <uses-sdk
+        tools:overrideLibrary="org.thoughtcrime.ssl.pinning"
         android:minSdkVersion="7"
         android:targetSdkVersion="21" />
 
diff --git a/F-Droid/build.gradle b/F-Droid/build.gradle
index 369ae742e..606e164df 100644
--- a/F-Droid/build.gradle
+++ b/F-Droid/build.gradle
@@ -1,19 +1,128 @@
 apply plugin: 'com.android.application'
 
-dependencies {
-    compile project(':support-v4')
-    compile project(':support-appcompat-v7')
-    compile project(':extern:AndroidPinning')
-    compile project(':extern:UniversalImageLoader:library')
-    compile project(':extern:MemorizingTrustManager')
-    compile project(':extern:libsuperuser:libsuperuser')
-    compile project(':extern:nanohttpd:core')
-    compile project(':extern:jmdns')
-    compile project(':extern:zipsigner')
-    compile project(':extern:zxing-core')
-    compile( project(':extern:android-support-v4-preferencefragment') ) {
-        exclude module: 'support-v4'
+if ( !hasProperty( 'sourceDeps' ) ) {
+
+    logger.info "Setting up *binary* dependencies for F-Droid (if you'd prefer to build from source, pass the -PsourceDeps argument to gradle while building)."
+
+    repositories {
+        jcenter()
+
+        // This is here until we sort out all dependencies from mavenCentral/jcenter. Once all of
+        // the dependencies below have been sorted out, this can be removed.
+        flatDir {
+            dirs 'libs/binaryDeps'
+        }
     }
+
+    dependencies {
+
+        compile 'com.android.support:support-v4:20.0.+',
+                'com.android.support:appcompat-v7:20.0.+',
+                'com.android.support:support-annotations:20.0.+',
+
+                'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0',
+                'javax.jmdns:jmdns:3.4.1',
+                'com.nostra13.universalimageloader:universal-image-loader:1.9.3',
+                'com.google.zxing:core:3.1.0',
+                'eu.chainfire:libsuperuser:1.0.0.201501121001',
+                'com.madgag.spongycastle:pkix:1.51.0.0',
+                'com.madgag.spongycastle:prov:1.51.0.0',
+                'com.madgag.spongycastle:core:1.51.0.0'
+
+        // Upstream doesn't have a binary on mavenCentral/jcenter yet:
+        // https://github.com/kolavar/android-support-v4-preferencefragment/issues/13
+        compile(name: 'android-support-v4-preferencefragment-release', ext: 'aar')
+
+        // Fork for F-Droid, including support for https. Not merged into upstream
+        // yet (seems to be a little unsupported as of late), so not using mavenCentral/jcenter.
+        compile(name: 'nanohttpd-2.1.0')
+
+        // Upstream doesn't have a binary on mavenCentral.
+        compile(name: 'zipsigner')
+
+        // Upstream doesn't have a binary on mavenCentral, but we are currently not using this
+        // library due to bugs anyway. In the future, it will likely get included again though.
+        // compile(name: 'MemorizingTrustManager-release', ext: 'aar')
+    }
+
+} else {
+
+    logger.info "Setting up *source* dependencies for F-Droid (because you passed in the -PsourceDeps argument to gradle while building)."
+
+    repositories {
+        jcenter()
+    }
+
+    dependencies {
+        compile project(':extern:AndroidPinning')
+        compile project(':extern:UniversalImageLoader:library')
+        compile project(':extern:libsuperuser:libsuperuser')
+        compile project(':extern:nanohttpd:core')
+        compile project(':extern:jmdns')
+        compile project(':extern:zipsigner')
+        compile project(':extern:zxing-core')
+        compile( project(':extern:android-support-v4-preferencefragment') ) {
+            exclude module: 'support-v4'
+        }
+
+        // Until the android team updates the gradle plugin version from 0.10.0 to
+        // a newer version, we can't build this from source with our gradle version
+        // of 1.0.0. They use API's which have been moved in the newer plugin.
+        // So yes, this is a little annoying that our "source dependencies" include
+        // a bunch of binaries from jcenter - but the ant build file (which is the
+        // one used to build F-Droid which is distributed on https://f-droid.org
+        // builds these from source - well - not support-v4).
+        //
+        // If the android team gets the build script working with the newer plugin,
+        // then you can find the relevant portions of the ../build.gradle file that
+        // include magic required to make it work at around about the v0.78 git tag.
+        // They have since been removed to clean up the build file.
+        compile 'com.android.support:support-v4:20.0.+',
+                'com.android.support:appcompat-v7:20.0.+',
+                'com.android.support:support-annotations:20.0.+'
+
+        // Removed for now, until it is reimplemented.
+        // compile project(':extern:MemorizingTrustManager')
+    }
+
+}
+
+task cleanBinaryDeps(type: Delete) {
+
+    enabled = project.hasProperty('sourceDeps')
+    description = "Removes all .jar and .aar files from F-Droid/libs/. Requires the sourceDeps property to be set (\"gradle -PsourceDeps cleanBinaryDeps\")"
+
+    delete fileTree('libs/binaryDeps') {
+        include '*.aar'
+        include '*.jar'
+    }
+}
+
+task binaryDeps(type: Copy, dependsOn: ':F-Droid:prepareReleaseDependencies') {
+
+    enabled = project.hasProperty('sourceDeps')
+    description = "Copies .jar and .aar files from subproject dependencies in extern/ to F-Droid/libs. Requires the sourceDeps property to be set (\"gradle -PsourceDeps binaryDeps\")"
+
+    from ('../extern/' ) {
+        include 'android-support-v4-preferencefragment/build/outputs/aar/android-support-v4-preferencefragment-release.aar',
+                'nanohttpd/core/build/libs/nanohttpd-2.1.0.jar',
+                'zipsigner/build/libs/zipsigner.jar',
+                'Support/v4/build/libs/support-v4.jar'
+
+                // Removed for now, until it is reimplemented.
+                // 'MemorizingTrustManager/build/outputs/aar/MemorizingTrustManager-release.aar'
+    }
+
+    into 'libs/binaryDeps'
+
+    includeEmptyDirs false
+
+    eachFile { FileCopyDetails details ->
+        // Don't copy to a sub folder such as libs/binaryDeps/Project/build/outputs/aar/project.aar, but
+        // rather libs/binaryDeps/project.aar.
+        details.path = details.name
+    }
+
 }
 
 android {
@@ -62,7 +171,7 @@ android {
 
 }
 
-// TODO: This person took the example code below from another blogpost online, however
+// This person took the example code below from another blogpost online, however
 // I lost the reference to it:
 // http://stackoverflow.com/questions/23297562/gradle-javadoc-and-android-documentation
 android.applicationVariants.all { variant ->
diff --git a/F-Droid/libs/README.md b/F-Droid/libs/README.md
new file mode 100644
index 000000000..a338d672c
--- /dev/null
+++ b/F-Droid/libs/README.md
@@ -0,0 +1,50 @@
+# Licenses
+
+To see which license any one of these libraries is under, consult the extern/ directory.
+If you have checked out the source for all dependencies (`git submodule update --init` from the root directory),
+then you should be able to find the relevant LICENSE file for each, or else you can consult upstream.
+
+
+# Building libraries from source
+
+As a matter of principle, and also to comply with the GPLv3+, F-Droid should always be able to be built
+from source, _including all of its dependencies_.
+
+For practical reasons, developers often don't want the overhead of having to fetch the source of each
+dependency though. Also, they may not want their build script to have to take the time to configure and
+check that each subproject is up-to-date. Building from binary dependencies is _much_ faster, requires
+less downloading of external source, and should import into Android Studio and other IDE's more easily.
+
+To deal with these two goals (building dependencies from source, and relying on prebuilt binaries), the
+build script can be run in two modes.
+
+
+## Gradle commands
+
+`gradle build` will build _F-Droid_ from source, but _not the depenencies_ from source. It will instead depend
+on binaries from jcenter where possible, and .jar and .aar files in F-Droid/libs/binaryDeps elsewhere.
+
+`gradle -PsourceDeps build` will include all dependencies and build the entire F-Droid binary
+and all of its dependencies from source.
+
+`gradle -PsourceDeps binaryDeps` will build all dependencies from source, and then copy the ones which
+are not found in jcenter to F-Droid/libs/binaryDeps, making sure that the latest versions of the libraries are available
+for developers wishing to build F-Droid from binary dependencies.
+
+`gradle -PsourceDeps cleanBinaryDeps` will remove all binary dependencies. It shouldn't be neccesary,
+because the `binaryDeps` will copy fresh .jar and .aar files to the F-Droid/libs/binaryDeps directory when they change.
+It may be handy if you are updating the build script though, as a nice way to empty the F-Droid/libs/binaryDeps directory.
+
+
+# Adding new dependencies
+
+When adding a new dependency, *DON'T* copy the .jar or .aar file into F-Droid/libs/binaryDeps. This will get deleted
+when somebody runs `gradle -PsourceDeps cleanBinaryDeps`. Also, the version of F-Droid built for distribution
+on https://f-droid.org will be build from source depednencies, so adding a binary is not enough.
+
+Instead, you should add the source repo as a submodule in the extern/ diretory. You will also need to modify
+the F-Droid/build.gradle file, adding both the source dependency on the project in the extern/ directory, and
+a dependency on its jcenter/mavenCentral artifact. If that artifact is not available, then you should add
+the library to those to be copied using `gradler -PsourceDeps binaryDeps`. Then, you can commit that binary so that
+anyone who clones the F-Droid repo will have all of the dependencies ready in either jcetner or the
+F-Droid/libs/binaryDeps directory.
diff --git a/F-Droid/libs/android-support-v4.jar b/F-Droid/libs/android-support-v4.jar
index ac4181fca..4ebdaa9ed 100644
Binary files a/F-Droid/libs/android-support-v4.jar and b/F-Droid/libs/android-support-v4.jar differ
diff --git a/F-Droid/libs/android-support-v4.jar.LICENSE b/F-Droid/libs/android-support-v4.jar.LICENSE
deleted file mode 100644
index ca7abc6a3..000000000
--- a/F-Droid/libs/android-support-v4.jar.LICENSE
+++ /dev/null
@@ -1,190 +0,0 @@
-   Copyright (c) 2005-2013, The Android Open Source Project
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-
diff --git a/F-Droid/libs/android-support-v4.jar.README b/F-Droid/libs/android-support-v4.jar.README
deleted file mode 100644
index bcdfce018..000000000
--- a/F-Droid/libs/android-support-v4.jar.README
+++ /dev/null
@@ -1,5 +0,0 @@
-The Android support library v4 is currently at *revision 21.0.1* from the Android SDK.
-This reversion was released on October 2014.
-
-See NOTICE.android-support-v4.txt for license.
-See http://developer.android.com/tools/extras/support-library.html for further info.
diff --git a/F-Droid/libs/android-support-v4.jar.properties b/F-Droid/libs/android-support-v4.jar.properties
deleted file mode 100644
index bc9c2009a..000000000
--- a/F-Droid/libs/android-support-v4.jar.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-src=android-support-v4.jar
-doc=/opt/android-sdk/docs/reference
-# The String value of 'doc' is handed straight to `new java.io.File()` so it
-# is not possible to use variables.  Therefore, change "/opt/android-sdk" to
-# the path to your Android SDK, i.e. the value of $ANDROID_HOME or ${sdk.dir}
-#
-# Here's the relevant source:
-# https://android-review.googlesource.com/#/c/35702/3/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/LibraryClasspathContainerInitializer.java
diff --git a/F-Droid/libs/binaryDeps/android-support-v4-preferencefragment-release.aar b/F-Droid/libs/binaryDeps/android-support-v4-preferencefragment-release.aar
new file mode 100644
index 000000000..2bb041037
Binary files /dev/null and b/F-Droid/libs/binaryDeps/android-support-v4-preferencefragment-release.aar differ
diff --git a/F-Droid/libs/binaryDeps/nanohttpd-2.1.0.jar b/F-Droid/libs/binaryDeps/nanohttpd-2.1.0.jar
new file mode 100644
index 000000000..d19ba71b3
Binary files /dev/null and b/F-Droid/libs/binaryDeps/nanohttpd-2.1.0.jar differ
diff --git a/F-Droid/libs/binaryDeps/zipsigner.jar b/F-Droid/libs/binaryDeps/zipsigner.jar
new file mode 100644
index 000000000..1e741d758
Binary files /dev/null and b/F-Droid/libs/binaryDeps/zipsigner.jar differ
diff --git a/build.gradle b/build.gradle
index 6ad9853ef..fceb47e11 100644
--- a/build.gradle
+++ b/build.gradle
@@ -17,13 +17,22 @@
 
 buildscript {
     repositories {
-        mavenCentral()
+        jcenter()
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:1.0.0'
+
+        // libsuperuser submodule requires these plugins, even though
+        // the F-Droid build process never invokes code from them. It
+        // would be nice to do away with this in the future, so we don't
+        // force people do download stuff they wont use.
+        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
+        classpath 'com.github.dcendents:android-maven-plugin:1.2'
     }
 }
 
+if ( hasProperty( 'sourceDeps' ) ) {
+
 project(':extern:UniversalImageLoader:library') {
 
     apply plugin: 'android-library'
@@ -46,15 +55,6 @@ project(':extern:UniversalImageLoader:library') {
     }
 }
 
-// The support-annotations build.gradle uses the mavenDeployer method, which requires
-// this plugin. Even though no artifacts are being deployed, this is still required
-// for the build script to work.
-project(':support-annotations') {
-
-    apply plugin: 'maven'
-
-}
-
 project(':extern:zipsigner') {
 
     apply plugin: 'java'
@@ -66,79 +66,6 @@ project(':extern:zipsigner') {
     }
 }
 
-project(':support-v4') {
-
-    apply plugin: 'maven'
-
-    // The support-v4 library assumes certain things are defined in the
-    // root project (which is usually the android-support project, but
-    // this time it is the F-Droid project.
-    rootProject.ext.supportRepoOut = ""
-
-}
-
-/**
- * Finds a reference to the prefered Android SDK directory.
- * Ideally we'd use "android.plugin.sdkFolder" to find this, however this is
- * only possible if we apply the android application plugin. This is not ideal,
- * because it will add a bunch of tasks to do with building an android app,
- * even tnough this build.gradle is not here to build F-Droid, it is here to
- * apply hacks to play nicely with various upstream projects.
- *
- * Adapted from https://android.googlesource.com/platform/tools/base/+/c8b776289ace4189406b59a9a9c8c9de63271cb0/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/SdkHandler.java
- *   Copyright (C) 2014 The Android Open Source Project
- *   Licensed under the Apache License, Version 2.0
- *   http://www.apache.org/licenses/LICENSE-2.0i
- */
-def findSdkPath() {
-
-    Properties properties = new Properties()
-    File propFile = file("local.properties")
-    if (propFile.exists()) {
-        propFile.withReader { properties.load(it) }
-    }
-
-    String sdkDirProp = properties.getProperty("sdk.dir");
-    if (sdkDirProp != null) {
-        return new File(sdkDirProp)
-    }
-
-    String envVar = System.getenv("ANDROID_HOME");
-    if (envVar != null) {
-        return new File(envVar);
-    }
-
-    String property = System.getProperty("android.home");
-    if (property != null) {
-        return new File(property);
-    }
-
-    def error = """
-Couldn't find Android SDK. Looked for (in order of precedence):
- * sdk.dir in $propFile
- * ANDROID_HOME environment variable
- * android.home Java property
-"""
-
-    throw new RuntimeException(error)
-}
-
-// Used by the support-v4 libraries build script.
-FileCollection getAndroidPrebuilt(String apiLevel) {
-
-    def file = new File("${findSdkPath()}/platforms/android-$apiLevel/android.jar")
-    if (!file.exists()) {
-        def msg = """
-Android SDK for android-$apiLevel not found (required for building support library).
-Expected to find it at $file.
-Do you have that SDK installed?
-(If it is not visible in the Android SDK Manager, "Packages -> Show Obsolete Packages")
-"""
-        throw new RuntimeException(msg)
-    }
-
-    return files(file)
-
 }
 
 subprojects {
diff --git a/settings.gradle b/settings.gradle
index f8029a65c..812780d2e 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,25 +1,17 @@
 include ':F-Droid'
 
-include ':extern:AndroidPinning'
-include ':extern:UniversalImageLoader:library'
-include ':extern:MemorizingTrustManager'
-include ':extern:libsuperuser:libsuperuser'
-include ':extern:nanohttpd:core'
-include ':extern:jmdns'
-include ':extern:zipsigner'
-include ':extern:spongycastle:core'
-include ':extern:spongycastle:pg'
-include ':extern:spongycastle:pkix'
-include ':extern:spongycastle:prov'
-include ':extern:zxing-core'
-include ':extern:android-support-v4-preferencefragment'
-
-include ':support-v4'
-project(':support-v4').projectDir = new File('extern/Support/v4')
-
-include ':support-appcompat-v7'
-project(':support-appcompat-v7').projectDir = new File('extern/Support/v7/appcompat')
-
-include ':support-annotations'
-project(':support-annotations').projectDir = new File('extern/Support/annotations')
-
+if ( hasProperty( 'sourceDeps' ) ) {
+	include ':extern:AndroidPinning'
+	include ':extern:UniversalImageLoader:library'
+	include ':extern:MemorizingTrustManager'
+	include ':extern:libsuperuser:libsuperuser'
+	include ':extern:nanohttpd:core'
+	include ':extern:jmdns'
+	include ':extern:zipsigner'
+	include ':extern:spongycastle:core'
+	include ':extern:spongycastle:pg'
+	include ':extern:spongycastle:pkix'
+	include ':extern:spongycastle:prov'
+	include ':extern:zxing-core'
+	include ':extern:android-support-v4-preferencefragment'
+}