Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android app crashed when share through email #1213

Open
phihungnv opened this issue Jun 7, 2023 · 7 comments
Open

Android app crashed when share through email #1213

phihungnv opened this issue Jun 7, 2023 · 7 comments

Comments

@phihungnv
Copy link

14403-14484/com.xxx E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
Process: com.xxx, PID: 14403
java.lang.ArrayIndexOutOfBoundsException: length=0; index=-1
at java.util.ArrayList.remove(ArrayList.java:506)
at nl.xservices.plugins.SocialSharing$1.run(SocialSharing.java:199)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)

@phihungnv phihungnv changed the title java.lang.ArrayIndexOutOfBoundsException: length=0; index=-1 Android app crashed when share through email Jun 7, 2023
@andrerds
Copy link

I'm facing the same issue. Does anyone have any suggestions to fix it? :(.

@EYALIN
Copy link

EYALIN commented Jul 16, 2023

@phihungnv @andrerds it looks like you don't have any email app installed maybe

@andrerds
Copy link

Hi,

I was able to make the app work, but I haven't been able to test it on different versions of Android yet.

Here is a possible solution, which is not definitive, but it stopped the app from crashing for me.

On line 167, I added a check:

if(fileUris.isEmpty()){ return; }

As I said, it is not a definitive solution, but it stopped the app from crashing on Android 12.

I will continue testing the app on different versions of Android to see if I can find a more definitive solution.

@andrerds
Copy link

file fix in : SocialSharing.java

@acosme
Copy link

acosme commented Aug 7, 2023

Solved this fixing the issues in this pr:

https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/pull/1206/files

tested in android 13

@Dan890
Copy link

Dan890 commented Aug 23, 2023

@acosme and @andrerds
the solutions below not fixed in my app.

still crush on android 12

@kiozer001
Copy link

kiozer001 commented Jan 24, 2024

@Dan890 @andrerds @acosme @phihungnv
creo que he resuelto el problema, Solo agregue en el Androidanifest.xml lo siguiente

<queries>
    <package android:name="com.google.android.gm" />
    <package android:name="com.microsoft.office.outlook" />
</queries>

Esto nos permita que la aplicacion nos deje elegir entre el app de gmail o la de outlook, en caso de que se requiera que aparezca otra aplicación de correo, se necesitara agregar tambien el nombre del paquete que se requiera

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants