build-scripts/androidbuild.sh
changeset 11649 fe6769530709
parent 11647 5816b27073a4
     1.1 --- a/build-scripts/androidbuild.sh	Mon Oct 23 23:23:34 2017 -0700
     1.2 +++ b/build-scripts/androidbuild.sh	Mon Oct 23 23:23:47 2017 -0700
     1.3 @@ -25,12 +25,9 @@
     1.4      echo "Usage: androidbuild.sh com.yourcompany.yourapp < sources.list"
     1.5      echo "Usage: androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c"
     1.6      echo "To copy SDL source instead of symlinking: COPYSOURCE=1 androidbuild.sh ... "
     1.7 -    echo "You can pass additional arguments to ndk-build with the NDKARGS variable: NDKARGS=\"-s\" androidbuild.sh ..."
     1.8      exit 1
     1.9  fi
    1.10  
    1.11 -
    1.12 -
    1.13  SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
    1.14  
    1.15  if [ -z "$ANDROID_HOME" ];then
    1.16 @@ -38,34 +35,11 @@
    1.17      exit 1
    1.18  fi
    1.19  
    1.20 -NDKBUILD=`which ndk-build`
    1.21 -if [ -z "$NDKBUILD" ];then
    1.22 -    echo "Could not find the ndk-build utility, install Android's NDK and add it to the path"
    1.23 +if [ ! -d "$ANDROID_HOME/ndk-bundle" -a -z "$ANDROID_NDK_HOME" ]; then
    1.24 +    echo "Please set the ANDROID_NDK_HOME directory to the path of the Android NDK"
    1.25      exit 1
    1.26  fi
    1.27  
    1.28 -ANDROID="$ANDROID_HOME/tools/android"
    1.29 -if [ ! -f "$ANDROID" ]; then
    1.30 -    ANDROID=`which android`
    1.31 -fi
    1.32 -if [ -z "$ANDROID" ];then
    1.33 -    echo "Could not find the android utility, install Android's SDK and add it to the path"
    1.34 -    exit 1
    1.35 -fi
    1.36 -
    1.37 -NCPUS="1"
    1.38 -case "$OSTYPE" in
    1.39 -    darwin*)
    1.40 -        NCPU=`sysctl -n hw.ncpu`
    1.41 -        ;; 
    1.42 -    linux*)
    1.43 -        if [ -n `which nproc` ]; then
    1.44 -            NCPUS=`nproc`
    1.45 -        fi  
    1.46 -        ;;
    1.47 -  *);;
    1.48 -esac
    1.49 -
    1.50  APP="$1"
    1.51  APPARR=(${APP//./ })
    1.52  BUILDPATH="$SDLPATH/build/$APP"
    1.53 @@ -121,24 +95,6 @@
    1.54  __EOF__
    1.55  
    1.56  # Update project and build
    1.57 -cd $BUILDPATH
    1.58 -pushd $BUILDPATH/app/jni
    1.59 -$NDKBUILD -j $NCPUS $NDKARGS
    1.60 -popd
    1.61 -
    1.62 -# Start gradle build
    1.63 -$BUILDPATH/gradlew build
    1.64 -
    1.65 -cd $CURDIR
    1.66 -
    1.67 -APK="$BUILDPATH/app/build/outputs/apk/app-debug.apk"
    1.68 -
    1.69 -if [ -f "$APK" ]; then
    1.70 -    echo "Your APK is ready at $APK"
    1.71 -    echo "To install to your device: "
    1.72 -    echo "$ANDROID_HOME/platform-tools/adb install -r $APK"
    1.73 -    exit 0
    1.74 -fi
    1.75 -
    1.76 -echo "There was an error building the APK"
    1.77 -exit 1
    1.78 +echo "To build and install to a device for testing, run the following:"
    1.79 +echo "cd $BUILDPATH"
    1.80 +echo "./gradlew installDebug"