我似乎无法在没有警告的情况下编译。这是警告:
Warning:roboguice.activity.RoboMapActivity: can't find superclass or interface com.google.android.maps.MapActivity
Warning:roboguice.activity.RoboSherlockActivity: can't find superclass or interface com.actionbarsherlock.app.SherlockActivity
Warning:roboguice.activity.RoboSherlockFragmentActivity: can't find superclass or interface com.actionbarsherlock.app.SherlockFragmentActivity
Warning:roboguice.activity.RoboSherlockListActivity: can't find superclass or interface com.actionbarsherlock.app.SherlockListActivity
Warning:roboguice.activity.RoboSherlockPreferenceActivity: can't find superclass or interface com.actionbarsherlock.app.SherlockPreferenceActivity
Warning:roboguice.activity.SherlockAccountAuthenticatorActivity: can't find superclass or interface com.actionbarsherlock.app.SherlockActivity
Warning:roboguice.fragment.RoboSherlockDialogFragment: can't find superclass or interface com.actionbarsherlock.app.SherlockDialogFragment
Warning:roboguice.fragment.RoboSherlockFragment: can't find superclass or interface com.actionbarsherlock.app.SherlockFragment
Warning:roboguice.fragment.RoboSherlockListFragment: can't find superclass or interface com.actionbarsherlock.app.SherlockListFragment
Warning:org.roboguice.shaded.goole.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning:org.roboguice.shaded.goole.common.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
Warning:org.roboguice.shaded.goole.common.cache.Striped64$Cell: can't find referenced class sun.misc.Unsafe
Warning:roboguice.activity.RoboMapActivity: can't find referenced class com.google.android.maps.MapActivity
Warning:roboguice.activity.RoboMapActivity: can't find referenced method 'android.content.res.Resources getResources()' in program class roboguice.activity.RoboMapActivity
Warning:roboguice.activity.RoboMapActivity: can't find referenced class com.google.android.maps.MapActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'void onRestart()' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'void onStart()' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'void onResume()' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'void onPause()' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'void onNewIntent(android.content.Intent)' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'void onStop()' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'void onDestroy()' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'android.content.res.Resources getResources()' in program class roboguice.activity.RoboSherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'void onConfigurationChanged(android.content.res.Configuration)' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'void onContentChanged()' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'void onActivityResult(int,int,android.content.Intent)' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'android.view.View onCreateView(java.lang.String,android.content.Context,android.util.AttributeSet)' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockAccountAuthenticatorActivity: can't find referenced method 'android.view.View onCreateView(android.view.View,java.lang.String,android.content.Context,android.util.AttributeSet)' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.RoboSherlockActivity: can't find referenced class com.actionbarsherlock.app.SherlockActivity
Warning:roboguice.activity.RoboSherlockActivity: can't find referenced method 'android.content.res.Resources getResources()' in program class roboguice.activity.RoboSherlockActivity
Warning:roboguice.activity.RoboSherlockActivity: can't find referenced class com.actionbarsherlock.app.SherlockActivity
Warning:roboguice.activity.RoboSherlockFragmentActivity: can't find referenced class com.actionbarsherlock.app.SherlockFragmentActivity
Warning:roboguice.activity.RoboSherlockFragmentActivity: can't find referenced method 'android.content.res.Resources getResources()' in program class roboguice.activity.RoboSherlockFragmentActivity
Warning:roboguice.activity.RoboSherlockFragmentActivity: can't find referenced class com.actionbarsherlock.app.SherlockFragmentActivity
Warning:roboguice.activity.RoboSherlockListActivity: can't find referenced class com.actionbarsherlock.app.SherlockListActivity
Warning:roboguice.activity.RoboSherlockListActivity: can't find referenced method 'android.content.res.Resources getResources()' in program class roboguice.activity.RoboSherlockListActivity
Warning:roboguice.activity.RoboSherlockListActivity: can't find referenced class com.actionbarsherlock.app.SherlockListActivity
Warning:roboguice.activity.RoboSherlockPreferenceActivity: can't find referenced class com.actionbarsherlock.app.SherlockPreferenceActivity
Warning:roboguice.activity.RoboSherlockPreferenceActivity: can't find referenced method 'android.content.res.Resources getResources()' in program class roboguice.activity.RoboSherlockPreferenceActivity
Warning:roboguice.activity.RoboSherlockPreferenceActivity: can't find referenced class com.actionbarsherlock.app.SherlockPreferenceActivity
Warning:roboguice.activity.SherlockAccountAuthenticatorActivity: can't find referenced class com.actionbarsherlock.app.SherlockActivity
Warning:roboguice.activity.SherlockAccountAuthenticatorActivity: can't find referenced method 'android.content.Intent getIntent()' in program class roboguice.activity.SherlockAccountAuthenticatorActivity
Warning:roboguice.activity.SherlockAccountAuthenticatorActivity: can't find referenced class com.actionbarsherlock.app.SherlockActivity
Warning:roboguice.fragment.RoboSherlockDialogFragment: can't find referenced class com.actionbarsherlock.app.SherlockDialogFragment
Warning:roboguice.fragment.RoboSherlockDialogFragment: can't find referenced method 'android.support.v4.app.FragmentActivity getActivity()' in program class roboguice.fragment.RoboSherlockDialogFragment
Warning:roboguice.fragment.RoboSherlockDialogFragment: can't find referenced class com.actionbarsherlock.app.SherlockDialogFragment
Warning:roboguice.fragment.RoboSherlockFragment: can't find referenced class com.actionbarsherlock.app.SherlockFragment
Warning:roboguice.fragment.RoboSherlockFragment: can't find referenced method 'android.support.v4.app.FragmentActivity getActivity()' in program class roboguice.fragment.RoboSherlockFragment
Warning:roboguice.fragment.RoboSherlockFragment: can't find referenced class com.actionbarsherlock.app.SherlockFragment
Warning:roboguice.fragment.RoboSherlockListFragment: can't find referenced class com.actionbarsherlock.app.SherlockListFragment
Warning:roboguice.fragment.RoboSherlockListFragment: can't find referenced method 'android.support.v4.app.FragmentActivity getActivity()' in program class roboguice.fragment.RoboSherlockListFragment
Warning:roboguice.fragment.RoboSherlockListFragment: can't find referenced class com.actionbarsherlock.app.SherlockListFragment
Warning:there were 118 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 22 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
:app:proguardAgmobileRelease FAILED
我尝试添加actionarSherlock所需的Proguard,但它没有帮助。如果项目在调试模式下运行良好,是否可以安全使用--dontwarn?
这是我的Proguard文件:
-target 1.6
-dontobfuscate
-dontoptimize
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-dump ../bin/class_files.txt
-printseeds ../bin/seeds.txt
-printusage ../bin/unused.txt
-printmapping ../bin/mapping.txt
# The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle.
-optimizations !code/simplification/arithmetic
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep class com.google.inject.Binder
-keepclassmembers class * {
@com.google.inject.Inject <init>(...);
}
# There's no way to keep all @Observes methods, so use the On*Event convention to identify event handlers
-keepclassmembers class * {
void *(**On*Event);
}
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keep class roboguice.**
-keep class org.roboguice.**
-keep public class AnnotationDatabaseImpl
答案 0 :(得分:1)
只使用我的Proguard文件中的那些行,我可以隐藏警告并编译我的应用程序。
也许这些线可以帮助别人:
-dontwarn roboguice.**
-dontwarn org.roboguice.**
-keep class roboguice.** { *; }
-keep class org.roboguice.** { *; }
-keepattributes *Annotation*,Signature
-keep class com.google.inject.Binder
-keep public class com.google.inject.Inject
# keeps all fields and Constructors with @Inject
-keepclassmembers,allowobfuscation class * {
@com.google.inject.Inject <fields>;
@com.google.inject.Inject <init>(...);
}
来源:
How to make Proguard ignore external libraries?
Injection with google guice does not work anymore after obfuscation with proguard
答案 1 :(得分:0)
尝试将此添加到您的proguard文件中。
-dontwarn roboguice.**