react-native-change-icon icon indicating copy to clipboard operation
react-native-change-icon copied to clipboard

android app failed -length=1; index=1

Open neonithya opened this issue 2 years ago • 2 comments

Platform

  • Android

Description E/unknown:ReactNative: Exception in native call java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 at com.reactnativechangeicon.ChangeIconModule.getIcon

Screenshots If applicable, add screenshots to help explain your problem.

Versions "react": "18.1.0", "react-native": "0.70.0", "react-native-change-icon": "^4.0.0"

Code Snippet

<uses-permission android:name="android.permission.INTERNET" />

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/checked"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustResize"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
    <activity-alias
        android:name="com.appicon.MainActivitychecked"
        android:enabled="false"
        android:exported="true"
        android:icon="@mipmap/checked"
        android:targetActivity=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity-alias>
    <activity-alias
        android:name="com.appicon.MainActivitycancel"
        android:enabled="false"
        android:exported="true"
        android:icon="@mipmap/cancel"
        android:targetActivity=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity-alias>
</application>

neonithya avatar Sep 19 '22 06:09 neonithya

I am also getting this issue . Any Solution @skb1129 ?

anujmpec avatar Nov 07 '22 10:11 anujmpec

Any update on this @skb1129 ?

anujmpec avatar Nov 15 '22 12:11 anujmpec

I assume there error is coming from this line: https://github.com/skb1129/react-native-change-icon/blob/master/android/src/main/java/com/reactnativechangeicon/ChangeIconModule.java#L50 so activity.getComponentName().getClassName() must not contain MainActivity

jaredly avatar Jan 11 '23 15:01 jaredly

Ah, if the className ends with MainActivity, then .split() apparently just returns a single element, the text before the delimeter. e.g. "com.example.MainActivity" gives you a single-element array with "com.example." in it. So we're getting an exception.

jaredly avatar Jan 11 '23 15:01 jaredly

same here

tacianoscur avatar Mar 27 '23 19:03 tacianoscur

I'm also seeing this issue. Any ideas when the fix will be rolled in?

gary-cohen avatar May 20 '23 19:05 gary-cohen

Same issue, have anyone found solution ?

avinm-hashcrypt avatar Jul 20 '23 06:07 avinm-hashcrypt

This issue is fixed in v5

skb1129 avatar Aug 20 '23 05:08 skb1129