summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
45d03c7)
Gradle is the new recommended build system.
Also, while at it, fix the command to create the .gitignore file: before
this change only local.properties was being written in .gitignore
# Create an Android Virtual Device (AVD)
android create avd --target android-17 --name android-17-x86 --abi x86
# Create an Android Virtual Device (AVD)
android create avd --target android-17 --name android-17-x86 --abi x86
-# Install "ant" to build packages
-sudo aptitude install ant
-
# Create a Hello World application
# http://developer.android.com/tools/projects/projects-cmdline.html
# Create a Hello World application
# http://developer.android.com/tools/projects/projects-cmdline.html
+#
+# Info on the latest version of the Android Gradle Plugin here:
+# https://developer.android.com/tools/revisions/gradle-plugin.html
mkdir $ANDROID_BASE_DIR/Apps
android create project \
mkdir $ANDROID_BASE_DIR/Apps
android create project \
+ --gradle --gradle-version 1.3.1 \
--target android-17 \
--name MyFirstApp \
--path $ANDROID_BASE_DIR/Apps/MyFirstApp \
--activity MainActivity \
--package com.example.myfirstapp
--target android-17 \
--name MyFirstApp \
--path $ANDROID_BASE_DIR/Apps/MyFirstApp \
--activity MainActivity \
--package com.example.myfirstapp
+# Set a gradle version compatible with the Android Gradle Plugin used above,
+# see: http://tools.android.com/tech-docs/new-build-system/version-compatibility
+sed -e '/distributionUrl/s/gradle-[^\-]*-all/gradle-2\.5-all/g' -i $ANDROID_BASE_DIR/Apps/MyFirstApp/gradle/wrapper/gradle-wrapper.properties
+sed -e 's/runProguard false/minifyEnabled false/g' -i $ANDROID_BASE_DIR/Apps/MyFirstApp/build.gradle
+
# And maybe you want to use git for your App?
cd $ANDROID_BASE_DIR/Apps/MyFirstApp
# And maybe you want to use git for your App?
cd $ANDROID_BASE_DIR/Apps/MyFirstApp
git commit -m $'Initial import\n\nhttp://developer.android.com/training/basics/firstapp/creating-project.html'
git commit -m $'Initial import\n\nhttp://developer.android.com/training/basics/firstapp/creating-project.html'
-echo "bin/" > .gitignore
-echo "gen/" > .gitignore
-echo "local.properties" > .gitignore
+echo ".gradle/" > .gitignore
+echo "build/" >> .gitignore
+echo "local.properties" >> .gitignore
git add .gitignore
git commit -m "Add a .gitignore file"
git add .gitignore
git commit -m "Add a .gitignore file"
# Build the App
# http://developer.android.com/tools/building/building-cmdline.html
cd $ANDROID_BASE_DIR/Apps/MyFirstApp
# Build the App
# http://developer.android.com/tools/building/building-cmdline.html
cd $ANDROID_BASE_DIR/Apps/MyFirstApp
# Start the emulator, hardware accelerated:
# http://developer.android.com/tools/devices/emulator.html#vm-linux
# Start the emulator, hardware accelerated:
# http://developer.android.com/tools/devices/emulator.html#vm-linux