Last active
November 20, 2020 11:27
-
-
Save cyrilmottier/6037731 to your computer and use it in GitHub Desktop.
Using the new Gradle-based Android build system: an example
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="config_app_name">AVélib</string> | |
<string name="config_authority">com.cyrilmottier.android.avelib.citybikes</string> | |
<string name="config_com.google.android.maps.v2.api_key">XXX</string> | |
</resources> |
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
apply plugin: 'android' | |
dependencies { | |
compile project(':libs:actionbarsherlock-4.3.1') | |
compile 'com.android.support:support-v4:13.0.0' | |
compile 'com.google.android.gms:play-services:3.1.36' | |
compile files( | |
"libs/gson-2.2.4.jar", | |
"libs/retrofit-1.1.1.jar" | |
) | |
} | |
android { | |
compileSdkVersion 17 | |
buildToolsVersion '17' | |
defaultConfig { | |
minSdkVersion 8 | |
packageName 'com.cyrilmottier.android' | |
targetSdkVersion 17 | |
} | |
signingConfigs { | |
debug { | |
storeFile file("../distribution/debug.keystore") | |
} | |
release { | |
storeFile file("../distribution/release.keystore") | |
storePassword "XXX" | |
keyAlias "XXX" | |
keyPassword "XXX" | |
} | |
} | |
final AUTHORITY_AVELOV_DEBUG = "com.cyrilmottier.android.avelov.citybikes.debug" | |
final AUTHORITY_AVELOV_RELEASE = "com.cyrilmottier.android.avelov.citybikes" | |
final AUTHORITY_AVELIB_DEBUG = "com.cyrilmottier.android.avelib.citybikes.debug" | |
final AUTHORITY_AVELIB_RELEASE = "com.cyrilmottier.android.avelib.citybikes" | |
buildTypes { | |
debug { | |
buildConfig "public static final String AUTHORITY = \"" + AUTHORITY_AVELOV_DEBUG + "\";" | |
packageNameSuffix ".avelov.debug" | |
signingConfig signingConfigs.debug | |
versionNameSuffix "-debug" | |
} | |
release { | |
buildConfig "public static final String AUTHORITY = \"" + AUTHORITY_AVELOV_RELEASE + "\";" | |
packageNameSuffix ".avelov" | |
proguardFile 'config.proguard' | |
runProguard true | |
signingConfig signingConfigs.release | |
} | |
avelibDebug { | |
buildConfig "public static final String AUTHORITY = \"" + AUTHORITY_AVELIB_DEBUG + "\";" | |
packageNameSuffix ".avelib.debug" | |
signingConfig signingConfigs.debug | |
versionNameSuffix "-debug" | |
} | |
avelibRelease { | |
buildConfig "public static final String AUTHORITY = \"" + AUTHORITY_AVELIB_RELEASE + "\";" | |
packageNameSuffix ".avelib" | |
proguardFile 'config.proguard' | |
runProguard true | |
signingConfig signingConfigs.release | |
} | |
} | |
sourceSets { | |
debug { | |
java.srcDirs = [ | |
'src/main/java', | |
'src/avelov/java', | |
'src/debug/java'] | |
res.srcDirs = [ | |
'src/main/res', | |
'src/avelov/res', | |
'src/debug/res'] | |
} | |
release { | |
java.srcDirs = [ | |
'src/main/java', | |
'src/avelov/java', | |
'src/release/java'] | |
res.srcDirs = [ | |
'src/main/res', | |
'src/avelov/res', | |
'src/release/res'] | |
} | |
avelibDebug { | |
java.srcDirs = [ | |
'src/main/java', | |
'src/avelib/java', | |
'src/avelibDebug/java'] | |
res.srcDirs = [ | |
'src/main/res', | |
'src/avelib/res', | |
'src/avelibDebug/res'] | |
} | |
avelibRelease { | |
java.srcDirs = [ | |
'src/main/java', | |
'src/avelib/java', | |
'src/avelibRelease/java'] | |
res.srcDirs = [ | |
'src/main/res', | |
'src/avelib/res', | |
'src/avelibRelease/res'] | |
} | |
} | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.cyrilmottier.android.avelov" | |
android:installLocation="auto" | |
android:versionCode="8" | |
android:versionName="1.2.5" > | |
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> | |
<uses-feature android:name="android.hardware.location" android:required="false" /> | |
<uses-feature android:name="android.hardware.location.network" android:required="false" /> | |
<uses-feature android:name="android.hardware.location.gps" android:required="false" /> | |
<uses-feature android:glEsVersion="0x00020000" android:required="true" /> | |
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | |
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> | |
<application | |
android:allowBackup="true" | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/config_app_name" | |
android:theme="@style/Theme.CityBikes" > | |
<!-- --> | |
<!-- Activities --> | |
<!-- --> | |
<!-- ... --> | |
<!-- --> | |
<!-- Providers --> | |
<!-- --> | |
<provider | |
android:name="com.cyrilmottier.android.citybikes.provider.CityBikesProvider" | |
android:authorities="@string/config_authority" | |
android:exported="false" /> | |
<!-- --> | |
<!-- Google Maps Android API v2 keys --> | |
<!-- --> | |
<meta-data | |
android:name="com.google.android.maps.v2.API_KEY" | |
android:value="@string/config_com.google.android.maps.v2.api_key" /> | |
</application> | |
</manifest> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="config_app_name">AVélov</string> | |
<string name="config_authority">com.cyrilmottier.android.avelov.citybikes</string> | |
<string name="config_com.google.android.maps.v2.api_key">XXX</string> | |
</resources> |
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
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.4.+' | |
} | |
} | |
task wrapper(type: Wrapper) { | |
gradleVersion = '1.6' | |
} |
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 'app' | |
include 'libs:actionbarsherlock-4.3.1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
brilliant.