Fix Qt for Android build with recent SDK bundle

In the recent revisions of the Android SDK bundle, the dx
tool has moved from platform-tools/ and into
build-tools/<revision-number> where revision-number is 17.0.0 at
the moment. To enable building on these SDKs, we add
detection for the dx tool and an environment variable which
can be set to override the revision number to provide a way
to build it against future revisions as well.

Task-number: QTBUG-31199
Change-Id: I0d6a22163dc2e50f7a81cd3fe8f3d53c6335aaee
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2013-05-16 14:35:54 +02:00 committed by The Qt Project
parent 184e1a37e8
commit 2cde2fca6f

View File

@ -7,6 +7,11 @@ android {
isEmpty(API_VERSION): API_VERSION = android-10
}
isEmpty(BUILD_TOOLS_REVISION) {
BUILD_TOOLS_REVISION = $$(ANDROID_BUILD_TOOLS_REVISION)
isEmpty(BUILD_TOOLS_REVISION): BUILD_TOOLS_REVISION = 17.0.0
}
!exists($$SDK_ROOT/platforms/$$API_VERSION/android.jar) {
error("The Path $$SDK_ROOT/platforms/$$API_VERSION/android.jar does not exist. Make sure the ANDROID_SDK_ROOT and ANDROID_API_VERSION environment variables are correctly set.")
}
@ -56,7 +61,9 @@ android:!bundled_jar_file {
DEX_CMD = $$PWD/data/android/dx $$SDK_ROOT
} else {
DEX_CMD = $$SDK_ROOT/platform-tools/dx
!exists($$DEX_CMD): DEX_CMD = $$SDK_ROOT/build-tools/$$BUILD_TOOLS_REVISION/dx
}
!exists($$DEX_CMD): error("The path $$DEX_CMD does not exist. Please set the environment variable ANDROID_BUILD_TOOLS_REVISION to the revision of the build tools installed in your Android SDK.")
QMAKE_LINK_SHLIB_CMD = $$DEX_CMD --dex --output $(TARGET) $$CLASS_DIR
} else {
QMAKE_LINK_SHLIB_CMD = jar cf $(TARGET) -C $$CLASS_DIR .