Air off, Mind on ~ / Javascript+Golang, Sci, Health… /

Building Mobile Apps From the Command Line

Following are command line reference of building mobile apps for Android, iOS, BB10 and WP8.


Managing Projects from the Command Line


Creating an Android Project

android create project \
--target <target_ID> \
--name <your_project_name> \
--path path/to/your/project \
--activity <your_activity_name> \
--package <your_package_namespace>

Updating a Project

android update project --name <project_name> --target <target_ID>
--path <path_to_your_project>

Setting up a Library Project

android create lib-project --name <your_project_name> \
--target <target_ID> \
--path path/to/your/project \
--package <your_library_package_namespace>

The AndroidManifest.xml File Reference

Updating a library project

android update lib-project \
--target <target_ID> \
--path path/to/your/project

Referencing a Library Project

android update project \
--target <target_ID> \
--path path/to/your/project
--library path/to/library_projectA

This command updates the application project’s build properties to include a reference to the library project. Specifically, it adds an android.library.reference.n property to the project’s project.properties file.

Declaring library components in the manifest file

In the manifest file of the application project, you must add declarations of all components that the application will use that are imported from a library project. For example, you must declare any , , , , and so on, as well as , , and similar elements.

Building and Running from the Command Line


Building in Debug/Release Mode

ant debug
ant release

Signing Your Applications

Running on a Device

adb -d install path/to/your/app.apk

update installation

adb -d -r install path/to/your/app.apk


To be able to find the command line, the trick was to watch the system console log while running a “build and archive” through Xcode.

xcodebuild -project myproject1 -target target1

/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPPER_NAME}" --embed "${PROVISONNING_PROFILE}"

RELEASE_BUILDDIR needs to be an absolute path.

you don’t need the –sign or –embed options if you wish to keep the same signing/profile used when the .app was built.

Note that the ipa file path in -o “${ipa_path}” must be an absolute path. Otherwise you will probably get error: Unable to create ‘…/…ipa’ or it will be silently ignored creating.

xcodebuild -scheme <SchemeName> archive

Make sure you have selected the correct Xcode release by using xcode-select

to resign a build

codesign -f -vv -s "$DistributionIdentity" "$APPDIR"

Other References

Building iOS apps for Over-The-Air AdHoc distribution

Fruitstrap is a command line tool that uses the private MobileDevice API to install an iOS application on a physical device over USB. It’s pretty easy to get set up.

xcodebuild -scheme fruitstrap-demo -sdk iphoneos build

fruitstrap build/Debug-iphoneos/fruitstrap-demo.app

One command to build and install the app on the device.

FRUITSTRAP_CLI=1 xcodebuild -scheme fruitstrap-demo -sdk iphoneos build

xctool is a replacement for Apple’s xcodebuild that makes it easier to build and test iOS and Mac products. It’s especially helpful for continuous integration.

BlackBerry 10

make -f [configuration]/makefile [target]

Build from the command line

mkbuild -ws <workspace> [options] 
mkbuild [-project] <full_project_path> [options] 
mkbuild -ws <workspace> -projects <project1,project2> [options]

Command Line Rocks! Building BlackBerry 10 Apps Without An IDE

qcc -Vgcc_ntoarmv7le main.c -o main

for simulator

qcc -Vgcc_ntox86 main.c -o main

bar-descriptor.xml file full list of BAR application descriptor parameters

  <name>Goodbye IDE</name>
  <asset path="main" entry="true">main</asset>

To create a BAR file: (register with RIM to sign applications, create a debug token)

blackberry-nativepackager -package GoodbyeIDE.bar bar-descriptor.xml -devMode -debugToken ~/Library/Research\ In\ Motion/debugtoken1.bar


blackberry-deploy -installApp -password pass GoodbyeIDE.bar

View logs over SSH

blackberry-connect -password pass

open another console and run

ssh devuser@

run command

slog2info -w

Command Line Rocks! Part 2 – Adding Multiple Source Files and Libraries

Command Line Rocks! Part 3 – Make and Makefiles

Windows Phone 8

The output of the build process includes a file with the .XAP extension. The XAP file is a zipped package that contains all the files required by your app. It’s the XAP file that you deploy to the emulator or to a phone, and that you publish to Windows Phone Store.

devenv NameOfSolution /Rebuild "Release|Mixed Platforms"

MSBuild MyProject.csproj /p:OutDir=d:\builds\mindon-projs\

You can override the project-specific folder behavior by specifying.


MSBuild.exe MyProject/project.jsproj /p:Configuration=Release /t:Build /m

MSBuild Command-Line Reference


How to sign a company app by using XapSignTool

set path=%path%;"%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.0\Tools\XapSignTool"

XapSignTool.exe sign /f PFXFile /p Password XAP

Simple Windows Phone 8 (C++/native only) DirectX project with Command Line Build