diff --git a/build.gradle b/build.gradle index ff8eea676..9508c9516 100644 --- a/build.gradle +++ b/build.gradle @@ -6,11 +6,11 @@ buildscript { dependencies { 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' repositories { @@ -25,12 +25,12 @@ dependencies { } android { - compileSdkVersion 21 - buildToolsVersion "21.1.2" + compileSdkVersion 22 + buildToolsVersion "22.0.1" defaultConfig { minSdkVersion 14 - targetSdkVersion 21 + targetSdkVersion 22 } lintOptions { diff --git a/create-signed-android-release.sh b/create-signed-android-release.sh index c8e15116b..c38eee85d 100755 --- a/create-signed-android-release.sh +++ b/create-signed-android-release.sh @@ -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])"` 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])"` +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" ]; then @@ -41,11 +43,11 @@ if [ "x$4" != "x" ]; APP_VERSION=$4 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 -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:" ls -lh "${APP_NAME}-${APP_VERSION}.apk"