Android Tutorials - Herong's Tutorial Examples - v3.05, by Herong Yang
Creating Android Project for Simple Application
This section provides tutorial example on how to create an Android project for a simple Android application using command line tools.
To build any Android applications, we need to create an Android project folder structure first.
Here is what I did to create a simple project called AboutAndroid in a command window:
C:\>cd \herong C:\herong>JAVA_HOME=\Program Files\Java\jdk1.8.0_45\ C:\herong>\local\android-sdk-windows\tools\android create project \ --package com.herongyang --activity AboutAndroid --target 2 \ --path .\AboutAndroid Created project directory: C:\herong\AboutAndroid .. Added file C:\herong\AboutAndroid\build.xml C:\herong>cd .\AboutAndroid C:\herong\AboutAndroid>edit .\src\com\herongyang\AboutAndroid.java /* AboutAndroid.java * Version 1.0 - Displaying text message * Copyright (c) 2015, HerongYang.com, All Rights Reserved. */ package com.herongyang; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class AboutAndroid extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String msg = ""; msg += "About Android\n"; msg += "-------------\n"; TextView tv = new TextView(this); tv.setText(msg); setContentView(tv); } } C:\herong\AboutAndroid>edit .\res\layout\main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout>
See next tutorial to build and install a simple Android application
Table of Contents
Installing JDK 1.8 on Windows System
Installation of Android SDK R24 and Emulator
Installing Apache Ant 1.9 on Windows System
Developing First Android Application - HelloAndroid
Android Application Package (APK) Files
Android Debug Bridge (adb) Tool
►AboutAndroid - Application to Retrieve System Information
java.lang.System Class - Accessing System Information
►Creating Android Project for Simple Application
Build, Install and Run Android Application
System.getProperties() - Retrieving System Properties
android.widget.ScrollView Class - Scrolling Text View
System.getenv() Method - System Environment Variables
android.os.Environment Class - Environment Folders
android.content.Context - Application Context Information
android.app.Activity Class and Activity Lifecycle
View Objects and Layout Resource Files
Using "adb logcat" Command for Debugging
Build Process and Package File Content
Samsung Galaxy Tab 3 Mini Tablet
USB Debugging Applications on Samsung Tablet
USB Debugging Applications on LG-V905R Tablet