react-native-change-icon
react-native-change-icon copied to clipboard
android app failed -length=1; index=1
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>
I am also getting this issue . Any Solution @skb1129 ?
Any update on this @skb1129 ?
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
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.
same here
I'm also seeing this issue. Any ideas when the fix will be rolled in?
Same issue, have anyone found solution ?
This issue is fixed in v5