Closed codemeall closed 2 years ago
Can you include your AndroidManifest.xml?
Same here
Platform
Description After changing the icon the app cannot be opened anymore. Opening the app via the default home screen launcher will only open the app's system settings / app info. Starting the app via android studio will print the following:
$ adb shell am start -n "at.or.myappname.app/at.or.myappname.app.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "at.or.myappname.app/at.or.myappname.app.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=at.or.myappname.app/.MainActivity }
Error type 3
Error: Activity class {at.or.myappname.app/at.or.myappname.app.MainActivity} does not exist.
Error while Launching activity
Everything works on ios like a charm so this is really an android only issue ... and probably just a problem with my AndroidManifest.xml
file...
To Reproduce Steps to reproduce the behavior: I am really uncertain what causes this to happen.
Expected behavior Expected app to launch normal after changing icon.
Device (please complete the following information):
Versions
Code Snippet Please provide a minimal code snippet of the setup that you did to use this package. [e.g. AndroidManifest.xml]
changeIcon('org_myappname_default')
changeIcon('org_614a48b4726dce4c06f53a2e')
Disclaimer: on android i am prefixing all the icon ids with org_
because resources are not allowed to start with numbers. The png files are named accordingly - eg "android/src/main/res/mipmap-hdpi/org_60d915f62573580b22fd65b1.png".
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.or.myappname.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/myappname_default"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<!-- GMAPS: -->
<meta-data android:name="com.google.android.geo.API_KEY" android:value="......" />
<!-- GMAPS: You will also only need to add this uses-library tag -->
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- ========== custom icons ==============
https://github.com/skb1129/react-native-change-icon
Note that the name in should be "com.{package_name}.MainActivity%", where % is the icon name.
-->
<!-- built in default 'myappname_default' -->
<activity-alias
android:name="at.or.myappname.app.MainActivity"
android:enabled="true"
android:icon="@mipmap/myappname_default"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.action.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name="at.or.myappname.app.MainActivitymyappname_default"
android:enabled="true"
android:icon="@mipmap/myappname_default"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.action.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name="at.or.myappname.app.MainActivityorg_myappname_default"
android:enabled="true"
android:icon="@mipmap/myappname_default"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.action.LAUNCHER" />
</intent-filter>
</activity-alias>
<!-- entity 614a48b4726dce4c06f53a2e -->
<activity-alias
android:name="at.or.myappname.app.MainActivityorg_614a48b4726dce4c06f53a2e"
android:enabled="true"
android:icon="@mipmap/org_614a48b4726dce4c06f53a2e"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.action.LAUNCHER" />
</intent-filter>
</activity-alias>
<!-- entity 60d915f62573580b22fd65b1 -->
<activity-alias
android:name="at.or.myappname.app.MainActivityorg_60d915f62573580b22fd65b1"
android:enabled="true"
android:icon="@mipmap/org_60d915f62573580b22fd65b1"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.action.LAUNCHER" />
</intent-filter>
</activity-alias>
<!-- entity 60da163af7ea4640d0e01fcc -->
<activity-alias
android:name="at.or.myappname.app.MainActivityorg_60da163af7ea4640d0e01fcc"
android:enabled="true"
android:icon="@mipmap/org_60da163af7ea4640d0e01fcc"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.action.LAUNCHER" />
</intent-filter>
</activity-alias>
</application>
</manifest>
@codemeall this is expected as we are not mounting MainActivity, we are mounting the activity-alias and by default, the run script tries to open MainActivity. It only happens in development mode, with no issues in release builds.
Platform
Description In android when changing app and re-run it says the main activity does not exist. I doubt once after release if icon changed and releasing new version, then any update from play store will make app crash, couldn't verify this scenario but I doubt.
To Reproduce Steps to reproduce the behavior:
Expected behavior Should run the app as in AndroidMenifest.xml we are giving alias with main actitity + "iconname"
Screenshots
Device (please complete the following information):
Versions