JingYeoh / FragmentRigger

:boom:A powerful library powered by AOP to manage Fragments.(一个基于AOP设计的Fragment管理框架)
MIT License
2.26k stars 266 forks source link

无法编译通过 Error:Execution failed for task ':app:transformClassesWithAspectTransformForDebugTest'. > ABORT #11

Open xiayouli0122 opened 6 years ago

xiayouli0122 commented 6 years ago

Error:Execution failed for task ':app:transformClassesWithAspectTransformForDebugTest'. > ABORT

似乎跟环信SDK冲突? ABORT org.aspectj.weaver.BCException: Whilst processing type 'Lcom/hyphenate/chat/EMCallManager$EMCallType;' - cannot cast the outer type to a reference type. Signature=Lcom/hyphenate/chat/EMCallManager; toString()=com.hyphenate.chat.EMCallManager class=EMCallManager when processing type mungers when weaving when batch building BuildConfig[null] #Files=0 AopXmls=#0

at org.aspectj.weaver.AbstractReferenceTypeDelegate.getFormalTypeParametersFromOuterClass(AbstractReferenceTypeDelegate.java:113)
at org.aspectj.weaver.bcel.BcelObjectType.ensureGenericSignatureUnpacked(BcelObjectType.java:775)
at org.aspectj.weaver.bcel.BcelObjectType.getSuperclass(BcelObjectType.java:231)
at org.aspectj.weaver.ReferenceType.getSuperclass(ReferenceType.java:987)
at org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(BcelWeaver.java:1304)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1123)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.weaveQueuedEntries(AjPipeliningCompilerAdapter.java:514)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.afterCompiling(AjPipeliningCompilerAdapter.java:375)
at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$2$f9cc9ca0(CompilerAdapter.aj:78)
at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:471)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:1036)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:272)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:185)
at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
JingYeoh commented 6 years ago

@xiayouli0122 这是AsPectJ的问题,我在使用的这个插件上看到类似Issure,你可以试试是否可以解决你的问题。

xiayouli0122 commented 6 years ago

加上 aspectjx { excludeJarFilter '.jar' } 然后关掉Instant Run后,可以编译通过

但是 运行报错 我BaseActivity并不需要使用Rigger,也没在BaseActivity 或者LauncerActivity添加Rigger相关代码 不知道为什么报错在这里

java.lang.NoSuchMethodError: No static method aspectOf()Lcom/jkb/fragment/rigger/aop/AspectPuppetActivity; in class Lcom/jkb/fragment/rigger/aop/AspectPuppetActivity; or its super classes (declaration of 'com.jkb.fragment.rigger.aop.AspectPuppetActivity' appears in /data/app/com.hax.dlm-1/base.apk:classes27.dex) at com.hax.dlm.views.activitys.BaseActivity.(BaseActivity.java:16) at com.hax.dlm.views.activitys.LauncherActivity.(LauncherActivity.java:54) at java.lang.Class.newInstance(Native Method) at android.app.Instrumentation.newActivity(Instrumentation.java:1083) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2682) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:156) at android.app.ActivityThread.main(ActivityThread.java:6523) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)

JingYeoh commented 6 years ago

@xiayouli0122 这还是属于AsPectJ插件的问题。。目前是使用第三方的AspectJ插件,比较难排查错误,后面我会找时间自己写一个,这里有相似的错误Issure,请参考是否可以解决你的问题。

xiayouli0122 commented 6 years ago

没有找到解决办法 aspectjx { excludeJarFilter '.jar' } 我只添加了这个,删除了会编译不过

后面再看看有什么其他解决办法

ViewMikeZhou commented 6 years ago

关于Fragment覆盖问题! 当一个MainFragment 里面添加2个子Fragment1, fragment2通过 show 来切换显示它们在fragment2 中start fragment3 , fragment3中调用了系统设置界面(MainActivity 会走onActivityResult方法),从fragment3中退出后,应该显示fragment2 ,但是出现fragment1 覆盖在fragment2上这种情况! 并不是每次都会出现以上情况! 谢谢!

JingYeoh commented 6 years ago

@ViewMikeZhou Fragment的hide/show状态是自管理的,不会发生重叠的哦,请确认是否发生内存重启等状态,如果有疑问请提交新的issure;)

vecharm commented 6 years ago

说实话AspectJ是个坑,我以前用了,发现很多库冲突,特别是gradle插件,分分钟给你编译不通过,简直是噩梦,建议去掉这个框架

LinXueyuanStdio commented 5 years ago

@VipMinF 这个库就是要用 aspectj 实现无侵入拓展的,去掉不是等价于失去灵魂了吗

JingYeoh commented 5 years ago

@LinXueyuanStdio aspectj 只是实现 AOP 的一种方式,之后会尝试不依赖 aspectj 实现 AOP