Skip to content

AppIcon.change('icon_name') returns -1 #26

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

Open
ghonche opened this issue Jan 16, 2023 · 1 comment
Open

AppIcon.change('icon_name') returns -1 #26

ghonche opened this issue Jan 16, 2023 · 1 comment

Comments

@ghonche
Copy link

ghonche commented Jan 16, 2023

Describe the bug

I'm using @capacitor-community/app-icon version 3.1.0-beta.0 in my android project.
Following code returns -1 as response:

AppIcon.change({name: 'ic_launcher2', suppressNotification: true}).then(response =>{
console.log(response);
});

And app icon doesn't change.

I added activity and activity-alias to AndroidManifest.xml like this:

  <activity
        android:exported="true"
        android:name="pro.lifa.app.MainActivity"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
        android:hardwareAccelerated="true"
        android:label="@string/title_activity_main"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBarLaunch"
        android:supportsPictureInPicture="true"
        android:windowSoftInputMode="adjustResize"
         tools:targetApi="n">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>

            <data android:host="web.lifa.pro"
                  android:scheme="https"/>

            <data android:host="web.lifa.pro"
                  android:scheme="http"/>
        </intent-filter>
    </activity>



    <activity-alias
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:name=".ic_launcher"
        android:enabled="true"
        android:exported="true"
        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:label="@string/app_name"
        android:icon="@mipmap/ic_launcher2"
        android:roundIcon="@mipmap/ic_launcher2_round"
        android:name=".ic_launcher2"
        android:enabled="false"
        android:exported="true"
        android:targetActivity=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity-alias>

Expected behavior
AppIcon.change('icon_name') must change the app icon.

Screenshots
Console log:
Screenshot 2023-01-16 at 12 08 29 PM

Smartphone

  • Device: Pixel 6 Emulator
  • OS: android API 31

Additional context

  • minSdkVersion = 22
  • compileSdkVersion = 32
  • targetSdkVersion = 32

Any help is appreciated.

@johnborges
Copy link
Collaborator

@ghonche There are some known issues with the beta version of the plugin and certain versions of Android. I'll try making an AVD with the settings you mentioned and see if I can get anymore info on your error.

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

2 participants