Second Week of Coding : 14 June-18 June

The second week of codding has been passed and I am getting more dive into the huge code base of the mHBS Tracker and Trainer app. Let’s have a look at what I had done this week :

Find out the Cause of Issue-1

As I stated in last week blog that we were getting the build error like ‘STRING_TOO_LARGE’ which is not affecting the Gradle build in making the apk but is shown as an error while building the app. This is really a very time-consuming error, I had tried a lot of possible solutions to fix it let’s discuss all of them one by one :

  • Android Asset Packaging Tool: Since these errors can be picked out by an SDK tool i.e. AAPT, I first tried that one using this command

aapt dump — values resources dhis-debug.apk | grep -B 1 ‘STRING_TOO_LARGE’

  • Grep Tool: Another way of solving this could be getting a decompiled apk of the app using any online decompiler and in the decompiled apk try to find ‘STRING_TOO_LARGE’ string using grep tool or any other medium.

I had tried both of the above well-known approaches and finally, I have no option other than to check for each and every resource files that can cause this error.

  • Checked Every Resource File: mHBS app is a multi-language support app that has various string resources I had checked each and every string file. The error could also be because of large drawable files if present in the app but our app has no such culprit.

Finally, in the end, I found my culprit that is not actually in our mHBS app. Basically, we are using the dhis2-android-sdk in our app that is used as a submodule and has very large drawable files in its core package and causing this error. Since it is a submodule therefore this can be solved by dhis2 itself.

Find out the Cause of Issue-2

We also had one more issue to solve that we found when we had tried to build the dhis2 app on JDK higher than 8 is ‘NoClassDefFoundError: javax/annotation/Generated’ means dhis2 app is not building with JDK higher than 8. This error can be resolved by adding some dependencies ( Maven Repository: javax.annotation » javax.annotation-api » 1.3.2 (mvnrepository.com) ) to build.gradle. But again these changes should be done on another submodule that the dhis2 app is using i.e. dhis2-rule-engine and can be resolved by dhis2 itself.

Uploaded dummy data on bmgfdev instance of mHBS

We want functionality like that we will be able to upload videos and pdf type resources on the website in the bmgfdev instance and able to fetch it and show it in the trainer app. For now, I had added 6 videos from Webinars (aap.org) and one more test video to the resources of the bmgfdev instance. Check Here

Fetched and shown the Video Resources in media tab

This part is slightly pending due to some problem. I had written down all the HTML code for UI and javaScript code for Api Calls for playing the video media but I am getting some error while hitting the bmgfdev instance API from the browser due to the CORS policy of the browsers. Error is like that -

Access to XMLHttpRequest at ‘https://bmgfdev.soic.iupui.edu/api/document/' from origin ‘http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: Redirect is not allowed for a preflight request.

I had tested the API and my flow over postman is working fine, as soon as the API get working in the browser all the video files are being loaded in the trainer app. I will try to solve it asap.

Works Done in the Second Week

  1. Find out the cause of the STRING_TOO_LARGE issue.
  2. Find out the cause of incompatibility of dhis2 with JDK higher than 8.
  3. Populated bmgfdev instance with dummy data of videos.
  4. Made a UI to show all the Videos media files in the trainer app.
  5. Fetched Videos in the media tab from bmgfdev instance.

Work to be done in the next week

  1. Fixing the issue of API Calls done from the browser over the bmgfdev instance.
  2. Making a feature in the trainer app to show PDF resources that are uploaded on the bmgfdev instance.
  3. Finding more features that can be added to the video of the media tab.
  4. Solving bugs suggested by mentors.

Comments

Popular posts from this blog

Tenth Week of Coding 9th August — 15th August

Ninth Week of Coding 2 August — 7 August

Seventh Week of Coding 19th July - 23 July