4

APKファイルを作成しようとしているのですが、エクスポートダイアログでFinishを押すとエラーになり、APKが作成されません。これまでネット上で何も見つけられませんでしたが、ここで誰かが助けることができますか? エラー:

Proguard returned with error code 1. See console
Warning: com.google.ads.util.i: can't find referenced method 'void setMediaPlaybackRequiresUserGesture(boolean)' in class android.webkit.WebSettings
      You should check if you need to specify additional program jars.
Warning: there were 1 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'.
java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:321)
    at proguard.ProGuard.initialize(ProGuard.java:211)
    at proguard.ProGuard.execute(ProGuard.java:86)
    at proguard.ProGuard.main(ProGuard.java:492)

追加してみました

-dontskipnonpubliclibraryclassmembers

しかし、助けにはなりませんでした。広告を使用しています。これは通常の Android アプリであり、エミュレーターで正常に動作します。

私のproguard.configはデフォルトで空です

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

そして私のproject.properties:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
# 
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-16  

ありがとう

ps: これらのデフォルトの Android プロガード設定は、基本的な「ハッキング」を防ぐのに十分安全ですか? (私がそれを実行可能にすることができれば)

4

2 に答える 2

10

警告メッセージが示すように、Google 広告ライブラリは、ターゲット ランタイム (android-16) に存在しないメソッドを参照しています。このメソッドは、android-17 の時点でのみ存在します。ProGuard がメソッドを見つけてコードを適切に分析できるように、android-17 以降のターゲットを指定する必要があります。

いずれにしてもアプリケーションが他のターゲットで動作する場合でも、AndroidManifest.xml で他のターゲットを指定できます。

ProGuard は、静的分析に対する基本的な保護を提供します。識別子を難読化し、コードの構造を変更します。保護を強化するには、商用の兄弟であるDexGuardを検討できます。これは、文字列の暗号化、クラスの暗号化、改ざん検出などの手法を使用して、静的分析および動的分析に対する保護を強化します。壊れないものはありません。最終的には、時間、労力、お金、利益、専門知識など、あなたと潜在的なハッカーにとって経済的なトレードオフになります...

(私は ProGuard と DexGuard の開発者です)

于 2013-03-14T11:58:41.117 に答える
1

追加して解決しました:

  -dontwarn com.google.ads.**

の後-verbose。例えば

-optimizationpasses 5                                                                                          -dontusemixedcaseclassnames                                                      
-dontskipnonpubliclibraryclasses                                                 
-dontpreverify                                                                   
-verbose                                                                         
-dontwarn com.google.ads.**                                                      
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
...
于 2013-07-14T23:12:20.367 に答える