【发布时间】:2017-02-13 09:53:41
【问题描述】:
如何使用 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 来抑制此警告?
参考资料:
- 我在这里有一个答案,但这些都没有抑制这个警告:How do I suppress warnings when compiling an android library with gradle?
【问题讨论】:
-
为什么不使用proguard?
-
@cipley 这发生在 assemble 上。
标签: java android gradle android-gradle-plugin javac