2016-10-05 10 views
15

Gradleを使用して「警告:匿名の内部クラスのInnerClasses属性を無視する」を抑制する方法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. 

のような何か:私はこの警告を抑制するために追加することができますどのようなcompilerArgs

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

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

参考文献:

+0

なぜプロガードを使用しないのですか? – cipley

+0

@cipleyこれはアセンブル時に発生します。 –

答えて

1

私はしばらくの間libに第三者を使用しようとしたとき、私は同じ問題を持っていました前。そのlibはJava 1.3用にコンパイルされました。私はそのlibのソースを取得してそれを修正し、自分でjarファイルを構築することができました。もちろん、libのソースが利用可能でビルド準備が整っていれば、これはうまく動作します。

+0

私はむしろ 'assertj-core'のコンパイルと再パッケージングを行っていません。私はちょうど "Gradleを"沈黙させたい。 –

+0

私は偶然、別の、同様の質問につまずいた。おそらくこの質問に対する答えは助けになるでしょう:http://stackoverflow.com/a/40173052/5956451 – Thomas

+0

私はユニットテストのために 'assertj-core'を使います。これはアプリケーションにコンパイルされないので、私はそれに対してプロゴアードを実行しません。 –

関連する問題