Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SensorsAnalytics]: 类执行 modifyClass 方法出现异常 #124

Open
xyz-fly opened this issue Apr 28, 2023 · 2 comments
Open

[SensorsAnalytics]: 类执行 modifyClass 方法出现异常 #124

xyz-fly opened this issue Apr 28, 2023 · 2 comments

Comments

@xyz-fly
Copy link

xyz-fly commented Apr 28, 2023

环境:
androidgardle 7.4.2
gradle:7.6
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions{
jvmTarget = JavaVersion.VERSION_17.toString()
}

集成时,报错如下:

[SensorsAnalytics]: 类执行 modifyClass 方法出现异常
java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
at org.objectweb.asm.ClassVisitor.visitPermittedSubclass(ClassVisitor.java:266)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:706)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:424)
at org.objectweb.asm.ClassReader$accept$0.call(Unknown Source)
at com.sensorsdata.analytics.android.plugin.SensorsAnalyticsTransform.modifyClass(SensorsAnalyticsTransform.groovy:437)
at jdk.internal.reflect.GeneratedMethodAccessor2980.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:193)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:61)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:194)
at com.sensorsdata.analytics.android.plugin.SensorsAnalyticsTransform.modifyClassFile(SensorsAnalyticsTransform.groovy:460)
at jdk.internal.reflect.GeneratedMethodAccessor3001.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:193)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:61)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:203)
at com.sensorsdata.analytics.android.plugin.SensorsAnalyticsTransform.forEachDir(SensorsAnalyticsTransform.groovy:279)
at jdk.internal.reflect.GeneratedMethodAccessor3000.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:362)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:61)
at com.sensorsdata.analytics.android.plugin.SensorsAnalyticsTransform$_forEachDirectory_closure3.doCall(SensorsAnalyticsTransform.groovy:273)
at jdk.internal.reflect.GeneratedMethodAccessor2999.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
at groovy.lang.Closure.call(Closure.java:412)
at groovy.lang.Closure.call(Closure.java:428)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.traverse(ResourceGroovyMethods.java:1499)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.traverse(ResourceGroovyMethods.java:1487)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.traverse(ResourceGroovyMethods.java:1487)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.traverse(ResourceGroovyMethods.java:1487)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.traverse(ResourceGroovyMethods.java:1487)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.traverse(ResourceGroovyMethods.java:1487)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.traverse(ResourceGroovyMethods.java:1360)
at org.codehaus.groovy.runtime.dgm$1124.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:247)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:148)
at com.sensorsdata.analytics.android.plugin.SensorsAnalyticsTransform.forEachDirectory(SensorsAnalyticsTransform.groovy:271)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1268)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:94)
at com.sensorsdata.analytics.android.plugin.SensorsAnalyticsTransform.this$dist$invoke$2(SensorsAnalyticsTransform.groovy)
at com.sensorsdata.analytics.android.plugin.SensorsAnalyticsTransform$2.methodMissing(SensorsAnalyticsTransform.groovy)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:953)
at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1347)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1270)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:61)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:212)
at com.sensorsdata.analytics.android.plugin.SensorsAnalyticsTransform$2.call(SensorsAnalyticsTransform.groovy:130)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1428)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

@liuweiqiang2016
Copy link
Collaborator

请升级插件到 v4.0.0-beta,检查是否还有该问题

@GvcZhang
Copy link

该问题是低版本的 ASM 不支持 Java17 的一些语法特性导致的,可以配置成 ASM9。
配置方式如下:
在 gradle.properties 文件中添加如下代码:
sensorsAnalytics.asmVersion=ASM9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants