How to compile APK from command line?

后端 未结 3 1708
盖世英雄少女心
盖世英雄少女心 2020-12-05 00:53

I am interested in making Android apps on demand. Depending on the clients request, my web site would send me a JSON file direct to a Windows application that I have created

3条回答
  •  [愿得一人]
    2020-12-05 01:27

    Create build.xml at project creation time

    If you start a new project with:

    android create project \
        --target 1 \
        --name MyName \
        --path . \
        --activity MyActivity \
        --package com.yourdomain.yourproject
    

    the build.xml file used by ant will be generated.

    The android tool is present in the tools/ directory of the SDK which you downloaded.

    Create debug releases

    Besides:

    ant release
    

    for final releases, you can also create debug releases with:

    ant debug
    

    Location of generated apk

    Generated apk are placed under bin/.

    The most important outputs are:

    MyName-debug.apk
    MyName-release.apk
    

    but some intermediate apks are also generated, in particular unaligned and unsigned versions.

    But most of the time you can forget where they were created and just run:

    ant debug install
    ant release install
    

    to get them installed. But make sure it is working with adb first: adb devices command not working

    Tested on Ubuntu 15.10, Android 23.

提交回复
热议问题