Start a new topic

Accessing native Android file browser

Hey there,


so currently our App features a file browser. For now the file browser is planned for the usage of the app without glasses. The file browser implementation is based on the native android file browser.


Running an empty test project, the file browser works like intended (see Video 1). After installing the Snapdragon Spaces SDK, the File Browser stops working (see Video 2).


So in our current project we imported the files for the file browser after the installation of the Spaces SDK files. This file browser comes with multiple Android Plugins, which are conflicting for duplicate classes when trying to build.


image


When deleting all plugins that begin with “androidx”, the project will properly build again, but fails to return to the app, after picking a file in the file browser


Our guess is, that these plugins files are conflicting with some hidden files in the Spaces SDK.


And here is an excerpt from the console, when trying to build with duplicate plugins:


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class android.support.v4.app.RemoteActionCompatParcelizer found in modules core-1.5.0-rc01-runtime.jar (androidx.core:core:1.5.0-rc01) and jetified-androidx.core.core-1.1.0-runtime.jar (:androidx.core.core-1.1.0:)
Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules core-1.5.0-rc01-runtime.jar (androidx.core:core:1.5.0-rc01) and jetified-androidx.core.core-1.1.0-runtime.jar (:androidx.core.core-1.1.0:)
Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.5.0-rc01-runtime.jar (androidx.core:core:1.5.0-rc01) and jetified-androidx.core.core-1.1.0-runtime.jar (:androidx.core.core-1.1.0:)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.5.0-rc01-runtime.jar (androidx.core:core:1.5.0-rc01) and jetified-androidx.core.core-1.1.0-runtime.jar (:androidx.core.core-1.1.0:)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.5.0-rc01-runtime.jar (androidx.core:core:1.5.0-rc01) and jetified-androidx.core.core-1.1.0-runtime.jar (:androidx.core.core-1.1.0:)

...

mp4
(6.16 MB)
mp4
(8.18 MB)

Hi Tim,


I don't have a perfect solution for this as library conflicts can be rather tricky.


You could experiment with:

  • Export your Unity project as gradle project and check your gradle.properties file for useAndroidX and and enable jetifier options AndroidX Overview  |  Jetpack  |  Android Developers. Note that Spaces should automatically set these to true. 
  • Align the versions used by spaces with the versions used by the file browser plugin and hope the versions don't cause further conflicts. By checking the plugin I found the following AndroidX dependencies 

    image

     
  • Choose different Android API levels in your player settings 

Thank you for your reply.


It is clear that the breaking of file browsing functionality by integrating Snapdragon SDK is not a desired behaviour and it can affect other developers. We are very thankful for your help and would love to look for the solution together.


To your proposed solutions -- building as gradle is not something we usually do and would prefer to avoid it.
Changing Android API in player settings did not change the situation.
And we are not sure what needs to be done to "align the versions".

Here is that project that uses the file browsing functionality, before Spaces SDK is integrated. Maybe it can be helpful for you to try it out by yourself to see the issue more closely.  

Login to post a comment