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:
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:
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.
Do I need to open (or enter a setting in the Android Settings panel) the folder with the generated APK file?
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'
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.
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:
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.
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.
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).
*naming error
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.
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.
Copy APK To Specified Folder
Copies the final file to the folder specified in Preferences.
Preferences Render: Armory:
Copy APK To Folder
The path to the folder where the final APK file will be copied.
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