4

次のプロジェクト設定があります: 2 つのライブラリ 'commoncomponents' と 'libs' の両方に、webview とダイアログ ヘルパー クラスなどでいくつかのアクティビティが定義されています。次に、アプリ「無料」とアプリ「フル」によって参照されるアプリコードを含む「アプリケーションライブラリ」があります。

次の追加エントリでプロガードを有効にしました

-keepclassmembers class **.R$* {
    public static <fields>;
}

ただし、リリース ターゲットを指定して ant を起動するとビルド プロセスが失敗し、proguard は R$string クラスが見つからないと文句を言います。

「commoncomponents」、「libs」、または「application library」プロジェクトで「ant release」を呼び出すと、proguard は成功しますが、「app free」または「app full」で起動すると、次のエラー メッセージが表示されます。

         [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: ~/Workspace/Workspaces/workspace-indigo/MyApp/bin/classes
     [echo] ----------
     [echo] Resolving Dependencies for bin...
[dependency] Library dependencies:
[dependency] ------------------
[dependency] Ordered libraries:
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.
-pre-build:
-code-gen:
[mergemanifest] No changes in the AndroidManifest files.
     [echo] Handling aidl files...
     [aidl] Found 2 AIDL files.
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] No changed resources. R.java and Manifest.java untouched.
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Build type changed: Generating new BuildConfig class.
-pre-compile:
-compile:
    [javac] Compiling 12 source files to ~/Workspace/Workspaces/workspace-indigo/MyApp/bin/classes
     [echo] Creating library output jar file...
      [jar] Building jar: ~/Workspace/Workspaces/workspace-indigo/MyApp/bin/classes.jar
-post-compile:
-obfuscate:
   [delete] Deleting: ~/Workspace/Workspaces/workspace-indigo/MyApp/bin/proguard/original.jar
      [jar] Building jar: ~/Workspace/Workspaces/workspace-indigo/MyApp/bin/proguard/original.jar
 [proguard] ProGuard, version 4.7
 [proguard] Reading input...
 [proguard] Reading program jar [~/Workspace/Workspaces/workspace-indigo/MyApp/bin/proguard/original.jar]
 [proguard] Reading program jar [~/Workspace/Workspaces/workspace-indigo/CommonComponents/bin/classes.jar]
 [proguard] Reading program jar [~/Workspace/Workspaces/workspace-indigo/exampleLib/bin/classes.jar]
 [proguard] Reading program jar [~/Workspace/Workspaces/workspace-indigo/Bfw/bin/classes.jar]
 [proguard] Reading program jar [/Developer/Java/android-sdk-macosx/tools/support/annotations.jar]
 [proguard] Reading program jar [~/Workspace/Workspaces/workspace-indigo/MyApp/libs/android-support-v4.jar]
 [proguard] Reading library jar [/Developer/Java/android-sdk-macosx/platforms/android-10/android.jar]
 [proguard] Reading library jar [/Developer/Java/android-sdk-macosx/add-ons/addon-real3d-lge-10/libs/real3d.jar]
 [proguard] Initializing...
 [proguard] Warning: com.example.ApplicationBase: can't find referenced class com.example.lib.R$string
 [proguard] Warning: com.example.ApplicationBase: can't find referenced class com.example.lib.R$string
 [proguard] Warning: com.example.ApplicationBase: can't find referenced class com.example.lib.R$string
 [proguard] Warning: com.example.ApplicationBase: can't find referenced class com.example.lib.R$string
 [proguard] Warning: com.example.ApplicationBase: can't find referenced class com.example.lib.R$string
 [proguard] Warning: com.example.ApplicationBase: can't find referenced class com.example.lib.R$string
 [proguard] Warning: com.example.ApplicationBase: can't find referenced class com.example.lib.R
 [proguard] Warning: com.example.common.HelpDialog: can't find referenced class com.example.common.R$string
 [proguard] Warning: com.example.common.HelpDialog: can't find referenced class com.example.common.R$string
 [proguard] Warning: com.example.common.HelpDialog: can't find referenced class com.example.common.R
 [proguard] Warning: com.example.common.WebDialog: can't find referenced class com.example.common.R$layout
 [proguard] Warning: com.example.common.WebDialog: can't find referenced class com.example.common.R$id
 [proguard] Warning: com.example.common.WebDialog: can't find referenced class com.example.common.R$string
 [proguard] Warning: com.example.common.WebDialog: can't find referenced class com.example.common.R$layout
 [proguard] Warning: com.example.common.WebDialog: can't find referenced class com.example.common.R$id
 [proguard] Warning: com.example.common.WebDialog: can't find referenced class com.example.common.R$string
 [proguard] Warning: com.example.common.WebDialog: can't find referenced class com.example.common.R
 [proguard] Warning: com.example.common.WebDialog$1: can't find referenced class com.example.common.R$string
 [proguard] Warning: com.example.common.WebDialog$1: can't find referenced class com.example.common.R$string
 [proguard] Warning: com.example.common.WebDialog$1: can't find referenced class com.example.common.R
 [proguard] Warning: com.example.dlg.InfoDialogActivity: can't find referenced class com.example.lib.R$layout
 [proguard] Warning: com.example.dlg.InfoDialogActivity: can't find referenced class com.example.lib.R$layout
 [proguard] Warning: com.example.dlg.InfoDialogActivity: can't find referenced class com.example.lib.R
 [proguard] Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
 [proguard] Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
 [proguard] Note: there were 2 references to unknown classes.
 [proguard]       You should check your configuration for typos.
 [proguard] Warning: there were 23 unresolved references to classes or interfaces.
 [proguard]          You may need to specify additional library jars (using '-libraryjars').

BUILD FAILED
/Developer/Java/android-sdk-macosx/tools/ant/build.xml:570: The following error occurred while executing this line:
/Developer/Java/android-sdk-macosx/tools/ant/build.xml:834: Please correct the above warnings first.

「ant debug」はエラーなしでコンパイルされるため、プロジェクトのセットアップは問題ないように思えます。上記のリストでは、パッケージ名が com.example に変更され、ユーザー ディレクトリが ~/xy に変更されました

私はこの問題についてウェブを検索しましたが、特にスタックオーバーフローに関する多くの投稿を見つけましたが、まだ問題を解決するのに役立つものはありませんでした. ありがとう

4

1 に答える 1

3

アプリケーション ライブラリのビルド ファイルでプロガードの難読化がオンになっていることが判明しました。これをオフにすると、無料および完全なアプリケーション スタブのビルド時にすべてのシンボルが検出されました。

于 2012-08-26T06:39:05.417 に答える