Unable to build a bundle

Dear all,

I am building a cht-android flavor as described in the documentation

I have successfully build the apks for Webview and for lower Android version. When building the bundle with the command

make org=new_brand flavor=New_brand bundle

I get the error message

bundleNew_flavorRelease not found in root project ‘cht-android’

Such a file is indeed not there, but when was it supposed to be created?

Can you double-check that you have added your New_brand config to the build.gradle in the android/productFlavors section (as described in step 2.2)?

If this is missing or does not match the flavor you are using in the bundle command, it could cause the error you are seeing.

Dear @jkuester,

yes I have the entry:

new_flavor {
dimension = ‘brand’
applicationID = ‘org.medicmobile.webapp.mobile.new_flavor’
}

Okay, so we must have something weirder going on… Another thing to double-check is if you have the ANDROID_HOME environment variable properly set as described here: Development Environment | Community Health Toolkit.

If that is setup properly and it still does not work, you could try forcing gradle to rebuild its cache for the project (just in case something has been corrupted in there). From within your cht-android directory, run mv .gradle backup.gradle

If none of that works, it would be helpful if you could post the complete output for your make org=new_brand flavor=New_brand bundle command.

@jkuester
before digging deeper, could you please clarify that the path of the generated apks is correct?
According to the documentation, the files should have been created in

build/outputs/apk/new_brand/release/

In my case the files are in :

build/outputs/apk/new_brand/release/new_brandWebview/release

and

build/outputs/apk/new_brand/release/new_brandXwalk/release

I assume that the bundle command is accessing the apks to make the bundle, so that path probably matters.

Dear @jkuester your suggested solutions did not help, unfortunately.
Yes, ANDROID_HOME is properly set. I have moved .gradle

Please find the output of the bundle command (revealing the encryption)

ANDROID_KEYSTORE_PATH=msfecare.keystore ANDROID_KEY_ALIAS=medicmobile
ANDROID_KEYSTORE_PASSWORD=4cdc7f5096ac71e5 ANDROID_KEY_PASSWORD=4cdc7f5096ac71e5
./gradlew --daemon --parallel bundleMsfecareRelease

Configure project :
WARNING:Using flatDir should be avoided because it doesn’t support any meta-data formats.

FAILURE: Build failed with an exception.

  • What went wrong:
    Task ‘bundleMsfecareRelease’ not found in root project ‘cht-android’.

  • Try:

Run gradlew tasks to get a list of available tasks.
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See Command-Line Interface

BUILD FAILED in 2s
make: *** [Makefile:54: bundle] Error 1

Okay, wait, I think I know what is going on here. Is the branch for you new branded based on a previous tag of cht-android (such as v0.11.1)? If so, you will also need to include the the version (Webview/Xwalk) as part of your flavor that you provide to make ... bundle.

E.g.: make flavor=New_brandWebview bundle

The source of my confusion was that in the upcoming v1.0.0 of cht-android we are removing the separate versions and so if you happen to be testing things while on the master branch (like I was) then make flavor=New_brand bundle should work without the extra version notation…

Note that it is correct to base the branch for your new bundle off of the last released version (as mentioned in the documentation) and not off master. Just realize that with the new major version of cht-android, this bundle command will be changing. @Jennifer_Quesada feel free to jump in here and correct me if I am wrong or add anything I missed!