I am upgrading ODK Table from version 2.0.6 to 2.1.6. I got the issue where a simple dropdown in html form does not show when I touch it. This is the html:
<!DOCTYPE html>
<html>
<body>
<h1>The select element</h1>
<p>The select element is used to create a drop-down list.</p>
<form>
<label for="cars">Choose a car:</label>
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
<input type="submit" value="Submit">
</form>
</body>
</html>
The issue only happens on Android 5.0/5.1 and on ODK Tables 2.1.6. When I run the form in ODK Tables 2.0.6, the issue is gone regardless of Android version.
I know the logic here is to fix something related to Android 5.0/5.1. I managed to always return context instead of createConfigurationContext(), then the SELECT dropdown shows as normal.
If I remember correctly, it was when we upgraded to 9 and started to change the app-compat libraries to Androidx. This stackoverflow post helped to jog my memory. The post also has an update that the problem in app-compat was fixed in 2020, so the Dec 2020 release probably pulled in this changed behavior.
The trace you give makes the issue much clearer to me. It is not quite an easy fix I guess. Do you have any advice on how to bypass the issue by upgrading something? Or the estimate on when the fix is rolled out?
I will have to downgrade to ODK Tables 2.1.4 (and ODK Services as well) on android 5 devices. I tested this version and the issue does not happen. Is there any caution that I should take on 2.1.4?
@Thien_Mai. We plan to do a release around the end of March. I think your solution may be correct, but we need to test on other versions. You can help us out by testing your solution on other versions.
@Thien_Mai After you test it on other versions feel free to open a pull request against the development branch and I will start testing it as part of the release.
You can check out androidlibrary in your same folder same with androidcommon as services, tables, and survey look first at the same folder first before going to the web.
@W_Brunette, I could build the apk and tested. It worked on the device which occurs the issue previously and on all devices I have (android 4, 7, 8, 10).
What was tested: All forms in my real project not crash, dropdown showed perfectly, sync function worked well.
Regarding the pull request, I don’t know how to correctly handle the ticket to get aligned with your project development, so I attach the patch here.
I wanted to completely remove odkContext, but because this is common lib and I could not verify all its dependents, so I had to keep getOdkContext() method, which is not really great.