page.title=In Other IDEs @jd:body
The recommended way to develop an Android application is to use Eclipse with the ADT plugin. This plugin provides editing, building, and debugging functionality integrated right into the IDE.
However, if you'd rather develop your application in another IDE, such as IntelliJ, or use Eclipse without the ADT plugin, you can do that instead. The SDK provides the tools you need to set up, build, and debug your application.
The Android SDK includes activityCreator, a program that generates a number of stub files for your project, as well as a build file. You can use the program to create an Android project for new code or from existing code, such as the sample applications included in the SDK. For Linux and Mac, the SDK provides activitycreator and for Windows, activityCreator.bat, a batch script. Regardless of platform, you can use activitycreator in the same way.
To run activityCreator and create an Android project, follow these steps:
tools/ directory of the SDK and create a new directory for your project files. If you are creating a project from existing code, change to the root folder of your application instead. Run activityCreator. In the command, you must specify a fully-qualified class name as an argument. If you are creating a project for new code, the class represents the name of a stub class that the script will create. If you are creating a project from existing code, you must specify the name of one Activity class in the package. Command options for the script include:
--out <folder> which sets the output directory. By default, the output directory is the current directory. If you created a new directory for your project files, use this option to point to it. --ide intellij, which generates IntelliJ IDEA project files in the newly created projectHere's an example:
~/android_linux_sdk/tools $ ./activityCreator.py --out myproject your.package.name.ActivityName package: your.package.name out_dir: myproject activity_name: ActivityName ~/android_linux_sdk/tools $
The activityCreator script generates the following files and directories (but will not overwrite existing ones):
AndroidManifest.xml The application manifest file, synced to the specified Activity class for the project.build.xml An Ant file that you can use to build/package the application.src/your/package/name/ActivityName.java The Activity class you specified on input.your_activity.iml, your_activity.ipr,
your_activity.iws [only
with the -ide intelliJ flag] intelliJ project
files. res/ A directory to hold resources. src/ The source directory.
bin/ The output directory for the build script.You can now move your folder wherever you want for development, but keep in mind
that you'll have to use the adb program in the tools/ folder to
send files to the emulator, so you'll need access between your solution and
the tools/ folder.
Also, you should refrain from moving the location of the SDK directory, since this will break the build scripts (they will need to be manually updated to reflect the new SDK location before they will work again).
Use the Ant build.xml file generated by
activityCreator to build your application.
Note: When installing JDK on Windows, the default is to install in the "Program Files" directory. This location will cause ant to fail, because of the space. To fix the problem, you can specify the JAVA_HOME variable like this: set JAVA_HOME=c:\Prora~1\Java\. The easiest solution, however, is to install JDK in a non-space directory, for example: c:\java\jdk1.6.0_02.
To run a compiled
application, you will upload the .apk file to the /data/app/ directory
in the emulator using the adb tool as described here:
<your_sdk_dir>/tools/emulator from the command line)adb install myproject/bin/<appname>.apk to upload
the executable. So, for example, to install the Lunar Lander sample, navigate
in the command line to <your_sdk_dir>/sample/LunarLander and type ../../tools/adb install bin/LunarLander.apkNote: When you install an Activity for the first time, you might have to restart the emulator before it shows up in the application launcher, or other applications can call it. This is because the package manager usually only examines manifests completely on emulator startup.
This section describes how to display debug information on the screen (such as CPU usage), as well as how to hook up your IDE to debug running applications on the emulator.
Attaching a debugger is automated using the Eclipse plugin, but you can configure other IDEs to listen on a debugging port to receive debugging information.