Creating an Android project from the command line using Docker

I inherited the Android Java code in my company, without Gradle files, etc., and I want to be able to compile this on my dev server (I program from a ChromeOS computer, therefore, connecting the CLI SSH to the server where I doing dev stuff). Now I have found some Docker images, such as https://hub.docker.com/r/ksoichiro/android/ (with a broken command line example), but so far I have not been able to create an APK. What am I missing and how will you do it?

+5
source share
1 answer

You have three steps:

  • Move the project to gradle.

    It’s not so difficult as there is a lot of gradle project there, and you can try to follow it or just read “Migrating to Gradle” .

  • Create a project with gradle on the local machine.

    If you performed the migration correctly, you can build your project in the terminal, for example:

    ./gradlew assembleDebug

    but it could also be DevDebug or assemblyProdRelease assembly, which depends on your buildType and flavor in gradle. Check which assemblies are available by running:

    ./gradlew tasks

  • Create a project using Docker.

    Based on linked image:

    docker run -t -i ksoichiro/android -v /path/to/project:/workspace -w workspace /bin/sh -c "./gradlew assembleDebug"

+1
source

Source: https://habr.com/ru/post/1240162/


All Articles