- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
当在 Android Studio 中使用 Gradle 编译库时,Proguard 在使用 Lombok 库时遇到问题。我找到了一些配置信息来修复我们使用的另一个注释库 butterknife。
-keepattributes *Annotation*
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepnames class * { @butterknife.InjectView *;}
有谁知道要添加哪些标志来让 Lombok 开心。
混淆配置文件
# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html
# Optimizations: If you don't want to optimize, use the
# proguard-android.txt configuration file instead of this one, which
# turns off the optimization flags. Adding optimization introduces
# certain risks, since for example not all optimizations performed by
# ProGuard works on all versions of Dalvik. The following flags turn
# off various optimizations known to have issues, but the list may not
# be complete or up to date. (The "arithmetic" optimization can be
# used if you are only targeting Android 2.0 or later.) Make sure you
# test thoroughly if you go this route.
#-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*,!code/allocation/variable
-dontobfuscate
#-optimizationpasses 5
-allowaccessmodification
-dontpreverify
# The remainder of this file is identical to the non-optimized version
# of the Proguard configuration file (except that the other file has
# flags to turn off optimization).
#-dontusemixedcaseclassnames
#-dontskipnonpubliclibraryclasses
-verbose
-keepattributes *Annotation*
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepnames class * { @butterknife.InjectView *;}
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>;
}
# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn android.support.**
我看到的一些错误...
Warning:lombok.core.Agent$NetbeansPatcherInfo$1: can't find superclass or interface java.lang.instrument.ClassFileTransformer
Warning:lombok.core.AnnotationProcessor: can't find superclass or interface javax.annotation.processing.AbstractProcessor
Warning:lombok.delombok.DocCommentIntegrator$CommentAttacher_8$1: can't find superclass or interface com.sun.tools.javac.parser.Tokens$Comment
Warning:lombok.delombok.PrettyCommentsPrinter: can't find superclass or interface com.sun.tools.javac.tree.JCTree$Visitor
Warning:lombok.delombok.PrettyCommentsPrinter$1UsedVisitor: can't find superclass or interface com.sun.tools.javac.tree.TreeScanner
Warning:lombok.delombok.ant.DelombokTask: can't find superclass or interface org.apache.tools.ant.Task
Warning:lombok.eclipse.EclipseAstProblemView$LombokProblem: can't find superclass or interface org.eclipse.jdt.internal.compiler.problem.DefaultProblem
Warning:lombok.eclipse.agent.ExtensionMethodCompletionProposal: can't find superclass or interface org.eclipse.jdt.internal.codeassist.InternalCompletionProposal
Warning:lombok.eclipse.handlers.SetGeneratedByVisitor: can't find superclass or interface org.eclipse.jdt.internal.compiler.ASTVisitor
Warning:lombok.installer.InstallerGUI$12: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$13: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$2: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$3: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$4: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$6: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$6$2: can't find superclass or interface javax.swing.filechooser.FileFilter
Warning:lombok.installer.InstallerGUI$7: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$8: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$9: can't find superclass or interface java.awt.event.ActionListener
...
Warning: there were 10560 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 128 instances of library classes depending on program classes.
You must avoid such dependencies, since the program classes will
be processed, while the library classes will remain unchanged.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
Warning: there were 103 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
:just10:proguardGooglePhoneDevDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':just10:proguardGooglePhoneDevDebug'.
> java.io.IOException: Please correct the above warnings first.
最佳答案
我添加了一些标志来抑制对我项目中包含的库的警告,这就成功了。
-dontwarn javax.**
-dontwarn lombok.**
-dontwarn org.apache.**
-dontwarn com.squareup.**
-dontwarn com.sun.**
-dontwarn **retrofit**
关于android - 使用 Lombok 注释库的 Proguard 构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25314202/
我正在尝试扩展 Lombok通过创建我自己的注释。 我设法拥有 LombokizedEclipse.launch由 ant 创建,我写了 before和 after文件。 ant test我的注释失败
我在我的项目中广泛使用了 Lombok。我喜欢它,并希望它能得到官方支持,这样维护者就不必使用内部 API 来继续开发,但这是另一个话题了。 在使用 val 时,我经常会在编译过程中遇到以下问题: (
我发现使用 lombok @toString 和跳过空字段行为的简单方法没有成功。 我认为使用方面编程为所有函数创建我自己的 toString 函数。像那样,我可以检查所有空字段并跳过它。 但这是一种
有没有一种方法可以用lombok定义“PostConstruct”初始化方法? @RequiredArgsConstructor(staticName = "of") class MyObj {
Lombok 是一个很棒的插件,它有一个 Eclipse 和 IntelliJ 的安装程序。 AnyLogic 是基于 Eclipse 的,那么我们如何让它也在那里工作呢? 最佳答案 在 Mac 上,
我在我的项目中使用过Lombok,但是我的同事不同意使用它,他的理由是(来自controversy of lombok documents ) Both of these pieces of Proj
我一直在尝试向 Lombok 添加自定义注释。我的起点是 GitHub 上的源代码分支。 我添加了一个工作正常的注释。我可以使用包含的 eclipse 启动(或构建一个 jar 并将其交换到我的 ec
我用 Intellij 打开了 restbucks 项目。我安装了 lombok 插件,启用了注释处理。我在 Intellij 设置中使用 javac 编译器。我在项目根目录中有 lombok.con
我正在尝试利用 Lombok 的新 copyableAnnotations 功能,以便将 @JsonIgnore 和 @JsonValue 等 Jackson 注释复制到生成的 getter/with
我正在尝试在一个项目中使用 lombok,在这个项目中我有一个抽象基模型类,而其他类是从它派生的。但是我在编译时遇到错误。代码如下所示: 基础实体.java import java.util.Date
升级后,无法从 Intellij IDE 运行应用程序。 Intellij 版本:IntelliJ IDEA 2020.3(社区版) Build #IC-203.5981.155,建于 2020 年
我正在使用具有以下结构的 IntelliJ IDEA 2016.3 + lombok 插件: 编辑:这是模块内容根配置: 在 src/main/java 和 src/test/java 中一切都按预期
我在我的根目录中创建了一个 lombok.config 文件,内容如下: config.stopBubbling = true lombok.addLombokGeneratedAnnotation
我在我的 gradle 项目中使用 lombok 并想要创建一个 jar 文件,但每次执行 jar 任务(无论是否在我的控制台或 eclipse ide 中触发)我都会收到错误,在这些类中找不到我的
我需要为基于 JNI 的 native 库编译 .h 文件。在我的项目中添加一些 lombok 注释后,我无法使用 javac 编译 .h 文件。我正在使用 IntelliJ 和等级。我正在尝试在 i
@Data public abstract class B { private final String str; } @Data public class A extends B{ pr
@Builder public class ProcessorLombokBO { private String panel; private String motherBoard;
最近,我对“lombok”产生了很大的兴趣。我想通过阅读源代码来更多地了解它。 但是尝试之后,我发现这对我来说真的很难。我只发现有“javac”和“ECJ”两个实现。但不明白它是如何端到端工作的。 有
我有一个看起来像这样的类: @EqualsAndHashCode @RequiredArgsConstructor public class StatusUpdate { @Getter
这个问题在这里已经有了答案: Lombok getter/setter vs Java 14 record (6 个回答) 去年关闭。 记录是自 Java 14(第一次预览版)和 Java 15(第二
我是一名优秀的程序员,十分优秀!