getodk / collect

ODK Collect is an Android app for filling out forms. It's been used to collect billions of data points in challenging environments around the world. Contribute and make the world a better place! ✨📋✨
https://docs.getodk.org/collect-intro
Other
718 stars 1.38k forks source link

androidx.startup.StartupException when initializing mapbox #5192

Closed grzesiek2010 closed 2 years ago

grzesiek2010 commented 2 years ago

Software and hardware versions

Collect v2022.3-beta.2

Problem description

https://console.firebase.google.com/u/1/project/api-project-322300403941/crashlytics/app/android:org.odk.collect.android/issues/eb9b8a0d7568854e2e09bc2b598fd781?time=last-seven-days&versions=v2022.3-beta.2%20(4459)&types=crash&sessionEventKey=62D23A36029200011E17896C87C1C642_1699263640304150428

Fatal Exception: androidx.startup.StartupException: androidx.startup.StartupException: androidx.startup.StartupException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/com.google.android.maps.jar", zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/androidx.test.tools.crawler-MflW_00EOpJgclb9SgHiJg==/base.apk", zip file "/data/app/org.odk.collect.android-E9bdXKuvmIGldxw5iJpY7g==/base.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-MflW_00EOpJgclb9SgHiJg==/lib/x86, /data/app/org.odk.collect.android-E9bdXKuvmIGldxw5iJpY7g==/lib/x86, /data/app/androidx.test.tools.crawler-MflW_00EOpJgclb9SgHiJg==/base.apk!/lib/x86, /data/app/org.odk.collect.android-E9bdXKuvmIGldxw5iJpY7g==/base.apk!/lib/x86, /system/lib, /system/vendor/lib]]] couldn't find "libmapbox-common.so"
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:187)
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:138)
       at androidx.startup.AppInitializer.initializeComponent(AppInitializer.java:117)
       at org.odk.collect.mapbox.MapBoxInitializationFragment.initializeMapbox(MapBoxInitializationFragment.kt:73)
       at org.odk.collect.mapbox.MapBoxInitializationFragment.onAttach(MapBoxInitializationFragment.kt:32)
       at androidx.fragment.app.Fragment.performAttach(Fragment.java:2954)
       at androidx.fragment.app.FragmentStateManager.attach(FragmentStateManager.java:463)
       at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:254)
       at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
       at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
       at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
grzesiek2010 commented 2 years ago

I was able to reproduce the issue on Firebase. Steps are:

  1. Remove RetryOnDeviceErrorRule form TestRuleChain otherwise the root cause of the issue is not clear
  2. Make sure you have secrets.properties file with valid keys when building apks for testing
  3. Run tests on Firebase (I used Pixel 2, Virtual, API Level 29)

I also added logs to check what abis were supported. It turned out that the list of supported abis was: x86, armeabi-v7a, armeabi So for us it looks fine because armeabi-v7a is there which should be supported, but the first abi is x86 and this one is used by default. To check supported abis we call Build.SUPPORTED_ABIS and even in the comment it says: An ordered list of ABIs supported by this device. The most preferred ABI is the first element in the list.

Probably we need to check that first abi on the list to fix the issue.