HMS-Core / hms-react-native-plugin

This repo contains all of React-Native HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
235 stars 67 forks source link

Icon in Android app not working with @hmscore/react-native-hms-ml #240

Closed breeedly closed 1 year ago

breeedly commented 1 year ago

Currently I have an application in production and it works correctly. Speech recognition is being implemented in the app, so the following package was installed:

"@hmscore/react-native-hms-ml": "^3.5.0-301"

The following versions are installed in the application

"react": "17.0.2",
"react-native": "0.67.4"

JDK: openjdk 11.0.16.1 2022-07-19 LTS OpenJDK Runtime Environment Zulu11.58+23-CA (build 11.0.16.1+1-LTS) OpenJDK 64-Bit Server VM Zulu11.58+23-CA (build 11.0.16.1+1-LTS, mixed mode)

It was configured according to the documentation and the voice recognition works, but the application icon no longer recognizes the one it had, but is modified by the default android one when a project is created in react-native image

The application previously already has the following packages and has worked correctly

"@hmscore/react-native-hms-availability": "^5.2.0-300",
"@hmscore/react-native-hms-location": "^5.1.0-303",
"@hmscore/react-native-hms-push": "^5.3.0-304",

In addition to this, when generating an apk-release.apk without the package "@hmscore/react-native-hms-ml" the size of the .apk file is 36.8Mb, but when adding this package the apk-release.apk has a size of 177.4Mb

xuxiapu commented 1 year ago

@breeedly We tried the ML Demo. The logo. png in the android/app/src/main/res/mimap hdpi directory should not be set as the application icon.

It is determined according to the configuration in the AndroidManifest file: image

breeedly commented 1 year ago

Add the following in android/app/src/main/AndroidManifest.xml, but it still doesn't work: image

This is how the directory currently looks

image

Doing npm uninstall of @hmscore/react-native-hms-ml and commenting out the code where hmscore/react-native-hms-ml was set causes the icon to work correctly again.

xuxiapu commented 1 year ago

@breeedly Please provide the demo code for us to locate the problem.

breeedly commented 1 year ago

@xuxiapu Sorry for the delay, here is the demo code. https://github.com/breeedly/DemoProject

xuxiapu commented 1 year ago

@breeedly

  1. The problem of icon change has nothing to do with the HMSCore ML plug-in.
  2. To change the icon, you need to configure the IC_ launcher.xml. image References are as follows:
    <?xml version="1.0" encoding="utf-8"?>
    <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/ic_launcher_adaptive_back"/>
    <foreground android:drawable="@mipmap/ic_launcher_adaptive_fore"/>
    </adaptive-icon>

    And configure corresponding pictures, such as:

image

breeedly commented 1 year ago

@xuxiapu thanks for the support, the icon works correctly again.