App crashes on file.getimage

Hi Antonie,

I updated my app to the 2.9.1 built with file 2.25, we use to just use the capture to allow for camera or gallery but with the recent changes we are moving that to use the file.getImage. When doing this it opens up the gallery however when selecting an image (Android, galaxy s10, latest android version) the app crashes.

When I run the logcat it displays this error

--------- beginning of crash
02-05 06:39:19.852 21968 21968 E AndroidRuntime: FATAL EXCEPTION: main
02-05 06:39:19.852 21968 21968 E AndroidRuntime: Process: [appid], PID: 21968
02-05 06:39:19.852 21968 21968 E AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=80000, result=-1, data=Intent { dat=content://media/external/images/media/14577 flg=0x1 (has extras) }} to activity {[appname]/}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.ClipData.getItemCount()' on a null object reference

The call is basic

forge.file.getImage( {width:1000},function (file) { do stuff})


I have also confirmed that this happens on a basic test app. When using latest build and file module only, simple click event, after selecting the image it crashes. Here is the sample html

android version: 10

index.html (2.4 KB)

I can’t reproduce the crash on my side but this wouldn’t be the first time Samsung provided a broken implementation of an Android API.

I’ve pushed a new version of the module that will fall back to the pre-JellyBean API’s on devices that don’t support getClipData() and/or getItemCount.

The one down-side is that affected devices may not be able to support multi-image selection.

I don’t have access to an S10 on my side so I’m unfortunately not able to test it. Can you please give it a spin and let me know how it goes before I push it to final release?

You can bump your config.json as follows:

"file": {
    "version": "2.26"

Hi @antoinevg,

Thanks for the quick push!

I was trying to build off it and its telling me this

Forge API call to reload/buildevent/create went wrong: file version 2.26 is not available

Whoops! :blush:

Can you try again please?

That seems to have worked!

Thanks, Antoine!

1 Like