Android Question ContentChooser problem

LucaMs

Expert
Licensed User
Longtime User
I have a problem with ContentChooser on a Android 7.10 EMULATOR (Genymotion):
--------- beginning of crash

a beutiful crash :p

This is the code:
B4X:
Sub ChooseImage
    Private CC As ContentChooser
    If Not(CC.IsInitialized) Then
        CC.Initialize("CC")
    End If
    CC.Show("image/*", "Choose image")
End Sub

I call that routine from Activity_Create (from Activity_Resume it's the same) of an Activity started by the Main.

I can not test the app on a device with that version of Android (of course, otherwise I would not have used an emulator :)).

Can someone do it (maybe even on Android 8)?


Many thanks.
 

LucaMs

Expert
Licensed User
Longtime User
I tried again using a small test project (attached):

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (actchooseimage) Create, isFirst = true **
** Activity (actchooseimage) Resume **
** Activity (actchooseimage) Pause, UserClosed = false **
--------- beginning of crash
 

Attachments

  • Choose image test.zip
    8.8 KB · Views: 250
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Have you checked the unfiltered logs?
This is the unfiltered of my app (not of the example I attached above):
Failed to set EGL_SWAP_BEHAVIOR on surface 0xe87e6d20, error=EGL_BAD_MATCH
** Activity (actchooseimage) Resume **
Skipped 38 frames! The application may be doing too much work on its main thread.
** Activity (actchooseimage) Pause, UserClosed = false **
Start proc 5467:android:ui/1000 for activity android/com.android.internal.app.ChooserActivity
Unexpected CPU variant for X86 using defaults: x86
START u0 {act=android.intent.action.GET_CONTENT cat=[android.intent.category.OPENABLE] typ=image/* flg=0x3000000 cmp=com.android.documentsui/.DocumentsActivity} from uid 10068 on display 0
Unexpected CPU variant for X86 using defaults: x86
Start proc 5482:com.android.documentsui/u0a9 for activity com.android.documentsui/.DocumentsActivity
gralloc_alloc: format 1 and usage 0x933 imply creation of host color buffer
ClassLoader referenced unknown path: /system/priv-app/DocumentsUI/lib/x86
Unexpected CPU variant for X86 using defaults: x86
Start proc 5497:com.android.externalstorage/u0a13 for content provider com.android.externalstorage/.ExternalStorageProvider
ClassLoader referenced unknown path: /system/priv-app/ExternalStorageProvider/lib/x86
After updating volumes, found 2 active roots
Failed to resume: java.io.IOException: Missing data
Unexpected CPU variant for X86 using defaults: x86
Start proc 5513:com.android.mtp/u0a10 for content provider com.android.mtp/.MtpDocumentsProvider
HostConnection::get() New Host Connection established 0xd77710c0, tid 5482
SND -> {7 appfuse mount 10010 5513 MtpDocumentsProvider}
Failed to mount /mnt/appfuse/10010_MtpDocumentsProvider: Invalid argument
RCV <- {400 7 Command failed}
Shutting down VM
FATAL EXCEPTION: main
Process: com.android.mtp, PID: 5513
java.lang.RuntimeException: Unable to get provider com.android.mtp.MtpDocumentsProvider: java.lang.IllegalStateException: command '7 appfuse mount 10010 5513 MtpDocumentsProvider' failed with '400 7 Command failed'
at android.app.ActivityThread.installProvider(ActivityThread.java:5856)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.IllegalStateException: command '7 appfuse mount 10010 5513 MtpDocumentsProvider' failed with '400 7 Command failed'
at android.os.Parcel.readException(Parcel.java:1692)
at android.os.Parcel.readException(Parcel.java:1637)
at android.os.storage.IMountService$Stub$Proxy.mountAppFuse(IMountService.java:1368)
at android.os.storage.StorageManager.mountAppFuse(StorageManager.java:1286)
at com.android.mtp.AppFuse.mount(AppFuse.java:69)
at com.android.mtp.MtpDocumentsProvider.onCreate(MtpDocumentsProvider.java:136)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at android.provider.DocumentsProvider.attachInfo(DocumentsProvider.java:177)
at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
... 10 more

MtpDocumentsProvider? Searching :)...
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
There is (Android) a class named DocumentsProvider but no MtpDocumentsProvider.

From a site:
Si sente ormai parlare da anni di MTP, ma molti magari non conoscono la differenza con altri sistemi simili e il perché si utilizza così spesso. MTP significa Multimedia Transfer Protocol ed è un protocollo che mette in comunicazione due dispositivi elettronici, solitamente un computer e un dispositivo portatile. Se ne parla spesso su Android perché da Android 4.0 Ice Cream Sandwich è diventato il protocollo standard per scambiare file con il proprio PC quando lo si collega via USB.


Obviously I'm not using a USB, since I'm using an emulator, and I'm not passing files from pc to "device".

However, on @Emme Developer's real devices it works (at least the test project); this should be enough.


Thank you
 
Upvote 0
Top