sy007 / DebouncePlugin

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

gradle 7.2.2 AGP7.3.3 无法正常运行 #6

Closed lianyagang closed 2 years ago

lianyagang commented 2 years ago

Caused by: java.lang.ClassCastException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at com.sunyuan.click.debounce.utils.TransformKt.transform(Transform.kt:41) at com.sunyuan.click.debounce.DebounceTransform.transformDirInput(DebounceTransform.kt:132) at com.sunyuan.click.debounce.DebounceTransform.access$transformDirInput(DebounceTransform.kt:26) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:73) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:72) at com.sunyuan.click.debounce.utils.Worker.submit$lambda-1(Worker.kt:32) Caused by: java.lang.ClassCastException

sy007 commented 2 years ago

@lianyagang 请问项目用的kotlin plugin是多少,用JDK哪个版本编译的。 使用插件1.0.2版本报错吗?

lianyagang commented 2 years ago

@lianyagang 请问项目用的kotlin plugin是多少,用JDK哪个版本编译的。 使用插件1.0.2版本报错吗?

jdk11。 kotlin plugin 1.7.10 你的插件版本不是1.1.0吗?1.0.2是啥?

sy007 commented 2 years ago

@lianyagang 好的,想让你这边试下1.0.2版本的插件,看报错嘛?用于问题定位哈。

lianyagang commented 2 years ago

@lianyagang 好的,想让你这边试下1.0.2版本的插件,看报错嘛?用于问题定位哈。

class java.lang.String cannot be cast to class org.objectweb.asm.Type (java.lang.String is in module java.base of loader 'bootstrap'; org.objectweb.asm.Type is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @68b6003e) class java.lang.String cannot be cast to class org.objectweb.asm.Type (java.lang.String is in module java.base of loader 'bootstrap'; org.objectweb.asm.Type is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @68b6003e)

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network) The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart) Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Execution optimizations have been disabled for task ':app:transformClassesWithDebounceTransformForDevDebug' to ensure correctness due to the following reasons:

lianyagang commented 2 years ago

@lianyagang 好的,想让你这边试下1.0.2版本的插件,看报错嘛?用于问题定位哈。

class java.lang.String cannot be cast to class org.objectweb.asm.Type (java.lang.String is in module java.base of loader 'bootstrap'; org.objectweb.asm.Type is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @68b6003e) class java.lang.String cannot be cast to class org.objectweb.asm.Type (java.lang.String is in module java.base of loader 'bootstrap'; org.objectweb.asm.Type is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @68b6003e)

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network) The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart) Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Execution optimizations have been disabled for task ':app:transformClassesWithDebounceTransformForDevDebug' to ensure correctness due to the following reasons:

这个是1.0.2提示的错误

sy007 commented 2 years ago

@lianyagang 我看Demo中用的AGP是7.2.2,gradle是7.3.3,kotlin-plugin:1.7.10,防抖插件版本是1.1.0。你那边用demo时会出现错误吗?

sy007 commented 2 years ago

Caused by: java.lang.ClassCastException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at com.sunyuan.click.debounce.utils.TransformKt.transform(Transform.kt:41) at com.sunyuan.click.debounce.DebounceTransform.transformDirInput(DebounceTransform.kt:132) at com.sunyuan.click.debounce.DebounceTransform.access$transformDirInput(DebounceTransform.kt:26) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:73) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:72) at com.sunyuan.click.debounce.utils.Worker.submit$lambda-1(Worker.kt:32) Caused by: java.lang.ClassCastException

@lianyagang 你好,这个问题已修复,请升级1.1.1版本试试。

lianyagang commented 2 years ago

Caused by: java.lang.ClassCastException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at com.sunyuan.click.debounce.utils.TransformKt.transform(Transform.kt:41) at com.sunyuan.click.debounce.DebounceTransform.transformDirInput(DebounceTransform.kt:132) at com.sunyuan.click.debounce.DebounceTransform.access$transformDirInput(DebounceTransform.kt:26) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:73) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:72) at com.sunyuan.click.debounce.utils.Worker.submit$lambda-1(Worker.kt:32) Caused by: java.lang.ClassCastException

@lianyagang 你好,这个问题已修复,请升级1.1.1版本试试。

兄弟。你角标越界也判断下咯?这改的有点仓促啊。你怎么确定他长度一定是2?

sy007 commented 2 years ago

Caused by: java.lang.ClassCastException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at com.sunyuan.click.debounce.utils.TransformKt.transform(Transform.kt:41) at com.sunyuan.click.debounce.DebounceTransform.transformDirInput(DebounceTransform.kt:132) at com.sunyuan.click.debounce.DebounceTransform.access$transformDirInput(DebounceTransform.kt:26) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:73) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:72) at com.sunyuan.click.debounce.utils.Worker.submit$lambda-1(Worker.kt:32) Caused by: java.lang.ClassCastException

@lianyagang 你好,这个问题已修复,请升级1.1.1版本试试。

兄弟。你角标越界也判断下咯?这改的有点仓促啊。你怎么确定他长度一定是2?

因为是jvm dynamic指令调用,一定是2奥。

lianyagang commented 2 years ago

Caused by: java.lang.ClassCastException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at com.sunyuan.click.debounce.utils.TransformKt.transform(Transform.kt:41) at com.sunyuan.click.debounce.DebounceTransform.transformDirInput(DebounceTransform.kt:132) at com.sunyuan.click.debounce.DebounceTransform.access$transformDirInput(DebounceTransform.kt:26) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:73) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:72) at com.sunyuan.click.debounce.utils.Worker.submit$lambda-1(Worker.kt:32) Caused by: java.lang.ClassCastException

@lianyagang 你好,这个问题已修复,请升级1.1.1版本试试。

兄弟。你角标越界也判断下咯?这改的有点仓促啊。你怎么确定他长度一定是2?

因为是jvm dynamic指令调用,一定是2奥。

可是我角标越界了。jdk11

lianyagang commented 2 years ago

Caused by: java.lang.ClassCastException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at com.sunyuan.click.debounce.utils.TransformKt.transform(Transform.kt:41) at com.sunyuan.click.debounce.DebounceTransform.transformDirInput(DebounceTransform.kt:132) at com.sunyuan.click.debounce.DebounceTransform.access$transformDirInput(DebounceTransform.kt:26) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:73) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:72) at com.sunyuan.click.debounce.utils.Worker.submit$lambda-1(Worker.kt:32) Caused by: java.lang.ClassCastException

@lianyagang 你好,这个问题已修复,请升级1.1.1版本试试。

兄弟。你角标越界也判断下咯?这改的有点仓促啊。你怎么确定他长度一定是2?

因为是jvm dynamic指令调用,一定是2奥。

可是我角标越界了。jdk11

长度只有1.你在调用bsmArgs[1]的时候,控制台提示角标越界了

sy007 commented 2 years ago

Caused by: java.lang.ClassCastException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at com.sunyuan.click.debounce.utils.TransformKt.transform(Transform.kt:41) at com.sunyuan.click.debounce.DebounceTransform.transformDirInput(DebounceTransform.kt:132) at com.sunyuan.click.debounce.DebounceTransform.access$transformDirInput(DebounceTransform.kt:26) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:73) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:72) at com.sunyuan.click.debounce.utils.Worker.submit$lambda-1(Worker.kt:32) Caused by: java.lang.ClassCastException

@lianyagang 你好,这个问题已修复,请升级1.1.1版本试试。

兄弟。你角标越界也判断下咯?这改的有点仓促啊。你怎么确定他长度一定是2?

因为是jvm dynamic指令调用,一定是2奥。

可是我角标越界了。jdk11

能debug下嘛,看下是哪个场景出现的问题。

在app/build.gradle下依赖下插件源码,debug下assembleRelease task

lianyagang commented 2 years ago

Execution failed for task ':app:transformClassesWithDebounceTransformForDevDebug'.

java.lang.ArrayIndexOutOfBoundsException

sy007 commented 2 years ago
  1. image
  2. image
  3. image
  4. image
  5. image

@lianyagang 帮忙Debug定位下,谢谢。

sy007 commented 2 years ago

Caused by: java.lang.ClassCastException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at com.sunyuan.click.debounce.utils.TransformKt.transform(Transform.kt:41) at com.sunyuan.click.debounce.DebounceTransform.transformDirInput(DebounceTransform.kt:132) at com.sunyuan.click.debounce.DebounceTransform.access$transformDirInput(DebounceTransform.kt:26) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:73) at com.sunyuan.click.debounce.DebounceTransform$transform$1$2$1.invoke(DebounceTransform.kt:72) at com.sunyuan.click.debounce.utils.Worker.submit$lambda-1(Worker.kt:32) Caused by: java.lang.ClassCastException

@lianyagang 你好,这个问题已修复,请升级1.1.1版本试试。

兄弟。你角标越界也判断下咯?这改的有点仓促啊。你怎么确定他长度一定是2?

因为是jvm dynamic指令调用,一定是2奥。

可是我角标越界了。jdk11

能debug下嘛,看下是哪个场景出现的问题。

在app/build.gradle下依赖下插件源码,debug下assembleRelease task

@lianyagang 你好,问题已经解决

我这边往暂存库里推了一个版本(1.1.3),你那边验证没问题就发布哈。

buildscript {
    ...
    repositories {
        //暂存库maven地址
        maven { url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2" }
    }
    dependencies {
        classpath 'io.github.sy007:debounce-plugin:1.1.3'
    }
}
lianyagang commented 2 years ago

Could not GET 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/io/github/sy007/debounce-plugin/1.1.3/debounce-plugin-1.1.3.pom'. Received status code 401 from server: Unauthorized 是不是没有权限?

lianyagang commented 2 years ago
  1. image
  2. image
  3. image
  4. image
  5. image

@lianyagang 帮忙Debug定位下,谢谢。

根据截图的debug方式。无法正常运行。会提示Disconnected from the target VM, address: '127.0.0.1:57429', transport: 'socket'

sy007 commented 2 years ago

Could not GET 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/io/github/sy007/debounce-plugin/1.1.3/debounce-plugin-1.1.3.pom'. Received status code 401 from server: Unauthorized 是不是没有权限?

换成这个maven地址: maven { url "https://s01.oss.sonatype.org/content/groups/staging/" }

lianyagang commented 2 years ago

io.github.sy007:debounce-plugin:1.1.3

牛逼。竟然可以了。所以改了啥

lianyagang commented 2 years ago

Could not GET 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/io/github/sy007/debounce-plugin/1.1.3/debounce-plugin-1.1.3.pom'. Received status code 401 from server: Unauthorized 是不是没有权限?

换成这个maven地址: maven { url "https://s01.oss.sonatype.org/content/groups/staging/" }

出个ASM系列教程吧。我学习一波

sy007 commented 2 years ago

Could not GET 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/io/github/sy007/debounce-plugin/1.1.3/debounce-plugin-1.1.3.pom'. Received status code 401 from server: Unauthorized 是不是没有权限?

换成这个maven地址: maven { url "https://s01.oss.sonatype.org/content/groups/staging/" }

出个ASM系列教程吧。我学习一波

老哥,这个版本可以了吗?害,教程网上都有的。

我觉得是分三部分学习:

  1. gradle transform
  2. jvm字节码(看懂就行)
  3. ASM api

相信以老哥的能力信手拈来。

lianyagang commented 2 years ago

Could not GET 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/io/github/sy007/debounce-plugin/1.1.3/debounce-plugin-1.1.3.pom'. Received status code 401 from server: Unauthorized 是不是没有权限?

换成这个maven地址: maven { url "https://s01.oss.sonatype.org/content/groups/staging/" }

出个ASM系列教程吧。我学习一波

老哥,这个版本可以了吗?害,教程网上都有的。

我觉得是分三部分学习:

  1. gradle transform
  2. jvm字节码(看懂就行)
  3. ASM api

相信以老哥的能力信手拈来。

1.1.3.正常运行了

sy007 commented 2 years ago

Could not GET 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/io/github/sy007/debounce-plugin/1.1.3/debounce-plugin-1.1.3.pom'. Received status code 401 from server: Unauthorized 是不是没有权限?

换成这个maven地址: maven { url "https://s01.oss.sonatype.org/content/groups/staging/" }

出个ASM系列教程吧。我学习一波

老哥,这个版本可以了吗?害,教程网上都有的。

我觉得是分三部分学习:

  1. gradle transform
  2. jvm字节码(看懂就行)
  3. ASM api

相信以老哥的能力信手拈来。

1.1.3.正常运行了

👍

sy007 commented 2 years ago

Could not GET 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/io/github/sy007/debounce-plugin/1.1.3/debounce-plugin-1.1.3.pom'. Received status code 401 from server: Unauthorized 是不是没有权限?

换成这个maven地址: maven { url "https://s01.oss.sonatype.org/content/groups/staging/" }

出个ASM系列教程吧。我学习一波

老哥,这个版本可以了吗?害,教程网上都有的。

我觉得是分三部分学习:

  1. gradle transform
  2. jvm字节码(看懂就行)
  3. ASM api

相信以老哥的能力信手拈来。

1.1.3.正常运行了

👍

明天推代码

lianyagang commented 2 years ago

推代码拉~~兄弟

sy007 commented 2 years ago

推代码拉~~兄弟

代码已推送,1.1.3版本也正式发布了