Last active
December 17, 2015 13:38
-
-
Save khris/5618059 to your computer and use it in GitHub Desktop.
(OUTDATED) Real Android appplication project with Gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
**CAUTION** | |
This boilerplate code is useless at least about importing dependencies for | |
support libraries and Google service libraries. See | |
[this post](https://plus.google.com/u/0/+AndroidDevelopers/posts/4Yhpn6p9icf). | |
But it is useful for 3rd party libraries that doesn't `aar` yet. | |
*/ | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.4' | |
} | |
} | |
apply plugin: 'android' | |
tasks.withType(Compile) { | |
options.encoding = 'UTF-8' | |
} | |
repositories { | |
mavenCentral() | |
mavenLocal() | |
} | |
dependencies { | |
compile files("${sdkDir}/extras/android/support/v4/android-support-v4.jar", | |
"${sdkDir}/extras/android/support/v7/gridlayout/libs/android-support-v7-gridlayout.jar") | |
compile project(':submodule:android-support-v7-gridlayout') | |
compile 'commons-io:commons-io:2.3' | |
compile 'org.apache.httpcomponents:httpclient:4.2' | |
compile 'org.apache.httpcomponents:httpcore:4.2' | |
compile 'org.apache.httpcomponents:httpmime:4.2' | |
} | |
android { | |
compileSdkVersion 17 | |
buildToolsVersion "17" | |
defaultConfig { | |
minSdkVersion 8 | |
targetSdkVersion 17 | |
} | |
sourceSets { | |
main { | |
manifest.srcFile 'AndroidManifest.xml' | |
java.srcDirs = ['src'] | |
resources.srcDirs = ['src'] | |
aidl.srcDirs = ['src'] | |
renderscript.srcDirs = ['src'] | |
res.srcDirs = ['res'] | |
assets.srcDirs = ['assets'] | |
} | |
} | |
} | |
assemble << { | |
android.applicationVariants.each { variant -> | |
println "$variant.name" | |
copy { | |
from "$projectDir/libs" | |
into "$variant.processJavaResources.destinationDir/lib" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sdkDir=<SDK_PATH> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include ':submodule:android-support-v7-gridlayout' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gist don't allow sub directory in file path. Change underscore with a slash. | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.4' | |
} | |
} | |
apply plugin: 'android-library' | |
dependencies { | |
} | |
android { | |
compileSdkVersion 17 | |
buildToolsVersion "17" | |
defaultConfig { | |
minSdkVersion 8 | |
targetSdkVersion 17 | |
} | |
sourceSets { | |
main.setRoot("${sdkDir}/extras/android/support/v7/gridlayout") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment