Don't hardcode build-tools version
This commit is contained in:
parent
bc6ff38b22
commit
b6df36fc39
@ -48,9 +48,8 @@ Android NDK r12b.
|
||||
|
||||
You need to create proper "android-sdk" and "android-ndk" symlinks in the
|
||||
directory with Android project, so that the compilation script will have access
|
||||
to the SDK and NDK.
|
||||
|
||||
These paths can be also set in SDK_PATH and NDK_PATH environmental variables.
|
||||
to the SDK and NDK. These paths can be also set in SDK_PATH and NDK_PATH
|
||||
environmental variables.
|
||||
|
||||
Before running the compilation, run the generate_assets script, so that
|
||||
selected assets will be copied to "assets" directory, and then included in the
|
||||
@ -78,9 +77,10 @@ you have to manually sign the apk with your key and run zipalign.
|
||||
Additionally you can choose the build tool by setting BUILD_TOOL environment
|
||||
variable to "gradle" or "ant". Note that ant has been already removed from
|
||||
Android SDK, so you have to use SDK <= 25.2.5 for building with ant. By default
|
||||
the BUILD_TOOL is set to "gradle". It has hardcoded version of SDK build-tools
|
||||
that are set to "25.0.3", so you have to use this particular version (or you can
|
||||
edit build.gradle file).
|
||||
the BUILD_TOOL is set to "gradle".
|
||||
|
||||
You can override the SDK build-tools version by setting the BUILD_TOOLS_VER
|
||||
environment variable.
|
||||
|
||||
Basically if all dependencies are installed in the system, it should be enough
|
||||
to just run:
|
||||
|
@ -15,8 +15,8 @@ apply plugin: 'com.android.application'
|
||||
|
||||
android
|
||||
{
|
||||
compileSdkVersion sdkVersion.toInteger()
|
||||
buildToolsVersion "25.0.3"
|
||||
compileSdkVersion sdk_version.toInteger()
|
||||
buildToolsVersion build_tools_ver
|
||||
|
||||
sourceSets
|
||||
{
|
||||
|
@ -155,6 +155,24 @@ if [ ! -d "$SDK_PATH" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Find newest build-tools version
|
||||
if [ -z "$BUILD_TOOLS_VER" ]; then
|
||||
BUILD_TOOLS_DIRS=`ls -1 "$SDK_PATH/build-tools" | sort -V -r`
|
||||
|
||||
for DIR in $BUILD_TOOLS_DIRS; do
|
||||
if [ "$DIR" = `echo $DIR | sed 's/[^0-9,.]//g'` ]; then
|
||||
BUILD_TOOLS_VER="$DIR"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$BUILD_TOOLS_VER" ] || [ ! -d "$SDK_PATH/build-tools/$BUILD_TOOLS_VER" ]; then
|
||||
echo "Error: Couldn't detect build-tools version."
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Standalone toolchain
|
||||
if [ ! -f "$DIRNAME/obj/make_standalone_toolchain.stamp" ]; then
|
||||
echo "Creating standalone toolchain"
|
||||
@ -326,9 +344,13 @@ echo "Building APK"
|
||||
|
||||
if [ "$BUILD_TOOL" = "gradle" ]; then
|
||||
export ANDROID_HOME="$SDK_PATH"
|
||||
gradle -PsdkVersion=$SDK_VERSION $GRADLE_BUILD_TYPE
|
||||
gradle -Psdk_version=$SDK_VERSION \
|
||||
-Pbuild_tools_ver="$BUILD_TOOLS_VER" \
|
||||
$GRADLE_BUILD_TYPE
|
||||
elif [ "$BUILD_TOOL" = "ant" ]; then
|
||||
ant $ANT_BUILD_TYPE -Dsdk.dir="$SDK_PATH" -Dtarget=$NDK_PLATFORM
|
||||
ant -Dsdk.dir="$SDK_PATH" \
|
||||
-Dtarget=$NDK_PLATFORM \
|
||||
$ANT_BUILD_TYPE
|
||||
fi
|
||||
|
||||
check_error
|
||||
|
Loading…
x
Reference in New Issue
Block a user