Updated android API (22) and build tools. better handling of those dependencies via make android-deps

This commit is contained in:
renaud gaudin 2015-06-06 17:44:17 +02:00
parent ecbfbc865a
commit ff78dfc47f
2 changed files with 9 additions and 7 deletions

View File

@ -6,11 +6,11 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.2+' classpath 'com.android.tools.build:gradle:1.2+'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+' //classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
} }
} }
apply plugin: 'android-sdk-manager' //apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
repositories { repositories {
@ -25,12 +25,12 @@ dependencies {
} }
android { android {
compileSdkVersion 21 compileSdkVersion 22
buildToolsVersion "21.1.2" buildToolsVersion "22.0.1"
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 21 targetSdkVersion 22
} }
lintOptions { lintOptions {

View File

@ -25,6 +25,8 @@ function die {
APP_NAME=`python -c "from xml.dom.minidom import parse; d=parse('res/values/branding.xml'); print([e.childNodes[0].data.strip() for e in d.getElementsByTagName('string') if e.getAttribute('name') == 'app_name'][-1])"` APP_NAME=`python -c "from xml.dom.minidom import parse; d=parse('res/values/branding.xml'); print([e.childNodes[0].data.strip() for e in d.getElementsByTagName('string') if e.getAttribute('name') == 'app_name'][-1])"`
PACKAGE=`python -c "from xml.dom.minidom import parse; d=parse('AndroidManifest.xml'); print([e.getAttribute('package').strip() for e in d.getElementsByTagName('manifest')][-1])"` PACKAGE=`python -c "from xml.dom.minidom import parse; d=parse('AndroidManifest.xml'); print([e.getAttribute('package').strip() for e in d.getElementsByTagName('manifest')][-1])"`
APP_VERSION=`python -c "from xml.dom.minidom import parse; d=parse('AndroidManifest.xml'); print([e.getAttribute('android:versionName').strip() for e in d.getElementsByTagName('manifest')][-1])"` APP_VERSION=`python -c "from xml.dom.minidom import parse; d=parse('AndroidManifest.xml'); print([e.getAttribute('android:versionName').strip() for e in d.getElementsByTagName('manifest')][-1])"`
TARGET_VERSION=`grep "compileSdkVersion" build.gradle | awk '{print $2}'`
BUILD_VERSION=`grep "buildToolsVersion" build.gradle | awk '{print $2}' | sed 's/"//g'`
if [ "x$2" != "x" ]; if [ "x$2" != "x" ];
then then
@ -41,11 +43,11 @@ if [ "x$4" != "x" ];
APP_VERSION=$4 APP_VERSION=$4
fi fi
../src/dependencies/android-sdk/tools/android update project -p . -n Kiwix -t android-21 ../src/dependencies/android-sdk/tools/android update project -p . -n kiwix -t android-${TARGET_VERSION}
jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore $CERTIFICATE build/outputs/apk/${PACKAGE}-release-unsigned.apk kiwix || die "Error signing the package." jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore $CERTIFICATE build/outputs/apk/${PACKAGE}-release-unsigned.apk kiwix || die "Error signing the package."
jarsigner -verify build/outputs/apk/${PACKAGE}-release-unsigned.apk || die "The package is not properly signed." jarsigner -verify build/outputs/apk/${PACKAGE}-release-unsigned.apk || die "The package is not properly signed."
../src/dependencies/android-sdk/build-tools/21.1.2/zipalign -f -v 4 build/outputs/apk/${PACKAGE}-release-unsigned.apk "${APP_NAME}-${APP_VERSION}.apk" || die "Could not zipalign the signed package. Please check." ../src/dependencies/android-sdk/build-tools/${BUILD_VERSION}/zipalign -f -v 4 build/outputs/apk/${PACKAGE}-release-unsigned.apk "${APP_NAME}-${APP_VERSION}.apk" || die "Could not zipalign the signed package. Please check."
echo "[SUCCESS] Your signed release package is ready:" echo "[SUCCESS] Your signed release package is ready:"
ls -lh "${APP_NAME}-${APP_VERSION}.apk" ls -lh "${APP_NAME}-${APP_VERSION}.apk"