wequick / Small

A small framework to split app into small parts
http://code.wequick.net/Small
Apache License 2.0
5.05k stars 1.11k forks source link

Service能够正常启动并运行,但是发布灰度包bugly上看到有ClassNotFoundException异常 #528

Open interfans opened 7 years ago

interfans commented 7 years ago

错误报告

你做了什么?

在宿主的的manifest中注册了service,这个service是在app.main中写的,并在其中的主activity中启动,

正常启动app,该service能正常启动并执行相关业务逻辑,但是bugly中会统计到这个bug,

@galenlin 请问有什么好的解决方法吗?

你期望的结果是什么?

不要在出现这个崩溃了。

实际结果是什么?

java.lang.RuntimeException:Unable to instantiate service com.appshare.android.app.main.services.GetMessageService: java.lang.ClassNotFoundException: Didn't find class "com.appshare.android.app.main.services.GetMessageService" on path: DexPathList[[zip file "/mnt/asec/com.appshare.android.ilisten-1/pkg.apk", zip file "/data/data/com.appshare.android.ilisten/code_cache/secondary-dexes/pkg.apk.classes2.zip"],nativeLibraryDirectories=[/mnt/asec/com.appshare.android.ilisten-/lib, /vendor/lib, /system/lib]] android.app.ActivityThread.handleCreateService(ActivityThread.java:2721) ...... Caused by: java.lang.ClassNotFoundException:Didn't find class "com.appshare.android.app.main.services.GetMessageService" on path: DexPathList[[zip file "/mnt/asec/com.appshare.android.ilisten-1/pkg.apk", zip file "/data/data/com.appshare.android.ilisten/code_cache/secondary-dexes/pkg.apk.classes2.zip"],nativeLibraryDirectories=[/mnt/asec/com.appshare.android.ilisten-1/lib, /vendor/lib, /system/lib]] dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53) java.lang.ClassLoader.loadClass(ClassLoader.java:501) java.lang.ClassLoader.loadClass(ClassLoader.java:461) android.app.ActivityThread.handleCreateService(ActivityThread.java:2718) android.app.ActivityThread.access$1600(ActivityThread.java:171) android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475) android.os.Handler.dispatchMessage(Handler.java:107) android.os.Looper.loop(Looper.java:194) android.app.ActivityThread.main(ActivityThread.java:5468) java.lang.reflect.Method.invokeNative(Native Method) java.lang.reflect.Method.invoke(Method.java:525) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:936) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703) dalvik.system.NativeStart.main(Native Method)

Small环境

Compile-time

  gradle-small plugin : 1.2.0-alpha6 (maven)
            small aar : 1.2.0-alpha6 (maven)
          gradle core : 3.3
       android plugin : 2.3.0
                   OS : Mac OS X 10.12.5 (x86_64)

Bundles

type name PP sdk aapt support file size
host app 24 25.0.0
stub app+common 24 25.0.0 25.1.0
app app.main 0x77 24 25.0.0 *.main.apk 80.5 KB
app app.column 0x4a 24 25.0.0 *.column.apk 46.2 KB
app app.mine 0x16 24 25.0.0 *.mine.apk 643.3 KB
app app.pay 0x1b 24 25.0.0 *.pay.apk 299.9 KB
app app.leancloud 0x2e 24 25.0.0 *.leancloud.apk 149.4 KB
app app.square 0x15 24 25.0.0 *.square.apk 1.6 MB
app app.welcome 0x42 24 25.0.0 *.welcome.apk 137.9 KB
app app.web 0x27 24 25.0.0 *.web.apk 320.3 KB
app app.login 0x44 24 25.0.0 *.login.apk 225.4 KB
app app.story 0x48 24 25.0.0 *.story.apk 996.2 KB
lib lib.utils 0x73 24 25.0.0 *.utils.apk 2 MB
lib lib.style 0x79 24 25.0.0 *.style.apk 329.4 KB

Runtime

  Device : VIVO XPLAY6
     SDK : Android 6.0.1
     ABI : arm64-v8a
galenlin commented 7 years ago

能否尝试在 Sample 中复现本问题

interfans commented 7 years ago

这个不好复现,但是我发现在宿主中写的service,同时在宿主的manifest中注册是没有出现这个问题,同时又出现了插件中的一个Activity出现了这种问题,这个activity是我们的广告欢迎页面,是LaunchActivity后的第二个启动页面,是否跟我们的dex分包有关啊,项目分了两个dex文件

SunShine666Q commented 6 years ago

如何解决呢