阿里云首页

Sophix关于Utils依赖包注意事项

  • 什么是 Utils SDK?Utils为阿里云移动云各产品SDK的公共依赖包,包含基础功能和公共功能模块的实现。Utils SDK接口会被各阿里云SDK产品调用,用户集成时不会直接调用其接口。

  • Sophix热修复中所依赖的Utils包版本最低需要为1.0.3。

  • 如使用了多个阿里云SDK产品,导致重复依赖多个Utils SDK,必须只保留某个产品中的最高版本的Utils包,同时删除其他产品中的Utils包。远程依赖时使用exclude(module:’alicloud-android-utils’)进行删除。

  • 如最终保留的Utils包是1.1.1或以上版本(热修复最新版本包含的是1.1.3版本),需要注意:

    • 远程依赖时,可能直接携带了ut的一个依赖包,这时如果出现冲突,可添加exclude(module:’alicloud-android-ut’)进行过滤,但是这样过滤后,utdid包也会同时移除掉,需要查看项目的所有阿里系依赖,最后只保留一份1.1.5.3版本以上的utdid包。

    • 本地依赖时,或远程依赖时添加exclude(module:’alicloud-android-ut’)进行过滤后,混淆开启后打包生成apk时可能报如下错误:

      Warning:com.alibaba.sdk.android.utils.c$1: can't find superclass or interface com.ut.mini.IUTApplication
      Warning:com.alibaba.sdk.android.utils.c: can't find referenced class com.ut.mini.UTAnalytics
      Warning:com.alibaba.sdk.android.utils.c: can't find referenced class com.ut.mini.UTHitBuilders
      Warning:com.alibaba.sdk.android.utils.c: can't find referenced class com.ut.mini.UTHitBuilders$UTCustomHitBuilder
      Warning:com.alibaba.sdk.android.utils.c: can't find referenced class com.ut.mini.UTHitBuilders$UTHitBuilder
      Warning:com.alibaba.sdk.android.utils.c: can't find referenced class com.ut.mini.UTTracker
      Warning:com.alibaba.sdk.android.utils.c: can't find referenced class com.ut.mini.UTAnalytics
      Warning:com.alibaba.sdk.android.utils.c: can't find referenced class com.ut.mini.UTHitBuilders$UTCustomHitBuilder
      Warning:com.alibaba.sdk.android.utils.c: can't find referenced class com.ut.mini.UTTracker
      Warning:com.alibaba.sdk.android.utils.c$1: can't find referenced class com.ut.mini.IUTApplication
      Warning:com.alibaba.sdk.android.utils.c$1: can't find referenced class com.ut.mini.core.sign.UTBaseRequestAuthentication
      Warning:com.alibaba.sdk.android.utils.c$1: can't find referenced class com.ut.mini.core.sign.IUTRequestAuthentication
      Warning:com.alibaba.sdk.android.utils.c$1: can't find referenced class com.ut.mini.crashhandler.IUTCrashCaughtListner
      Warning:there were 19 unresolved references to classes or interfaces.
    • 或者可能报如下错误:

      Warning:com.alibaba.sdk.android.utils.crashdefend.a$b: can't find superclass or interface com.alibaba.sdk.android.beacon.Beacon$OnUpdateListener
      Warning:com.alibaba.sdk.android.utils.crashdefend.a: can't find referenced class com.alibaba.sdk.android.beacon.Beacon
      Warning:com.alibaba.sdk.android.utils.crashdefend.a: can't find referenced class com.alibaba.sdk.android.beacon.Beacon$Builder
      Warning:com.alibaba.sdk.android.utils.crashdefend.a: can't find referenced class com.alibaba.sdk.android.beacon.Beacon$OnUpdateListener
      Warning:com.alibaba.sdk.android.utils.crashdefend.a: can't find referenced class com.alibaba.sdk.android.beacon.Beacon
      Warning:com.alibaba.sdk.android.utils.crashdefend.a: can't find referenced class com.alibaba.sdk.android.beacon.Beacon$Builder
      Warning:com.alibaba.sdk.android.utils.crashdefend.a: can't find referenced class com.alibaba.sdk.android.beacon.Beacon
      Warning:com.alibaba.sdk.android.utils.crashdefend.a$b: can't find referenced class com.alibaba.sdk.android.beacon.Beacon
      Warning:com.alibaba.sdk.android.utils.crashdefend.a$b: can't find referenced class com.alibaba.sdk.android.beacon.Beacon$Config
      Warning:com.alibaba.sdk.android.utils.crashdefend.a$b: can't find referenced class com.alibaba.sdk.android.beacon.Beacon$OnUpdateListener
      Warning:com.alibaba.sdk.android.utils.crashdefend.a$b: can't find referenced class com.alibaba.sdk.android.beacon.Beacon$Config
      Warning:com.alibaba.sdk.android.utils.crashdefend.a$b: can't find referenced class com.alibaba.sdk.android.beacon.Beacon
      Warning:com.alibaba.sdk.android.utils.crashdefend.a$b: can't find referenced class com.alibaba.sdk.android.beacon.Beacon$Config
      Warning:there were 21 unresolved references to classes or interfaces.
    • 如出现以上两种报错,或类似Warning:com.alibaba.sdk.android.utils.**的报错,在混淆规则中添加-dontwarn com.alibaba.sdk.android.utils.**即可解决。

若上述步骤仍未能定位问题,可以询问技术支持解决:技术支持

首页 Sophix关于Utils依赖包注意事项