java - 如何使用 Gradle 抑制 "warning: Ignoring InnerClasses attribute for an anonymous inner class"?

标签 java android gradle android-gradle-plugin javac

如何使用 Gradle 抑制“警告:忽略匿名内部类的 InnerClasses 属性”?

  • 这不是重复的问题
  • 这不是在 Proguard 期间,我也不想禁止使用 Proguard
  • 我想禁止做正常的./gradlew assembleDebug(因为这是assertj-core - ./gradlew testDebug)<

依赖:

dependencies {
   testCompile "org.assertj:assertj-core:1.7.1"
}

警告:

Dex: warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.assertj.core.internal.cglib.reflect.FastClassEmitter$3) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.

类似:

tasks.withType(JavaCompile) {
    sourceCompatibility = JavaVersion.VERSION_1_7
    targetCompatibility = JavaVersion.VERSION_1_7

    configure(options) {
        compilerArgs << "-Xlint:-options"    // Turn off "missing" bootclasspath warning
    }
}

我可以添加什么 compilerArgs 来抑制这个警告?

引用资料:

最佳答案

不久前我尝试使用第三方库时遇到了同样的问题。该库是为 Java 1.3 编译的。我能够通过获取该库的源代码并自己构建一个 jar 文件来修复它。当然,这只有在该库的源代码可用并且可以构建时才有效。

关于java - 如何使用 Gradle 抑制 "warning: Ignoring InnerClasses attribute for an anonymous inner class"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39865728/

相关文章:

java - 如何使用 Jsch 递归地 FTP 目录结构?

java - 使用 Gson 解析没有键的嵌套 JSON 对象

java - 带有自定义适配器的 ListView 不显示所有项目

java - 如何让runtime.exec()在Java中的多操作系统上工作?

android - 如何访问 Android 设备上的可移动存储?

android - 控制 Android 上的用户语言

android - Android应用程式名称作为变量而不是静态字符串

kotlin - 未解析的引用 : protoc - when using Gradle + Protocol Buffers

Gradle 任务失败,但 Travis 构建仍然通过

java - JEdi​​torPane 在显示特定的非动画 GIF 时 CPU 使用率较高