Openmrs android client error when creating a patient or trying to find patients

Hi all,

I have been trying to test the openmrs android client and after building the new apk of the version 2.9.0 I managed to push it to my device and log in. Reproduction of the error: 1- Log in to your instance with your credentials 2- Click on Register patient 3- Fill out the form with mockup data 4- Click submit 5- Error occurs as: Error occurred Sorry! An Unknown error has occurred. Please report the details to developers so that it can be resolved as soon as possible.

This error prevents from creating the patient. The same happens when clicking on Find Patients.

I am using ngrok to connect to my localhost instance.

1 Like

@magp it works fine for me for API level 25, could you reproduce the error while connecting to the demo server ? and can you share the logs for this crash !! cc @rishabh997 @f4ww4z

I tried with:

1- with user:admin pass:Admin123 and location Inpatient Ward

2- Going to find patients works

3- Register patient with mockup data

4- App crashes, restart

5- Going to find patients crashes too

Can you try a clean install ie clearing data and building… also, are you using android studio to build it or downloading from play store?

yes I think the database schema for the app has changed and the android studio cache might be causing the problems for you @magp !!

I uninstalled and installed it again but the problem remains for some reason. I used android studio to build the apk from this source code because as per last friday the application from the play store was still crashing and I did not find an apk that was not crashing other than the one generated from the link provided here. Before uninstalling and installing again I tried to clean cache and check again but without success. cc @saurabh

@magp dont uninstall and reinstall instead try invalidating the Android studio cache on your PC and rebuild the application it should work . just to help, you can find this option under the menu option in android studio, then clean build the app.

I am not sure whether I followed the right steps, but here is what I did:

  1. Uninstalled the application
  2. Invalidated cache on Android Studio
  3. Built the APK again
  4. Pushed it to the device
  5. Error still remains

Are those the steps you had in mind or did I do something wrong?

@magp just one more step delete the apk from the debug or release folder based on the build variant you are using and then clean build using android studio, and let me know if it works !!

Thank you for the suggestion, however the error persists, here are the updated steps:

  1. Uninstalled the application

  2. Deleted the apk from the debug folder

  3. Invalidated cache on Android Studio and restarted

  4. Used build / clean to generate apk

  5. Pushed it to the device

  6. Error still remains

Is this working for you?

@magp can you share the logs , yes it works for me !!

Just to be sure did you clear this directory while deleting the apk .....\openmrs-contrib-android-client\openmrs-client\build\outputs\apk\debug

Here is the log when using the application connected to android studio: (although the error is rather at the end)

Yes I used the task clean which deletes the whole build folder and then used Build -> Build Bundle / APK -> Build APK (because using the task “build” does create the build folder and its content but fails with the error: Keystore file ‘openmrs-contrib-android-client-2.9.0/release.keystore’ not found for signing config ‘release’ )

Lastly I just connected my device to the laptop and used openmrs-client configuration and hit run to push the application to the device and test it while seeing the log in the terminal which logged the error shown in the pastebin link.

looking at this error could you check if you are building a debug version of the app or the release version in the android studio, and could you share the API level in which you are testing the app?

is API level the same as sdk version? I have the target sdk Version being resolved to 29 and a min SDK version resolved to 16.

Yes I do believe am building a debug version as the folder inside apk is called debug and not release.

To be sure just check inside the build variants in the android studio for this .

No I was referring to the device API level on which you are testing the Android client

According to this my device should have the API level 19.

I am sorry, I am not sure what you mean by that. does that help @magp ?

It definitely did, you were right about it being on debug. I have changed it to release now but I have a similar issue as before with the key when buidling:

  • What went wrong: Execution failed for task ‘:openmrs-client:validateSigningRelease’.

Keystore file not set for signing config release

This does not build an apk in the outputs folder.

However I am confident that it is because of the store file for the keystore, I then used “release.keystore.gpg” which led to this error:

  • What went wrong: Execution failed for task ‘:openmrs-client:packageRelease’.

A failure occurred while executing$ActionFacade SigningConfig “release” is missing required property “storePassword”.

Is this the right Store File?

The store file is definitely right and I just ran it for the debug variant and it runs.

Do you have any emulator available on android studio on your local machine, could you test on API level 25 or more and see if this problem still presists. thanks.

I can try that, however no release apk is being built with this error. Not even with Build -> Build Bundle / APK -> Build APK (trying like this gives me the error: “SigningConfig ‘release’ is missing required property ‘storePassword’”)