[APP] Android development Note 001-Environment setup and command line creation project, android001-
1. Install JDK and SDK
JDK http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Android SDK http://developer.android.com/sdk/index.html
The https://dl.google.com/android/android-sdk_r24.4.1-windows.zip (No installer)
Https://dl.google.com/android/installer_r24.4.1-windows.exe
Ant tool http://ant.apache.org/bindownload.cgi
2. Set environment variables:
Add the following two to the Path key value of the system environment variable table:
\ Android \ sdk \ platform-tools
\ Android \ sdk \ tools
Set Ant
ANT_HOME: indicates the location of the decompressed apache-ant-1.8.4 file of apache-ant-1.8.4-bin.zip;
I put this file on drive D, so the ant_home I set here is ant_home = D: \ apache-ant-1.8.2;
Path: PATH = % ANT_HOME %/bin; % ANT_HOME %/lib
3. Use the command line to create an Android Application:
1) Go to the folder where you want to create an Android Application:
Cd D: \ Android Development
2) create an Android project in the current path
Android create project-n MySecApp-p android_Sec-a MyActivitySec-k Com. test. mysecapp-t 2
Command Line description:
-N indicates the name and project name.
-P indicates path and workspace
-A indicates the name of the created Activity.
-K indicates the package and package name
-T indicates the target and target id.
(* Target id * can be viewed through android list targets. The system will list all available android versions downloaded)
D: \ Android Development> ant-versionApache Ant (TM) version 1.9.7 compiled on April 9 6D 6D: \ Android Development> cd android_SecD: \ Android Development \ android_Sec> ant debugBuildfile: D: \ Android Development \ android_Sec \ build. xml-set-mode-check:-set-debug-files:-check-env: [checkenv] Android SDK Tools Revision 25.1.2 [checkenv] Installed at C: \ Users \ SDSC \ AppData \ Local \ Android \ sdk-setup: [echo] Project N Ame: MySecApp [gettype] Project Type: Application-set-debug-mode:-debug-obfuscation-check:-pre-build:-build-setup: [getbuildtools] Using latest Build Tools: 23.0.2 [echo] Resolving Build Target for MySecApp... [gettarget] Project Target: Google APIs [gettarget] Vendor: Google Inc. [gettarget] Platform Version: 6.0 [gettarget] API level: 23 [gettarget] WARNING: No minSdkVersion value set. application wil L install on all Android versions. [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: D: \ Android Development \ android_Sec \ bin \ res [mkdir] Created dir: D: \ Android Development \ android_Sec \ bin \ rsObj [mkdir] Created dir: d: \ Android Development \ android_Sec \ bin \ rsLibs [mkdir] Created dir: D: \ Android Development \ android_Sec \ gen [mkdir] Created dir: D: \ Android Developmen T \ android_Sec \ bin \ classes [mkdir] Created dir: D: \ Android Development \ android_Sec \ bin \ dexedLibs [echo] ---------- [echo] Resolving Dependencies for MySecApp... [dependency] Library dependencies: [dependency] No Libraries [dependency] [dependency] ------------------ [echo] ---------- [echo] Building Libraries with 'debug '... [subant] No sub-builds to iterate on-code-gen: [mergemanifest] Merging AndroidM Anifest files into one. [mergemanifest] Manifest merger disabled. using project manifest only. [echo] Handling aidl files... [aidl] No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [echo] ---------- [echo] Handling Resources... [aapt] Generating resource IDs... [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] Generating BuildConfig class. -pre-comp Ile:-compile: [javac] Compiling 3 source files to D: \ Android Development \ android_Sec \ bin \ classes [javac] Warning: [options] The source value 1.5 is out of date, [javac] will be deleted in all future releases. Warning: [options] the target value 1.5 is outdated and [javac] will be deleted in all future releases. Warning: [options] To Hide warnings about obsolete options, use-Xlint:-options. [Javac] 3 warnings-post-compile:-obfuscate:-dex: [dex] input: D: \ Android Development \ android_Sec \ bin \ classes [dex] Converting compiled files and external libraries into D: \ Android Development \ android_Sec \ bin \ classes. dex... -crunch: [crunch] Crunching PNG Files in source dir: D: \ Android Development \ android_Sec \ res [crunch] To destination dir: D: \ Android Development \ android_Sec \ bin \ res [crunch] Processing image to cache: D: \ Android Development \ android_Sec \ res \ drawable-hdpi \ ic_launcher.png => D: \ Android Development \ android_Sec \ bin \ res \ drawable-hdpi \ ic_launcher.png [crunch] (processed image to cache entry D: \ Android Development \ android_Sec \ bin \ res \ drawable-hdpi \ ic_launcher.png: 87% size of source) [crunch] Processing image to cache: D: \ Android Development \ android_Sec \ res \ drawable-ldpi \ ic_launcher.png => D: \ Android Development \ android_Sec \ bin \ res \ drawable-ldpi \ ic_launcher.png [crunch] (processed image to cache entry D: \ Android Development \ android_Sec \ bin \ res \ drawable-ldpi \ ic_launcher.png: 0% size of source) [crunch] Processing image to cache: D: \ Android Development \ android_Sec \ res \ drawable-mdpi \ ic_launcher.png => D: \ Android Development \ android_Sec \ bin \ res \ drawable-mdpi \ ic_launcher.png [crunch] (processed image to cache entry D: \ Android Development \ android_Sec \ bin \ res \ drawable-mdpi \ ic_launcher.png: 78% size of source) [crunch] Processing image to cache: D: \ Android Development \ android_Sec \ res \ drawable-xhdpi \ ic_launcher.png => D: \ Android Development \ android_Sec \ bin \ res \ drawable-xhdpi \ ic_launcher.png [crunch] (processed image to cache entry D: \ Android Development \ android_Sec \ bin \ res \ drawable-xhdpi \ ic_launcher.png: 85% size of source) [crunch] Crunched 4 PNG files to update cache-package-resources: [aapt] Creating full resource package... -package: [apkbuilder] Current build type is different than previous build: forced apkbuilder run. [apkbuilder] Creating MySecApp-debug-unaligned.apk and signing it with a debug key... -post-package:-do-debug: [zipalign] Running zip align on final apk... [echo] Debug Package: D: \ Android Development \ android_Sec \ bin \ MySecApp-debug.apk [propertyfile] Creating new property file: D: \ Android Development \ android_Sec \ bin \ build. prop [propertyfile] Updating property file: D: \ Android Development \ android_Sec \ bin \ build. prop [propertyfile] Updating property file: D: \ Android Development \ android_Sec \ bin \ build. prop [propertyfile] Updating property file: D: \ Android Development \ android_Sec \ bin \ build. prop-post-build: debug: BUILD SUCCESSFULTotal time: 12 secondsD: \ Android Development \ android_Sec>
4) generated Apk