これで、Android ゲームの開発の最終段階に到達したので、Proguard による難読化を含める時が来ました。
私たちのゲームはグレーストライプ広告を使用しており、デバッグ バージョンをコンパイルして API 7 をターゲットにすると、すべて正常に動作します。
しかし、リリース バージョンをコンパイルすると (プロセスで Proguard が追加されます)、大量の警告が表示されます。
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.DeviceInfo: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.GSFullscreenActivity: can't find referenced class android.hardware.Camera$CameraInfo
Warning: com.greystripe.sdk.GSFullscreenActivity: can't find referenced class android.hardware.Camera$CameraInfo
Warning: com.greystripe.sdk.GSFullscreenActivity: can't find referenced method 'void getCameraInfo(int,android.hardware.Camera$CameraInfo)' in class android.hardware.Camera
Warning: com.greystripe.sdk.GSFullscreenActivity: can't find referenced method 'int getNumberOfCameras()' in class android.hardware.Camera
Warning: com.greystripe.sdk.GSFullscreenActivity: can't find referenced method 'android.hardware.Camera open(int)' in class android.hardware.Camera
Warning: com.greystripe.sdk.GSFullscreenActivity: can't find referenced method 'void setDisplayOrientation(int)' in class android.hardware.Camera
Warning: com.greystripe.sdk.GSFullscreenActivity: can't find referenced class android.hardware.Camera$CameraInfo
Warning: com.greystripe.sdk.GSFullscreenActivity: can't find referenced method 'void setLayerType(int,android.graphics.Paint)' in class com.greystripe.sdk.aa
Warning: com.greystripe.sdk.a: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.a: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.ah: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.aj: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.aj: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.aj: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.as: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.as: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.as: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.as: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.as: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.at: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.at: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.bd: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.be: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.be: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.be: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.be: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.be: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.be: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.bh: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.bh: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.bl: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.bl: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.bl: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.bl: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.bl: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.m: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.m: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.m: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.m: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.m: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.m: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.m: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.m: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.m: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.s: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.s: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.w: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.w: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.w: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.w: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.w: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.w: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.w: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.w: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.w: can't find referenced class android.webkit.JavascriptInterface
Warning: com.greystripe.sdk.w: can't find referenced class android.webkit.JavascriptInterface
Warning: there were 64 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
Warning: there were 5 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the option
'-dontskipnonpubliclibraryclassmembers'.
だから明らかに、私はさまざまなバリエーションの-keep class
and-keep public class
などを試し始めましたが、何の効果もありませんでした. それから私はグーグルをたくさん始めました、そして人々がいくらか同じ問題を抱えているフォーラムの投稿をたくさん見つけました、そして私は人々が答えたすべての提案を試しました. まだ変化なし。
次に、android.jar を調べたところ、android.webkit.JavascriptInterface
API 17 より前に導入されていないことがわかりました。もちろん、それは理にかなっています。私はAPI 7をターゲットにしているので、当然利用できませandroid.webkit.JavascriptInterface
ん。
しかし、広告のためだけに API 17 をターゲットにしたくはありません。また、その必要もないと確信しています。
論理的には、できるはずだと思います-dontwarn
が、これを行うと、ロード時にアプリがクラッシュします。
私はもちろん私が入れたことを確認し-libraryjars /path/to/libs/greystripe-android-sdk-2.3.0.jar
、また/path/to/android.jar
誰もこれについて手がかりを持っていますか? graystripe-sdk jar をそのままにして、アプリを難読化するにはどうすればよいですか?