1

The app was working perfectly with the previous version :

implementation 'com.huawei.hms:ml-computer-vision-segmentation:2.2.0.300'
implementation 'com.huawei.hms:ml-computer-vision-image-segmentation-multiclass-model:2.2.0.300'
implementation 'com.huawei.hms:ml-computer-vision-image-segmentation-body-model:2.2.0.300'

Now when I updated to 3.0.0.301 :

implementation 'com.huawei.hms:ml-computer-vision-segmentation:3.0.0.301'
implementation 'com.huawei.hms:ml-computer-vision-image-segmentation-multiclass-model:3.0.0.301'
implementation 'com.huawei.hms:ml-computer-vision-image-segmentation-body-model:3.0.0.301'

The app crash and I get this message :

2021-08-04 00:35:50.103 32383-32383/maa.abc.background_changer E/ActivityThread: Failed to find provider info for com.huawei.hms

2021-08-04 00:35:50.109 32383-32383/maa.abc.background_changer E/AbstractInitializer: huawei_module_mlkit_imgseg -> No need to switch because the context of the dynamic module is null or the context of full sdk

2021-08-04 00:35:50.109 32383-32383/maa.abc.background_changer E/AbstractInitializer: huawei_module_mlkit_imgseg -> The context of the dynamic module belongs to LOCAL

2021-08-04 00:35:50.156 32383-32383/maa.abc.background_changer E/HIAI_DDK_MSG: /AiDllParser.cpp Load(45)::"dlopen load lib failed,lib[/system/lib64/libhiai_foundation.huawei.so],errmsg [dlopen failed: can't read file "/data/app/~~tmU2wHTAY38LvsdjeofDpA==/maa.abc.background_changer-QDVrIWUG8BkHCusrq3t_HQ==/lib/arm64": Is a directory]"

2021-08-04 14:02:10.286 7082-7082/? E/HIAI_DDK_MSG: /hiai_foundation_dl_helper.c HIAI_Foundation_GetSymbol(50)::"HIAI_Foundation_GetSymbol error."

2021-08-04 14:02:10.286 7082-7082/? E/HIAI_DDK_MSG: /hiai_version.c HIAI_GetVersion(66)::"sym HIAI_GetVersion not found."

2021-08-04 14:02:10.286 7082-7082/? E/HIAI_DDK_MSG: /AiDllParser.cpp Load(38)::"Load realpath failed in line 38"

2021-08-04 14:02:10.286 7082-7082/? E/HIAI_DDK_MSG: /AiDllParser.cpp Load(45)::"dlopen load lib failed,lib[/vendor/lib64/libai_client.so],errmsg [dlopen failed: can't read file "/data/app/~~mbQecxD1bZ8erjK-NEO8yw==/com.hauwei.mlkit.sample.gesturechangebackground-2NSWslAh4_jWMK0KxcOV1g==/lib/arm64": Is a directory]"

2021-08-04 14:02:10.286 7082-7082/? E/HIAI_DDK_MSG: /AiDllParser.cpp Load(38)::"Load realpath failed in line 38"

2021-08-04 14:02:10.286 7082-7082/? E/HIAI_DDK_MSG: /AiDllParser.cpp Load(45)::"dlopen load lib failed,lib[/system/lib64/libhiai_foundation.huawei.so],errmsg [dlopen failed: can't read file "/data/app/~~mbQecxD1bZ8erjK-NEO8yw==/com.hauwei.mlkit.sample.gesturechangebackground-2NSWslAh4_jWMK0KxcOV1g==/lib/arm64": Is a directory]"

2021-08-04 14:02:10.287 7082-7082/? E/HIAI_DDK_MSG: /ops_kernel_store_manager.cpp LoadComputeLibrary(396)::"hook function Initialize failed"

2021-08-04 14:02:10.287 7082-7082/? E/HIAI_DDK_MSG: /ops_kernel_store_manager.cpp RegComputeLibrary(303)::"RegComputeLibrary call LoadComputeLibrary fail"

2021-08-04 14:02:10.287 7082-7082/? E/V1CL: /rom_interface.cpp OpenClient(46)::"Open libai_client.so failed, error: dlopen failed: library "/vendor/lib64/libhiai_foundation.so" not found"

2021-08-04 14:02:10.287 7082-7082/? E/V1CL: /aicpv1cl_initialize.cpp Init(29)::"OpenClient failed"

2021-08-04 14:02:10.287 7082-7082/? E/HIAI_DDK_MSG: /ops_kernel_store_manager.cpp LoadComputeLibrary(396)::"hook function Initialize failed"

2021-08-04 14:02:10.287 7082-7082/? E/HIAI_DDK_MSG: /ops_kernel_store_manager.cpp RegComputeLibrary(303)::"RegComputeLibrary call LoadComputeLibrary fail"

2021-08-04 14:02:10.380 7082-7082/? A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 7082 (hangebackground), pid 7082 (hangebackground)

Here's an example of my code:

public class ImageSegmentation {

    private MLImageSegmentationAnalyzer analyzer;

    public void analyzer(Bitmap src, MLCallBack mlCallBack) {
        MLImageSegmentationSetting setting = new MLImageSegmentationSetting.Factory()
                .setExact(true)
                .setAnalyzerType(MLImageSegmentationSetting.BODY_SEG)
                .setScene(MLImageSegmentationScene.FOREGROUND_ONLY)
                .create();
        this.analyzer = MLAnalyzerFactory.getInstance().getImageSegmentationAnalyzer(setting);
        MLFrame mlFrame = new MLFrame.Creator().setBitmap(src).create();
        Task<MLImageSegmentation> task = this.analyzer.asyncAnalyseFrame(mlFrame);
        task.addOnSuccessListener(imageSegmentationResult -> {
            if (imageSegmentationResult != null) mlCallBack.onMLCompleted(imageSegmentationResult);
            else mlCallBack.onMLFailed();
        }).addOnFailureListener(e -> mlCallBack.onMLFailed());
    }

}

Gradle :

repositories {
    jcenter()
    mavenCentral()
    google()
    maven { url "https://jitpack.io" }
    maven { url "http://dl.bintray.com/vsmaks/maven" }
    maven { url "http://dl.bintray.com/dasar/maven" }
    maven { url 'https://developer.huawei.com/repo/' }
    maven() { url "https://oss.sonatype.org/content/repositories/snapshots" }
    maven {
        url "http://dl.bintray.com/piasy/maven"
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:4.2.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

Android Studio version : Android Studio arctic fox 2020.3.1

Thank you.

The app crashes on :

Huawei P8 Lite 2017 running Android 8.0

Xiaomi POCO X3 NFC running Android 11.0

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • 1
    How are you testing (device or emulator)? Side note, all of public facing Huawei documentation in EN appears to use the older version. – Morrison Chang Aug 04 '21 at 14:04
  • @MorrisonChang thank you so much for your comment, I've tested the app on two devices (Huawei and Xiaomi) the app crashes on the both of them – Mouaad Abdelghafour AITALI Aug 04 '21 at 14:21
  • You should update your post with details of devices (model number/OS version etc.) – Morrison Chang Aug 04 '21 at 14:24
  • @MorrisonChang I've updated my question, in fact, I've found someone facing the same issue in the [Huawei Developer forum](https://forums.developer.huawei.com/forumPortal/en/topic/0202630340816550019), the app crash on other device brands such as OPPO, Samsung – Mouaad Abdelghafour AITALI Aug 04 '21 at 14:27
  • I recommend model numbers as well since regional variations exist. I would also post on the official Huawei dev forum as well along with the info the Huawei team asked for in that thread. – Morrison Chang Aug 04 '21 at 14:34

1 Answers1

1

Thank you for your feedback. The R&D team confirms that the version 3.0.0.301 is faulty. Therefore, it is recommended that you use an earlier version of the ML kit, which has been modified in the current document.

enter image description here

For more details, You can refer to this Docs.

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • Hi @zhangxaochen Thanks for your post I have tried this everything works perfectly but google play store not accept my app with 2.2.0.300. – Muhammad Zeeshan Dec 04 '22 at 13:59