2016-10-05 7 views
15

Jak ukryć "Ostrzeżenie: Ignorowanie atrybutu InnerClasses dla anonimowej klasy wewnętrznej" z Gradle?Jak ukryć "Ostrzeżenie: Ignorowanie atrybutu InnerClasses dla anonimowej klasy wewnętrznej" z Gradle?

  • to nie duplikat pytanie
  • To nie podczas PROGUARD ani nie chcę, aby stłumić stosując PROGUARD
  • chciałbym tłumić robi normalne ./gradlew assembleDebug (ponieważ jest to assertj-core - ./gradlew testDebug)

Zależność:

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

Ostrzeżenie:

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. 

Coś jak:

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

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

Co compilerArgs mogę dodać do tłumienia to ostrzeżenie?

Referencje:

+0

Dlaczego nie używać proguard? – cipley

+0

@cipley Dzieje się to podczas montażu. –

Odpowiedz

1

Miałem ten sam problem, gdy próbowałem korzystać osoby trzeciej lib chwilę temu. Ta biblioteka została skompilowana dla Java 1.3. Udało mi się to naprawić, pobierając źródło tej biblioteki i samodzielnie skompilowałem plik jar. Działa to oczywiście tylko wtedy, gdy źródła tej biblioteki są dostępne i gotowe do kompilacji.

+0

W porządku. Raczej nie kompiluję i nie przepakowuję 'assertj-core'. Chcę tylko "uciszyć" Gradle. –

+0

Przypadkiem natknąłem się na inne, podobne pytanie. Może ta odpowiedź na to pytanie jest pomocna: http://stackoverflow.com/a/40173052/5956451 – Thomas

+0

Używam 'assertj-core' do testów jednostkowych. To nie zostanie wkompilowane w aplikację, więc nie uruchomię progu. –

Powiązane problemy