CapacitorGoogleAuth: java.lang.NegativeArraySizeException: -1

Hi, I have this error in AndroidStudio debug:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.etarom.xxxxxx/io.ionic.starter.MainActivity}: java.lang.NegativeArraySizeException: -1 .... .... Caused by: java.lang.NegativeArraySizeException: -1 at com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.load(GoogleAuth.java:71)

I checked the configurations and I don’t seem to have forgotten anything, any suggestions?

regards

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21

Most upvoted comments

Do you know what made it work???

image

By adding to JAVA initiatial values for this damned scoped array, I don’t know Java that’s why I went for Ionic in the first place 😕

image

NOTHING ELSE WORKED FOR ME.

@fletcherist I will try your suggestions later, this is a hobbyist project

I’m so sorry you can’t get it to work. My working configuration is:

.. "plugins": { "GoogleAuth": { "scopes": ["profile", "email"], "serverClientId": "xxxxxx.apps.googleusercontent.com", "androidClientId": "xxxxxx.apps.googleusercontent.com", "forceCodeForRefreshToken": true } .... } ...

package version:

..... "@capacitor/android": "4.5.0", "@capacitor/core": "^4.5.0", "@capacitor/ios": "^4.5.0", "@codetrix-studio/capacitor-google-auth": "^3.2.0", .....

working config

const config: CapacitorConfig = {
  webDir: 'out',
  bundledWebRuntime: false,
  plugins: {
    GoogleAuth: {
      serverClientId:
        'xxx-xxx.apps.googleusercontent.com',
      androidClientId:
        'xxx-xxx.apps.googleusercontent.com',
      scopes: ['profile', 'email'],
    },
  },
};

strings.xml has no capacitor-google-auth fields

the problem is at GoogleAuth.java

// 71 line
Scope[] scopes = new Scope[scopeArray.length - 1];

if passed empty scopes, it panics and crashes with that error

Could you clarify how you fixed your configuration? Thanks