libgdx / gdx-pay

A libGDX cross-platform API for InApp purchasing.
Apache License 2.0
225 stars 83 forks source link

Proguard related: Error:warning: Ignoring InnerClasses attribute for an anonymous inner class #127

Closed Trurl101 closed 5 years ago

Trurl101 commented 7 years ago

Since 0.10.3 (and android studio 2.2) I get this warning (4720 times) when building a signed apk with proguard (the app runs anyway but these warnings are annoying):

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(android.support.v4.app.aa) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.

I use these lines to include gdx-pay for android:

compile "com.badlogicgames.gdxpay:gdx-pay-android:$gdxPayVersion"
compile "com.badlogicgames.gdxpay:gdx-pay-android-googleplay:${gdxPayVersion}@aar"  

adding this helped nothing

compile("com.badlogicgames.gdxpay:gdx-pay-android-googleplay:${gdxPayVersion}@aar") {
      exclude group: 'com.android.support', module: 'support-v4'
}

When I don't include gdx-pay the warnings go away.

keesvandieren commented 7 years ago

I have pushed 0.10.4-SNAPSHOT to https://oss.sonatype.org/content/repositories/snapshots/

Replaced compile 'com.android.support:support-v4:19.0.0' with compile 'com.android.support:support-v4:23.4.0'

Can you give it a try?

Steps:

Please let us know the results

Trurl101 commented 7 years ago

Tried with 0.10.4-SNAPSHOT and cleared all caches before that. Same error:

10:20:43 Gradle sync started
10:21:25 Gradle sync completed
10:21:26 Executing tasks: [:android:generateDebugSources, :android:generateDebugAndroidTestSources, :android:mockableAndroidJar, :android:prepareDebugUnitTestDependencies]
10:21:32 Gradle build finished with 1 warnings(s) in 5s 57ms
10:21:47 Executing tasks: [:android:assembleRelease]
10:23:08 Gradle build finished with 4720 error(s) in 1m 20s 577ms
10:23:08 Generate Signed APK
         APK(s) generated successfully.
         Reveal in Finder
Information:Gradle tasks [:android:assembleRelease]
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(android.support.v4.app.aa) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
keesvandieren commented 7 years ago

Hmm. com.android.support:support-v4:23.4.0 is the latest version that supports SDK version 8.0.

Does your own project have a dependency on support-v4 package as well, maybe with an older version?

Trurl101 commented 7 years ago

No dependency to "support-v4". I only include standard libgdx-packages+Freetype+Firebase.

When I remove compile "com.badlogicgames.gdxpay:gdx-pay-android-googleplay:$gdxPayVersion@aar" from the build.gradle, there are no errors. So it must have something to do with this include.

MrStahlfelge commented 5 years ago

Closing this because it is very old, feel free to reopen if you still face this issue.

If you still face this issue, try to include a newer support lib by explicitly setting it in your gradle file. We are happy to accept PRs fixing the problem. As Google Play IAPs work only with Play Services, which are only working from API level 15 on, a higher minsdkversion is not a problem.