我有 Android 库项目。有一些带有切入点的 .aj 文件 (aspectJ)。我需要混淆编译的工件(jar)。当我混淆它并将其作为库添加到另一个项目时,方面停止工作。任何人都可以帮助使用 ProGuard 进行混淆吗?一些配置示例或任何有用的信息。可能根本不可能?有一些替代方案吗?
谢谢。
我有 Android 库项目。有一些带有切入点的 .aj 文件 (aspectJ)。我需要混淆编译的工件(jar)。当我混淆它并将其作为库添加到另一个项目时,方面停止工作。任何人都可以帮助使用 ProGuard 进行混淆吗?一些配置示例或任何有用的信息。可能根本不可能?有一些替代方案吗?
谢谢。
我还有一个带有方面的 android 库。我的切入点不是针对我的库代码,而是针对应用程序的代码(例如,Activity.onCreate 上的切入点),因此使用我的库的人已经期望将他们的 android 项目设置为 AspectJ 项目。
没有 Proguard,一切都可以完美运行,但尽管我能想到的每一个例外,但如果我的库 jar 被混淆,我无法获得应用建议。我验证了方面类以及所有方法和字段都保存在映射中。
这是我的 proguard 配置的最终版本,它没有让方面工作,尽管一切都编译得很好并且没有错误:
...some config, the injar included my iajc compiled library project with aspects
-optimizations !code/allocation/variable,!code/simplification/arithmetic,!field/*,!class/merging/*
-optimizationpasses 3
-dontpreverify
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-verbose
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
# This is the package of my aspects
-keep class my.package.aspectj.** { *; }
# This is all the public methods that my aspect code calls in to
-keep class my.package.allthethingsmyaspectscall.** { *; }
...keep some other classes not related to this
有了这一切,我的方面仍然不适用。
我的解决方案是在安装时将我的方面文件复制到客户端应用程序的项目中,以便它位于他们的应用程序类路径中,并在他们的应用程序构建时被编织。