Skip to content

红米2A Android4.4.4安装debug包打开app crash #501

@xingstarx

Description

@xingstarx

异常类型:app运行时异常

手机型号:Xiaomi HM 2A

手机系统版本:Android4.4.4

tinker版本: 1.7.11

gradle版本: 3.4.1

是否使用热更新SDK: Patch SDK

系统:如:Mac

堆栈/日志:

05-27 18:40:39.072 10693-10693/com.pintec.dumiao E/Tinker.UncaughtHandler: catch exception when loading tinker:java.lang.RuntimeException: Unable to instantiate application com.pintec.dumiao.app.DumiaoApplication: com.tencent.tinker.loader.TinkerRuntimeException: Tinker Exception:createDelegate failed
                                                                               at android.app.LoadedApk.makeApplication(LoadedApk.java:509)
                                                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4427)
                                                                               at android.app.ActivityThread.access$1500(ActivityThread.java:147)
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:136)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5135)
                                                                               at java.lang.reflect.Method.invokeNative(Native Method)
                                                                               at java.lang.reflect.Method.invoke(Method.java:515)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
                                                                               at dalvik.system.NativeStart.main(Native Method)
                                                                            Caused by: com.tencent.tinker.loader.TinkerRuntimeException: Tinker Exception:createDelegate failed
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.createDelegate(TinkerApplication.java:112)
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.ensureDelegate(TinkerApplication.java:118)
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.onBaseContextAttached(TinkerApplication.java:131)
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.attachBaseContext(TinkerApplication.java:146)
                                                                               at android.app.Application.attach(Application.java:185)
                                                                               at android.app.Instrumentation.newApplication(Instrumentation.java:991)
                                                                               at android.app.Instrumentation.newApplication(Instrumentation.java:975)
                                                                               at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
                                                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4427) 
                                                                               at android.app.ActivityThread.access$1500(ActivityThread.java:147) 
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:136) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5135) 
                                                                               at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                               at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611) 
                                                                               at dalvik.system.NativeStart.main(Native Method) 
                                                                            Caused by: java.lang.ClassNotFoundException: com.pintec.dumiao.app.DumiaoApplicationLike
                                                                               at java.lang.Class.classForName(Native Method)
                                                                               at java.lang.Class.forName(Class.java:251)
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.createDelegate(TinkerApplication.java:106)
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.ensureDelegate(TinkerApplication.java:118) 
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.onBaseContextAttached(TinkerApplication.java:131) 
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.attachBaseContext(TinkerApplication.java:146) 
                                                                               at android.app.Application.attach(Application.java:185) 
                                                                               at android.app.Instrumentation.newApplication(Instrumentation.java:991) 
                                                                               at android.app.Instrumentation.newApplication(Instrumentation.java:975) 
                                                                               at android.app.LoadedApk.makeApplication(LoadedApk.java:504) 
                                                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4427) 
                                                                               at android.app.ActivityThread.access$1500(ActivityThread.java:147) 
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:136) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5135) 
                                                                               at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                               at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611) 
                                                                               at dalvik.system.NativeStart.main(Native Method) 
                                                                            Caused by: java.lang.NoClassDefFoundError: com/pintec/dumiao/app/DumiaoApplicationLike
                                                                               at java.lang.Class.classForName(Native Method) 
                                                                               at java.lang.Class.forName(Class.java:251) 
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.createDelegate(TinkerApplication.java:106) 
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.ensureDelegate(TinkerApplication.java:118) 
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.onBaseContextAttached(TinkerApplication.java:131) 
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.attachBaseContext(TinkerApplication.java:146) 
                                                                               at android.app.Application.attach(Application.java:185) 
                                                                               at android.app.Instrumentation.newApplication(Instrumentation.java:991) 
                                                                               at android.app.Instrumentation.newApplication(Instrumentation.java:975) 
                                                                               at android.app.LoadedApk.makeApplication(LoadedApk.java:504) 
                                                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4427) 
                                                                               at android.app.ActivityThread.access$1500(ActivityThread.java:147) 
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:136) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5135) 
                                                                               at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                               at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611) 
                                                                               at dalvik.system.NativeStart.main(Native Method) 
                                                                            Caused by: java.lang.ClassNotFoundException: Didn't find class "com.pintec.dumiao.app.DumiaoApplicationLike" on path: DexPathList[[zip file "/data/app/com.pintec.dumiao-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.pintec.dumiao-1, /vendor/lib, /system/lib]]
                                                                               at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
                                                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
                                                                               at java.lang.Class.classForName(Native Method) 
                                                                               at java.lang.Class.forName(Class.java:251) 
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.createDelegate(TinkerApplication.java:106) 
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.ensureDelegate(TinkerApplication.java:118) 
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.onBaseContextAttached(TinkerApplication.java:131) 
                                                                               at com.tencent.tinker.loader.app.TinkerApplication.attachBaseContext(TinkerApplication.java:146) 
                                                                               at android.app.Application.attach(Application.java:185) 
                                                                               at android.app.Instrumentation.newApplication(Instrumentation.java:991) 
                                                                               at android.app.Instrumentation.newApplication(Instrumentation.java:975) 
                                                                               at android.app.LoadedApk.makeApplication(LoadedApk.java:504) 
                                                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4427) 
                                                                               at android.app.ActivityThread.access$1500(ActivityThread.java:147) 
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:136) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5135) 
                                                                               at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                               at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611) 
                                                                               at dalvik.system.NativeStart.main(Native Method) 

是运行时异常,编译打包通过命令行方式 ./gradlew assembleDebug 安装在红米2A Android4.4.4的手机上,打开app,直接crash,以上是log信息,使用红米3 Android5.1.1的手机安装,打开app,没有任何问题

是否开启tinker编译参数 tinkerEnabled = isRelease()
isRelease()方法内的代码如下:

def isRelease() {
    Gradle gradle = getGradle()
    String  tskReqStr = gradle.getStartParameter().getTaskRequests().toString()

    Pattern pattern;
    if (tskReqStr.contains("assemble")) {
        println tskReqStr
        pattern = Pattern.compile("assemble(\\w*)(Release|Debug)")
    }  else if (tskReqStr.contains("tinkerPatch")) {
        println tskReqStr
        pattern = Pattern.compile("tinkerPatch(\\w*)(Release|Debug)")
    } else {
        pattern = Pattern.compile("generate(\\w*)(Release|Debug)")
    }
    Matcher matcher = pattern.matcher(tskReqStr)

    if (matcher.find()) {
        String task = matcher.group(0).toLowerCase()
        println("[BuildType] Current task: " + task)
        return task.contains("release")
    } else {
        println "[BuildType] NO MATCH FOUND"
        return false;
    }
}

接入方式,采用的是ApplicationLike的形式,使用注解生成Application。

使用release编译,生成apk文件,打补丁包,都是正常的,下发补丁修复app一切ok,就是不明白为啥在Android4.4.4的手机上,安装debug包有问题?

如果把 tinkerEnabled 的值修改为 tinkerEnabled = true,那么Android4.4.4安装debug版本的app也是可以正常打开的,不会crash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions