Android Settings - Build APK after publish (more settings)

With the advent of a new option (https://github.com/armory3d/armory/pull/1935), the idea came to add another setting for the target Android(C) platform when publishing the application:
build_apk

When the option is set, after publishing, the APK file is built:

  • for Windows: /gradlew.bat assembleDebug
  • for *nix: /gradlew assembleDebug

A prerequisite is the presence of the ANDROID_SDK_ROOT variable (path to the Android SDK) in the system environment.

Questions:

  1. Do you need to move the value of the ANDROID_SDK_ROOT variable into the global settings Preferences - Add-ons - Render: Armory? In this case, there will be a check, if the specified variable is not in the system, then the value from this field is set.
  2. Do I need to open (or enter a setting in the Android Settings panel) the folder with the generated APK file?
3 Likes

Current version:
build_apk

preference

When starting the build, the presence of an environment variable is checked. If it is not specified, then the parameter value from the settings is checked. That is, the system variable has priority.

If nothing is specified, the user will receive a warning:

Building APK Warning: ANDROID_SDK_ROOT is not specified in environment variables and 'Android SDK Path' setting is not specified in preferences:
- If you specify an environment variable ANDROID_SDK_ROOT, then you need to restart Blender;
- If you specify the setting 'Android SDK Path' in the preferences, then repeat operation 'Publish'

Scripts: build_apk.zip

Any comments, suggestions?

1 Like

Nice work! :+1:

Any comments, suggestions?

Maybe an option to allow launching an emulator instance after building?

Automatic SDK download would be cool too if possible.

1 Like

@M_Ent8h, thanks!

The ideas are good, but there are many additional parameters:

  • for the emulator, you need to select it (set via avd_name), which means that the user will need to specify the name of the emulator, or upload the list to the interface and select there (via the -list-avds parameter). It doesn’t sound difficult, maybe I’ll try;

  • automatic installation of the SDK is very time consuming (especially for each OS), there are many parameters that need to be taken into account (sdk-tools version, java, and others). The parameters have changed over time. My settings allow me to generate only the Debug version of the application, the Release version must be built through Android Studio (or through the command line for the user). Therefore, the user needs the studio in any case.

Command line installation options:

1 Like

When you start Blender, the list of emulators is always empty. To select, you must click the update button.
Moreover, if the Building APK After Publishing parameters are not disabled and there is no reference to the SDK directory (the environment variable or setting in the Preference is not specified), then these parameters are not available:
build_apk_emulator

Scripts: build_apk.zip

2 Likes

Changed the display logic (enable / disable) in the interface and added a start button for the emulator so that the user can start the selected emulator at any time. If he has a powerful PC, then you can build the APK in parallel and run the emulator.
build_apk_emulator_run

Scripts: build_apk.zip

1 Like

I suggest adding 2 more settings:

  1. Rename APK To Package Name
    This setting allows you to rename the resulting APK file named app-debug.apk to the name specified in the Package field.
  2. Copy APK To Specified Folder
    This setting allows you to copy the resulting APK file to the folder specified in Render: Armory (in a new field in Preferences).

new_option
*naming error

new_option_preference

These settings will allow you to have unique names for files, as well as copy them to the required folder for uploading to the device or to the cloud.

Have any suggestions or comments?

3 Likes

Panel Armory Exporter - Android Settings - Build APK:

new_option_v2

  1. Rename APK To Package Name
    Renames the APK file from app-debug.apk to [blender-file-name]-[version] .apk. Example, for the project example_ball.blend, the result will be the name example-ball-1.0.apk.
  2. Copy APK To Specified Folder
    Copies the final file to the folder specified in Preferences.

Preferences Render: Armory:

new_preference_v2

  1. Copy APK To Folder
    The path to the folder where the final APK file will be copied.
  2. Open Directory After Copy
    Open this folder after copying.

Console messages:

Rename APK to example-ball-1.0.apk
Copy APK to C:\IDE\Test
2 Likes