最后,我的第一场比赛快到最后期限了。我有点小问题。
当我编译我的签名libgdx应用程序时,我总是有一个错误。
按照消息gradle build和我的proguard文件。

Information:Gradle tasks [:android:assembleRelease]
:android:preBuild UP-TO-DATE
:android:preReleaseBuild UP-TO-DATE
:android:checkReleaseManifest
:android:preDebugBuild UP-TO-DATE
:core:compileJava UP-TO-DATE
:core:processResources UP-TO-DATE
:core:classes UP-TO-DATE
:core:jar UP-TO-DATE
:android:prepareComAndroidSupportSupportV42300Library UP-TO-DATE
:android:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE
:android:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:android:prepareReleaseDependencies
:android:compileReleaseAidl
:android:compileReleaseRenderscript
:android:generateReleaseBuildConfig
:android:generateReleaseAssets UP-TO-DATE
:android:mergeReleaseAssets
:android:generateReleaseResValues UP-TO-DATE
:android:generateReleaseResources
:android:mergeReleaseResources
:android:processReleaseManifest
:android:processReleaseResources
:android:generateReleaseSources
:android:compileReleaseJavaWithJavac
:android:compileReleaseNdk UP-TO-DATE
:android:compileReleaseSources
:android:lintVitalRelease
:android:processReleaseJavaRes UP-TO-DATE
:android:transformResourcesWithMergeJavaResForRelease
:android:transformClassesAndResourcesWithProguardForRelease
ProGuard, version 5.2.1
Reading input...
Reading program jar [C:\Users\Admin\Desktop\mygdxgame\core\build\libs\core-1.0.jar] (filtered)
Reading program jar [C:\Users\Admin\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx\1.7.0\1b08c96132448b5ab9c0cc8dea3e985dcf0166fd\gdx-1.7.0.jar] (filtered)
Reading program jar [C:\Users\Admin\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-box2d\1.7.0\a560f1f94b939f2b5ccd4eec752797c3ea6e1c92\gdx-box2d-1.7.0.jar] (filtered)
Reading program jar [C:\Users\Admin\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\support-annotations\23.0.0\support-annotations-23.0.0.jar] (filtered)
Reading program jar [C:\Users\Admin\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-backend-android\1.7.0\d8c0e81a68812893d0bf80cea37fbcba9f23d38b\gdx-backend-android-1.7.0.jar] (filtered)
Reading program jar [C:\Users\Admin\Desktop\mygdxgame\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-ads\8.4.0\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Admin\Desktop\mygdxgame\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-basement\8.4.0\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Admin\Desktop\mygdxgame\android\build\intermediates\exploded-aar\com.android.support\support-v4\23.0.0\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Admin\Desktop\mygdxgame\android\build\intermediates\exploded-aar\com.android.support\support-v4\23.0.0\jars\libs\internal_impl-23.0.0.jar] (filtered)
Reading program jar [C:\Users\Admin\Desktop\mygdxgame\android\build\intermediates\transforms\mergeJavaRes\release\jars\2\1f\main.jar] (filtered)
Reading program directory [C:\Users\Admin\Desktop\mygdxgame\android\build\intermediates\classes\release] (filtered)
Reading library jar [C:\Users\Admin\AppData\Local\Android\sdk\platforms\android-21\android.jar]
Initializing...
Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
Note: android.support.v4.app.NotificationCompatJellybean calls 'Field.getType'
Note: com.badlogic.gdx.utils.reflect.Field calls 'Field.getType'
Note: com.badlogic.gdx.utils.reflect.Field calls 'Field.getGenericType'
Note: com.google.android.gms.internal.zzsv calls 'Field.getType'
Warning:com.badlogic.gdx.physics.box2d.utils.Box2DBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget$TargetOs
Warning:com.badlogic.gdx.physics.box2d.utils.Box2DBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget
Warning:com.badlogic.gdx.physics.box2d.utils.Box2DBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget$TargetOs
Warning:com.badlogic.gdx.physics.box2d.utils.Box2DBuild: can't find referenced class com.badlogic.gdx.jnigen.NativeCodeGenerator
Warning:com.badlogic.gdx.physics.box2d.utils.Box2DBuild: can't find referenced class com.badlogic.gdx.jnigen.AntScriptGenerator
Warning:com.badlogic.gdx.physics.box2d.utils.Box2DBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildConfig
Warning:com.badlogic.gdx.physics.box2d.utils.Box2DBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget
Warning:com.badlogic.gdx.physics.box2d.utils.Box2DBuild: can't find referenced class com.badlogic.gdx.jnigen.AntScriptGenerator
Warning:com.badlogic.gdx.physics.box2d.utils.Box2DBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget$TargetOs
Warning:com.badlogic.gdx.physics.box2d.utils.Box2DBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.NativeCodeGenerator
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget$TargetOs
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget$TargetOs
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget$TargetOs
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.AntScriptGenerator
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildConfig
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.AntScriptGenerator
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget$TargetOs
Warning:com.badlogic.gdx.utils.GdxBuild: can't find referenced class com.badlogic.gdx.jnigen.BuildTarget
Note: android.support.v4.text.ICUCompatApi23: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU
Note: com.google.android.gms.common.api.internal.zzw: can't find dynamically referenced class com.google.android.gms.common.api.internal.SupportLifecycleFragmentImpl
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'icon' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { int icon; }'
      Maybe this is program field 'com.badlogic.gdx.scenes.scene2d.ui.Tree$Node { com.badlogic.gdx.scenes.scene2d.utils.Drawable icon; }'
      Maybe this is library field 'android.R$attr { int icon; }'
      Maybe this is library field 'android.R$id { int icon; }'
      Maybe this is library field 'android.app.LauncherActivity$ListItem { android.graphics.drawable.Drawable icon; }'
      Maybe this is library field 'android.app.Notification { int icon; }'
      Maybe this is library field 'android.app.Notification$Action { int icon; }'
      Maybe this is library field 'android.appwidget.AppWidgetProviderInfo { int icon; }'
      Maybe this is library field 'android.content.pm.PackageItemInfo { int icon; }'
      Maybe this is library field 'android.content.pm.ResolveInfo { int icon; }'
      Maybe this is library field 'android.inputmethodservice.Keyboard$Key { android.graphics.drawable.Drawable icon; }'
      Maybe this is library field 'android.speech.tts.TextToSpeech$EngineInfo { int icon; }'
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'title' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { java.lang.CharSequence title; }'
      Maybe this is library field 'android.R$attr { int title; }'
      Maybe this is library field 'android.R$id { int title; }'
      Maybe this is library field 'android.app.Notification$Action { java.lang.CharSequence title; }'
      Maybe this is library field 'android.preference.PreferenceActivity$Header { java.lang.CharSequence title; }'
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'actionIntent' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { android.app.PendingIntent actionIntent; }'
      Maybe this is library field 'android.app.Notification$Action { android.app.PendingIntent actionIntent; }'
Note: the configuration keeps the entry point 'android.support.v4.view.ViewPager { void setAdapter(android.support.v4.view.PagerAdapter); }', but not the descriptor class 'android.support.v4.view.PagerAdapter'
Note: the configuration keeps the entry point 'android.support.v4.view.ViewPager { void setOnAdapterChangeListener(android.support.v4.view.ViewPager$OnAdapterChangeListener); }', but not the descriptor class 'android.support.v4.view.ViewPager$OnAdapterChangeListener'
Note: the configuration keeps the entry point 'android.support.v4.view.ViewPager { void setOnPageChangeListener(android.support.v4.view.ViewPager$OnPageChangeListener); }', but not the descriptor class 'android.support.v4.view.ViewPager$OnPageChangeListener'
Note: the configuration keeps the entry point 'android.support.v4.widget.DrawerLayout { void setDrawerListener(android.support.v4.widget.DrawerLayout$DrawerListener); }', but not the descriptor class 'android.support.v4.widget.DrawerLayout$DrawerListener'
Note: the configuration keeps the entry point 'android.support.v4.widget.SlidingPaneLayout { void setPanelSlideListener(android.support.v4.widget.SlidingPaneLayout$PanelSlideListener); }', but not the descriptor class 'android.support.v4.widget.SlidingPaneLayout$PanelSlideListener'
Note: the configuration keeps the entry point 'android.support.v4.widget.SwipeRefreshLayout { void setOnRefreshListener(android.support.v4.widget.SwipeRefreshLayout$OnRefreshListener); }', but not the descriptor class 'android.support.v4.widget.SwipeRefreshLayout$OnRefreshListener'
Note: the configuration keeps the entry point 'com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewAPI18 { void setGLWrapper(com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewAPI18$GLWrapper); }', but not the descriptor class 'com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewAPI18$GLWrapper'
Note: the configuration keeps the entry point 'com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewAPI18 { void setEGLContextFactory(com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewAPI18$EGLContextFactory); }', but not the descriptor class 'com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewAPI18$EGLContextFactory'
Note: the configuration keeps the entry point 'com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewAPI18 { void setEGLWindowSurfaceFactory(com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewAPI18$EGLWindowSurfaceFactory); }', but not the descriptor class 'com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewAPI18$EGLWindowSurfaceFactory'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.AdView { void setInAppPurchaseListener(com.google.android.gms.ads.purchase.InAppPurchaseListener); }', but not the descriptor class 'com.google.android.gms.ads.purchase.InAppPurchaseListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.AdView { void setAdSize(com.google.android.gms.ads.AdSize); }', but not the descriptor class 'com.google.android.gms.ads.AdSize'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.AdView { void setAdListener(com.google.android.gms.ads.AdListener); }', but not the descriptor class 'com.google.android.gms.ads.AdListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.BaseAdView { void setAdListener(com.google.android.gms.ads.AdListener); }', but not the descriptor class 'com.google.android.gms.ads.AdListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.BaseAdView { void setAdSize(com.google.android.gms.ads.AdSize); }', but not the descriptor class 'com.google.android.gms.ads.AdSize'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.BaseAdView { void setInAppPurchaseListener(com.google.android.gms.ads.purchase.InAppPurchaseListener); }', but not the descriptor class 'com.google.android.gms.ads.purchase.InAppPurchaseListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.NativeExpressAdView { void setInAppPurchaseListener(com.google.android.gms.ads.purchase.InAppPurchaseListener); }', but not the descriptor class 'com.google.android.gms.ads.purchase.InAppPurchaseListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.NativeExpressAdView { void setAdSize(com.google.android.gms.ads.AdSize); }', but not the descriptor class 'com.google.android.gms.ads.AdSize'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.NativeExpressAdView { void setAdListener(com.google.android.gms.ads.AdListener); }', but not the descriptor class 'com.google.android.gms.ads.AdListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView { void setAdListener(com.google.android.gms.ads.AdListener); }', but not the descriptor class 'com.google.android.gms.ads.AdListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView { void setAdSizes(com.google.android.gms.ads.AdSize[]); }', but not the descriptor class 'com.google.android.gms.ads.AdSize'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView { void setAppEventListener(com.google.android.gms.ads.doubleclick.AppEventListener); }', but not the descriptor class 'com.google.android.gms.ads.doubleclick.AppEventListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView { void setCorrelator(com.google.android.gms.ads.Correlator); }', but not the descriptor class 'com.google.android.gms.ads.Correlator'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView { void setOnCustomRenderedAdLoadedListener(com.google.android.gms.ads.doubleclick.OnCustomRenderedAdLoadedListener); }', but not the descriptor class 'com.google.android.gms.ads.doubleclick.OnCustomRenderedAdLoadedListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.formats.NativeAdView { void setNativeAd(com.google.android.gms.ads.formats.NativeAd); }', but not the descriptor class 'com.google.android.gms.ads.formats.NativeAd'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.search.SearchAdView { void setAdListener(com.google.android.gms.ads.AdListener); }', but not the descriptor class 'com.google.android.gms.ads.AdListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.search.SearchAdView { void setAdSize(com.google.android.gms.ads.AdSize); }', but not the descriptor class 'com.google.android.gms.ads.AdSize'
Note: the configuration keeps the entry point 'com.google.android.gms.flags.impl.FlagProviderImpl { void init(com.google.android.gms.dynamic.zzd); }', but not the descriptor class 'com.google.android.gms.dynamic.zzd'
Note: there were 2 references to unknown classes.
      You should check your configuration for typos.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 4 classes trying to access generic signatures using reflection.
      You should consider keeping the signature attributes
      (using '-keepattributes Signature').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 27 unkept descriptor classes in kept class members.
      You should consider explicitly keeping the mentioned classes
      (using '-keep').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
Note: there were 3 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 3 accesses to class members by means of introspection.
      You should consider explicitly keeping the mentioned class members
      (using '-keep' or '-keepclassmembers').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
Warning:there were 55 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:Exception while processing task java.io.IOException: Please correct the above warnings first.
:android:transformClassesAndResourcesWithProguardForRelease FAILED
Error:Execution failed for task ':android:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.

我的proguard文件是:
-verbose

    -dontwarn android.support.**
    -dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication
    -dontwarn com.badlogic.gdx.utils.GdxBuild
    -dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild
    -dontwarn com.badlogic.gdx.jnigen.BuildTarget*
    -dontwarn com.badlogic.gdx.graphics.g2d.freetype.FreetypeBuild
    -keep class com.badlogic.gdx.controllers.android.AndroidControllers

    -keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* {
       <init>(com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration);
    }

    -keepclassmembers class com.badlogic.gdx.physics.box2d.World {
       boolean contactFilter(long, long);
       void    beginContact(long);
       void    endContact(long);
       void    preSolve(long, long);
       void    postSolve(long, long);
       boolean reportFixture(long);
       float   reportRayFixture(long, float, float, float, float, float);
    }

我该怎么解决?

最佳答案

尝试在proguard文件中添加此行:

-keep public class com.android.vending.licensing.ILicensingService

如果不起作用,请尝试我使用的proguard文件cnfig,它对我的libgdx项目很好。
-injars      bin/classes
-injars      libs
-outjars     bin/classes-processed.jar
#libraryjars C:/.........../workspace/GameAndroid/libs/gdx.jar

-dontpreverify
-repackageclasses ''
-allowaccessmodification
#-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*

-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 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*(...);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.content.Context {
   public void *(android.view.View);
   public void *(android.view.MenuItem);
}

-keepclassmembers class * implements android.os.Parcelable {
    static ** CREATOR;
}

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

-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}


-dontwarn android.support.**
-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication
-dontwarn com.badlogic.gdx.utils.GdxBuild
-dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild
-dontwarn com.badlogic.gdx.jnigen.BuildTarget*
-dontwarn com.google.android.gms.**

-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* {
   <init>(com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration);
}

-keepclassmembers class com.badlogic.gdx.physics.box2d.World {
   boolean contactFilter(long, long);
   void    beginContact(long);
   void    endContact(long);
   void    preSolve(long, long);
   void    postSolve(long, long);
   boolean reportFixture(long);
   float   reportRayFixture(long, float, float, float, float, float);
}

#-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
#-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

# http://stackoverflow.com/questions/4525661/android-proguard-cant-find-dynamically-referenced-class-javax-swing
-dontwarn java.awt.**
-dontnote java.awt.**
-dontwarn com.badlogic.gdx.jnigen.**


-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

关于android - 无法使用proguard进行编译,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34590601/

10-13 02:26