Android - tlam/Wiki GitHub Wiki
- JAVA JDK:
sudo apt-get install openjdk-6-jdk
-
Unpack the android sdk at
/home/tlam/android-sdk-linux_x86
-
Add the android tools to your PATH
if [ -d /home/tlam/android-sdk-linux_x86/tools ] ; then PATH=/home/tlam/android-sdk-linux_x86/tools:"${PATH}" fi
-
Update android from the terminal, this should update your android targets:
android update sdk --no-ui
-
The above operation takes a while to run, alternatively, open the android GUI by running
android
at the terminal -
Select Available packages on the left panel and select the latest android SDK
-
Add the platform-tools to your PATH
if [ -d /home/tlam/android-sdk-linux_x86/platform-tools ] ; then PATH=/home/tlam/android-sdk-linux_x86/platform-tools:"${PATH}" fi
-
List all your android targets:
android list targets
-
Create a new AVD, from the
android
GUI, selectVirtual Devices
from the left panel and click onNew...
-
Build command from the project folder:
ant debug install ant release install
-
Run the emulator in one shell:
emulator -avd linux_avd
-
From a new shell, install the apk:
adb install HelloAndroid/bin/HelloAndroid-debug.apk
-
Remounting the adb:
adb remount
-
From there, it should be possible to make changes to your app and after running
ant install
, the app should be reloaded in the emulator.
Note: After launching the emulator, wait till the android screen shows up.
adb logcat
android update project --name <project_name> --target <target_ID> --path <path_to_your_project>
-
Download the latest pmd binaries
-
Unzip to anywhere in your file system, for instance
/home/user/pmd-4.2.5
-
In your
build.xml
file, add the following near the end:<!-- Integrating pmd to detect unused code--> <path id="pmd.classpath"> <pathelement location="${build}"/> <fileset dir="/home/user/pmd-4.2.5/lib/"> <include name="*.jar"/> </fileset> </path> <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/> <target name="pmd"> <pmd rulesetfiles="basic,imports,unusedcode"> <formatter type="html" toFile="pmd_report.html" toConsole="true"/> <fileset dir="src/"> <include name="**/*.java"/> </fileset> </pmd> </target>
-
Run the following command to generate a report of the pmd for unused code:
ant pmd
-
You should be able to view the html report
pmd_report.html
in the base folder of your android project. -
Here is a list of shortened
rulesetfiles
, strip out the.xml
.
Use ddms
- Go to
Manage Apps
- Click on the app
- Click on
Move to USB storage
You should not be able to browse the root folder that you seen when you connect your Nexus S to your computer.