alibaba / freeline

A super fast build tool for Android, an alternative to Instant Run
https://www.freelinebuild.com/
BSD 3-Clause "New" or "Revised" License
5.48k stars 623 forks source link

增量运行后,报dagger2的错:“Class ref in pre-verified class resolved to unexpected implementation” #589

Closed zengyongchang closed 7 years ago

zengyongchang commented 7 years ago

各位大神: 我在增量运行(就是在some_activity.onCreate里把toast的内容改改),报错了。指向的是我Application.onCreat里的一句dagger2: e1 望帮忙分析分析,dagger偶是必用滴 完整日志:

01-09 15:01:03.109 21869-21869/com.udte.anhui.launcher E/AndroidRuntime: FATAL EXCEPTION: main
                                                                         Process: com.udte.anhui.launcher, PID: 21869
                                                                         java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
                                                                             at com.udte.anhui.launcher.base.App.onCreate(App.java:55)
                                                                             at com.antfortune.freeline.FreelineApplication.startRealApplication(FreelineApplication.java:51)
                                                                             at com.antfortune.freeline.FreelineApplication.onCreate(FreelineApplication.java:32)
                                                                             at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1021)
                                                                             at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
                                                                             at android.app.ActivityThread.access$1500(ActivityThread.java:135)
                                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                             at android.os.Looper.loop(Looper.java:136)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5017)
                                                                             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:788)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
                                                                             at dalvik.system.NativeStart.main(Native Method)
01-09 15:03:42.269 22182-22182/? E/cutils-trace: Error opening trace file: No such file or directory (2)
01-09 15:03:42.449 22182-22182/? E/memtrack: Couldn't load memtrack module (No such file or directory)
01-09 15:03:42.449 22182-22182/? E/android.os.Debug: failed to load memtrack module: -2
01-09 15:03:52.109 22220-22220/? E/cutils-trace: Error opening trace file: No such file or directory (2)
01-09 15:03:52.269 22220-22220/? E/memtrack: Couldn't load memtrack module (No such file or directory)
01-09 15:03:52.269 22220-22220/? E/android.os.Debug: failed to load memtrack module: -2
01-09 15:03:52.719 22231-22231/com.udte.anhui.launcher E/dalvikvm: Could not find class 'org.micro.freeline.hackload.ClassVerifier', referenced from method com.antfortune.freeline.FreelineConfig.<init>
01-09 15:03:53.289 22246-22246/com.udte.anhui.launcher:freeline E/dalvikvm: Could not find class 'org.micro.freeline.hackload.ClassVerifier', referenced from method com.antfortune.freeline.FreelineConfig.<init>
01-09 15:03:53.659 22246-22246/com.udte.anhui.launcher:freeline E/SQLiteLog: (5) statement aborts at 1: [PRAGMA journal_mode=PERSIST] 
01-09 15:03:54.549 22231-22298/com.udte.anhui.launcher E/RetryHandler.retryRequest(L:91): retry error, curr request is null
01-09 15:03:59.079 22231-22297/com.udte.anhui.launcher E/RetryHandler.retryRequest(L:91): retry error, curr request is null
01-09 15:03:59.589 22231-22299/com.udte.anhui.launcher E/RetryHandler.retryRequest(L:91): retry error, curr request is null
01-09 15:04:18.439 586-22352/com.android.systemui E/ActivityThread: Failed to find provider info for com.android.contacts
01-09 15:04:19.569 484-512/system_process E/InputDispatcher: channel '420f6818 com.udte.anhui.launcher/com.antfortune.freeline.MiddlewareActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
01-09 15:04:19.769 586-747/com.android.systemui E/ActivityThread: Failed to find provider info for com.android.contacts
01-09 15:04:20.059 22354-22354/com.udte.anhui.launcher E/dalvikvm: Could not find class 'org.micro.freeline.hackload.ClassVerifier', referenced from method com.antfortune.freeline.FreelineConfig.<init>
01-09 15:04:20.649 22354-22354/com.udte.anhui.launcher E/SQLiteLog: (5) statement aborts at 1: [PRAGMA journal_mode=PERSIST] 
lomanyong commented 7 years ago

@zengyongchang 参考 #273 先改造一下,或者使用 5.0+ 的设备来测试看看

zengyongchang commented 7 years ago

@lomanyong 按#273 的方式改了不行。 用5.1的模拟器之后,就好了 妈的,搞机顶盒开发,用4.4版本的占大多数。4.4的盒子早该淘汰了!

不过还是希望有人来开发适配5.0以下的功能

lomanyong commented 7 years ago

@zengyongchang 这个问题之前有人遇见类似,第三方库需要 inject 的才能解决。这个可以 freeline 来适配,不过可能会有点不大友好就是了...