2017-05-23 9 views
4

は私があるため、私のProGuardの-ルールで私のために奇妙に見えるProGuardのは私の警告の多くを与え、

Warning:es.usc.citius.hipster.util.examples.maze.MazeSearch$Result: can't find referenced class java.awt.Point

のような警告の多くを得るエラー

Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebug'. Job failed, see logs for details

を取得しています失敗します私は

-keep public class es.usc.citius.hipster.** { *; } 

[EDITED] 私も取得しています警告

のように、このルールを追加しました

Warning:com.mypackage.android.dagger.modules.AppModule_ProvideAccelerometerSensorFactory: can't find superclass or interface dagger.internal.Factory

私は短剣ルールに警告を無視しておよそ答えた後

-keep public class com.mypackage.android.** { *; } 

私のパッケージを維持するための

-dontwarn dagger.internal.codegen.** 
-keepclassmembers,allowobfuscation class * { 
    @javax.inject.* *; 
    @dagger.* *; 
    <init>(); 
} 

-keep class dagger.* { *; } 
-keep class javax.inject.* { *; } 
-keep class * extends dagger.internal.Binding 
-keep class * extends dagger.internal.ModuleAdapter 
-keep class * extends dagger.internal.StaticInjection 

とルールを追加し、私は

-dontwarn com.mypackage.android.** 

そして、ProGuardのこのルールを追加しました今は失敗しません。しかし、そのベストプラクティスと、これらの警告を無視した後に何が壊れるのか分かりません。

+0

可能性のある重複した[ProGuardの地獄 - 参照されるクラスを見つけることができません](https://stackoverflow.com/questions/6974231/proguard-hell- cant-find-referenced-class) – user1643723

答えて

2

ライブラリクラスは、このパッケージを含まないJDKではなく、Android JDKの一部であるパッケージjava.awt.Pointを参照しています。 Android環境では使用できません。

+0

ありがとう!私は編集した、私の質問。私の疑問の答えと明確化のために感謝します。 – qbait

2

更新

And proguard doesn't fail now. However, I'm not sure if that the best practice and what can be broken after ignoring these warnings?

アンドロイド(例えばandroid.graphics)独自のグラフィックライブラリを持って、Java AWTクラスの代わりに使用します。ここで

java.awt.Toolkitからかなり便利コメントです:

WARNING: This is a temporary workaround for a problem in the way the AWT loads native libraries. A number of classes in the AWT package have a native method, initIDs(), which initializes the JNI field and method ids used in the native portion of their implementation. Since the use and storage of these ids is done by the implementation libraries, the implementation of these method is provided by the particular AWT implementations (for example, "Toolkit"s/Peer), such as Motif, Microsoft Windows, or Tiny. The problem is that this means that the native libraries must be loaded by the java.* classes, which do not necessarily know the names of the libraries to load. A better way of doing this would be to provide a separate library which defines java.awt.* initIDs, and exports the relevant symbols out to the implementation libraries. For now, we know it's done by the implementation, and we assume that the name of the library is "awt". -br. If you change loadLibraries(), please add the change to java.awt.image.ColorModel.loadLibraries(). Unfortunately, classes can be loaded in java.awt.image that depend on libawt and there is no way to call Toolkit.loadLibraries() directly. -hung

オリジナル

class java.awt.Point

java.awt.*クラスは、Androidランタイムの一部ではありません。最も良い解決策は、それらを参照するクラスを削除することです。ただ警告を抑制されるだろう

最も簡単なソリューション:

-dontwarn java.awt.** 
+0

ありがとうございます!私は編集した、私の質問。私の疑問の答えと明確化のために感謝します。 – qbait

関連する問題