アプリケーションを完成させたばかりなので、ProGuard で難読化したいと考えました。アプリケーションはholoeverywhere
Action Bar Sherlock のライブラリを使用しているので、ProGuard に伝えてみました。私は Eclipse を使用しています。これは 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-19
android.library.reference.1=..\\HoloEverywhere Addon Preferences
何も追加も削除もしていません。
これは私のproguard-project.txtです:
# 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 *;
#}
-keep class com.actionbarsherlock.**
-keep class org.holoeverywhere.**
-libraryjars adt-bundle-windows-x86_64-20130917\sdk\platforms\android-19\android.jar
-libraryjars actionbarsherlock\libs\android-support-v4.jar
-libraryjars HoloEverywhere Addon Preferences\bin\holoeverywhere addon preferences.jar
-libraryjars HoloEverywhere Library\bin\holoeverywhere library.jar
-libraryjars actionbarsherlock\bin\actionbarsherlock.jar
それが役立つ場合、これは私の依存関係の画面です:
アプリケーションをエクスポートするときにエラーや警告は表示されませんが、Android フォンにインストールすると、アプリケーションを開くとクラッシュします。これは、スタック トレースです。
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.project/com.my.project.FirstPage}: java.lang.RuntimeException: java.lang.NoSuchMethodException: AddonSherlock$HoloActionBarSherlockCompat(Activity,int)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: AddonSherlock$HoloActionBarSherlockCompat(Activity,int)
at com.actionbarsherlock.ActionBarSherlock.a(Unknown Source)
at org.holoeverywhere.addon.AddonSherlock$AddonSherlockA.c(Unknown Source)
at org.holoeverywhere.addon.AddonSherlock$AddonSherlockA.a(Unknown Source)
at android.support.v4.app.aw.a(Unknown Source)
at android.support.v4.app.aw.a(Unknown Source)
at org.holoeverywhere.addon.IAddonBasicAttacher.a(Unknown Source)
at org.holoeverywhere.app.Activity.a(Unknown Source)
at android.support.v4.app._HoloActivity.a(Unknown Source)
at android.support.v4.app._HoloActivity.setContentView(Unknown Source)
at com.my.project.FirstPage.onCreate(Unknown Source)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
... 11 more
Caused by: java.lang.NoSuchMethodException: AddonSherlock$HoloActionBarSherlockCompat(Activity,int)
at java.lang.Class.getMatchingConstructor(Class.java:643)
at java.lang.Class.getConstructor(Class.java:472)
... 23 more
どうすれば修正できますか?