Errors while running the Bahmni android app

We are trying to create Bahmni android app using the steps mentioned at following locations:

https://bahmni.atlassian.net/wiki/spaces/BAH/pages/46432277/Bahmni+Connect+Development

All of the commands in above url ran successfully.

Following are the issues we faced and resolved it:

  1. net::ERR_FILE_NOT_FOUND (file:///android_asset/www/…): Solution: We modified the code in config.xml. Changed <content src="..." /> to <content src="index.html" />

  2. https://192.168.1.16/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=allowMultipleLoginLocation 404 (Not Found) Solution: Added in head tag of index.html

Now, we are getting following attached error and would like to know if somebody faced it before: 24 AM

Following are the version of various applications:

  1. Bahmni Connect, Bahmni Offline, Bahmni Config => 0.90
  2. Node => 6.13.0
  3. NPM => 4.6.1
  4. Cordova => 8.0.0
  5. Ionic => 3.19.1
  6. SDK Version => API 22 (Marshmellow)
  7. Build Tools Version => 27.0.3

We had certain doubts about the bahmni-connect apk compilation steps mentioned in https://github.com/Bahmni/bahmni-offline README file Particularly steps 8 and 9

After cloning the repo,I have the exact same copy as the one in github. If I run Step 8 it removes all the files and folders in bahmni-offline/android/platforms

After running Step 9, it adds new files and folders in bahmni-offline/android/platforms ,but they are not the same as the ones from before running Step 8.

Even the MainActivity.java in https://github.com/Bahmni/bahmni-offline/blob/master/android/platforms/android/src/main/java/org/bahmni/offline/MainActivity.java is different after running Step 9.

None of these folders and files are also present :https://github.com/Bahmni/bahmni-offline/tree/master/android/platforms/android/src/main/java/org/bahmni/offline

Because the this, we are getting the above error The app is not able to find the files as they dont exist

If we skip Step 8 and try to build it as it is I get the following error : Unable to load PlatformApi from platform. Error: Cannot find module ‘/home/krishnanspace/Downloads/bahmni-offline-release-0.90 (2)/android/platforms/android/cordova/Api.js’

Can someone help us out.Thanks!

Edit:The newly generated MainActivity.java https://pastebin.com/RbyeYWkQ (edited)

Hi @krishnanspace,

Are you getting the same error with official build APK?

Hi @sumanmaity112 , we are not getting any problems with the official build.Its working as intended.Only when we are trying to compile the app on our own ,we are facing problems
Edit:By compile on our own,I mean that we have made some changes in Bahmni UI(dist folder) and want those changes reflected in the apk

Hi @krishnanspace,

Can you please try to install the following and try to rebuild

  • npm v3.10.10
  • node v6.11.10
  • cordova v6.4.0
1 Like

Hi @sumanmaity112,
Thanks for your reply.
I installed the above specified versions,but for node I used v6.11.1 as there was no v6.11.10.
This is the error I get when I do “ionic build android” without doing “ionic platform remove/add android” :
https://pastebin.com/29SVMyGb
After running "ionic platform remove/add android " when I run “ionic build android” I get an error saying that Android SDK is not found,even though I have set it.If I echo $ANDROID_HOME,I get the correct path as its output.
But I dont get this error when I use cordova v8.0.0.
Here is the pastebin for the error:
https://pastebin.com/G4dgnXEW

Thanks a lot @sumanmaity112 .The problem is solved after using reinstalling the above versions and building it.

1 Like