sy007 / DebouncePlugin

Android点击事件防抖动插件
Apache License 2.0
113 stars 16 forks source link

集成最新2.0.1插件,运行崩溃,找不到谷歌FirebaseInitProvider #13

Closed luoyiee closed 1 year ago

luoyiee commented 1 year ago

version:2.0.1 com.android.tools.build:gradle:7.3.1 kotlin:1.7.20 gradle:7.4 compileSdkVersion 33

debounce {
    proxyClassName = "com.example.mall.ClickMethodProxy"
    generateReport = true
    excludes = [

"androidx//*", "android/*/", "com/google/android//*", "*/_ViewBinding*.class"] }

现象:运行后闪退,找不到com.google.firebase.provider.FirebaseInitProvider【设置debounceEnable=false则正常运行】

报错信息: java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/XkrZDXP0CmTz7-niYR_Idg==/com.xueke.mall-Ww7FFuVcbWhnB5KKSiENmw==/base.apk"],nativeLibraryDirectories=[/data/app/XkrZDXP0CmTz7-niYR_Idg==/com.xueke.mall-Ww7FFuVcbWhnB5KKSiENmw==/lib/arm64, /system/lib64, /system/system_ext/lib64]] at android.app.ActivityThread.installProvider(ActivityThread.java:7633) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7106) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6977) at android.app.ActivityThread.access$1500(ActivityThread.java:258) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1983) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:236) at android.app.ActivityThread.main(ActivityThread.java:8060) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/XkrZDXP0CmTz7-niYR_Idg==/com.xueke.mall-Ww7FFuVcbWhnB5KKSiENmw==/base.apk"],nativeLibraryDirectories=[/data/app/XkrZDXP0CmTz7-niYR_Idg==/com.xueke.mall-Ww7FFuVcbWhnB5KKSiENmw==/lib/arm64, /system/lib64, /system/system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147) at androidx.core.app.CoreComponentFactory.instantiateProvider(CoreComponentFactory.java:67) at android.app.ActivityThread.installProvider(ActivityThread.java:7617) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7106)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6977)  at android.app.ActivityThread.access$1500(ActivityThread.java:258)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1983)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:236)  at android.app.ActivityThread.main(ActivityThread.java:8060)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) 

sy007 commented 1 year ago

@luoyiee ,这个问题像是AS缓存编译导致的。

1.你可以clean,确保app/build文件删除后重新运行试试 2.如果还不行可以尝试: 删除.gradle、.idea和.build文件,然后执行:Android studio > File > Invalidate Caches / Restart 3.最后还是无法解决请提供你的项目中依赖的firebase(app/build.gradle以及classpath中的依赖)

luoyiee commented 1 year ago

我测试了发现不是firebase的原因,当然按照1/2步骤也没有奏效,只定位到了是我一个本地引入的Module引起的,具体原因我这里还要再测试!但是报错时候都会打印下面这个:

1.Unable to open libbeluga.so: dlopen failed: library "libbeluga.so" not found. 2.Zip open failed: Failure to verify dex file '/data/app/~~Xl9O8XrGgexeUA0xOZZAIQ==/com.xueke.mall-W8i05lzf9ilsLL6-TUEr_Q==/base.apk!classes11.dex': Interface field is not public final static, Lcom/lib_dialog/common/action/ClickAction;.$$clickProxy: 2(private )

其中ClickAction是那个Module的一个Interface !代码如下:

public interface ClickAction extends View.OnClickListener {

<V extends View> V findViewById(@IdRes int id);

default void setOnClickListener(@IdRes int... ids) {
    setOnClickListener(this, ids);
}

default void setOnClickListener(View.OnClickListener listener, @IdRes int... ids) {
    for (int id : ids) {
        findViewById(id).setOnClickListener(listener);
    }
}

default void setOnClickListener(View... views) {
   setOnClickListener(this, views);
}

default void setOnClickListener(View.OnClickListener listener, View... views) {
    for (View view : views) {
        view.setOnClickListener(listener);
    }
}

@Override
default void onClick(View view) {
    // 默认不实现,让子类实现
}

}

sy007 commented 1 year ago

我测试了发现不是firebase的原因,当然按照1/2步骤也没有奏效,只定位到了是我一个本地引入的Module引起的,具体原因我这里还要再测试!但是报错时候都会打印下面这个:

1.Unable to open libbeluga.so: dlopen failed: library "libbeluga.so" not found. 2.Zip open failed: Failure to verify dex file '/data/app/~~Xl9O8XrGgexeUA0xOZZAIQ==/com.xueke.mall-W8i05lzf9ilsLL6-TUEr_Q==/base.apk!classes11.dex': Interface field is not public final static, Lcom/lib_dialog/common/action/ClickAction;.$$clickProxy: 2(private )

其中ClickAction是那个Module的一个Interface !代码如下:

public interface ClickAction extends View.OnClickListener {

<V extends View> V findViewById(@IdRes int id);

default void setOnClickListener(@IdRes int... ids) {
    setOnClickListener(this, ids);
}

default void setOnClickListener(View.OnClickListener listener, @IdRes int... ids) {
    for (int id : ids) {
        findViewById(id).setOnClickListener(listener);
    }
}

default void setOnClickListener(View... views) {
   setOnClickListener(this, views);
}

default void setOnClickListener(View.OnClickListener listener, View... views) {
    for (View view : views) {
        view.setOnClickListener(listener);
    }
}

@Override
default void onClick(View view) {
    // 默认不实现,让子类实现
}

}

谢谢,请问“但是报错时都会打印这些”,这个报错指的是运行时报错还是编译时报错。

luoyiee commented 1 year ago

编译不会报错,运行到安装成功时报错,我记得app还可以安装成功,这两个日志输出下面紧跟就是那个红色的报错日志!

sy007 commented 1 year ago

那个

好的,我看下

sy007 commented 1 year ago

$$clickProxy

方便的话加个Q:632702731,了解下详细情况。

sy007 commented 1 year ago

@luoyiee 你好,可以试试2.0.2版本。

classpath 'io.github.sy007:debounce-plugin:2.0.2'
implementation 'io.github.sy007:debounce-lib:2.0.2'
luoyiee commented 1 year ago

换了clean之后,运行没问题了