Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing classes detected while running R8 in android release mode #226

Open
GabrielCoffee9 opened this issue Oct 17, 2024 · 5 comments
Open
Labels
bug Something isn't working

Comments

@GabrielCoffee9
Copy link

Is this a how to question?
No

Is this a native Spotify SDK issue?
No

Have you searched for existing issues?
Yes

Are you using a Free or Premium Spotify account?
Premium

Are you aware of the limitations of Free Spotify accounts?
Yes

Expected behavior
Flutter Build successful

Describe the bug
"On console -> ERROR: Missing classes detected while running R8."

Steps to Reproduce
Steps to reproduce the behavior:

  1. Create a new Flutter application with Android platform
  2. Add Spotify_sdk package -> flutter pub add spotify_sdk
  3. Run auto setup for android -> dart run spotify_sdk:android_setup
  4. Run -> flutter build apk
  5. See the error

Screenshots
image

Spotify_sdk Flutter package version 3.0.2

Flutter version 3.24.3

spotify_sdk:
    dependency: "direct main"
    description:
      name: spotify_sdk
      sha256: "4c7a3b79f0370e7ae8ac07cad5e630d0bb3ad118f4c16219ec37f6988a65465e"
      url: "https://pub.dev"
    source: hosted
    version: "3.0.2"

Target Platform, Version & Device

  • OS & Version: Tested Android 14 and 15
  • Device: Tested in Android Emulator Medium Phone API 34 and 35

Development OS

  • Windows

Tried to build the release apk in my personal project and get this error, I created a new flutter android project and followed the steps above, getting the same error. This Error doesn't occurs in debug mode.

@GabrielCoffee9 GabrielCoffee9 added the bug Something isn't working label Oct 17, 2024
@SaNu-hIT
Copy link

SaNu-hIT commented Oct 20, 2024

Got a fix .
Hope it will help.

Step 1: Locate the proguard-rules.pro File

Check if a file named proguard-rules.pro exists. If it doesn't, create a new file named proguard-rules.pro in this directory.

Step 2: Add the Required ProGuard Rules

-dontwarn com.fasterxml.jackson.databind.deser.std.StdDeserializer
-dontwarn com.fasterxml.jackson.databind.ser.std.StdSerializer
-dontwarn com.spotify.base.annotations.NotNull

Step 3: Clean and Rebuild the Project

@GabrielCoffee9
Copy link
Author

GabrielCoffee9 commented Oct 21, 2024

Got a fix . Hope it will help.

Step 1: Locate the proguard-rules.pro File

Check if a file named proguard-rules.pro exists. If it doesn't, create a new file named proguard-rules.pro in this directory.

Step 2: Add the Required ProGuard Rules

-dontwarn com.fasterxml.jackson.databind.deser.std.StdDeserializer -dontwarn com.fasterxml.jackson.databind.ser.std.StdSerializer -dontwarn com.spotify.base.annotations.NotNull

Step 3: Clean and Rebuild the Project

Yes, this works to build the project, but I think this is just an action to "remove warning", does not solve the real problem that could cause unexpected errors and bugs.

@SaNu-hIT
Copy link

Testing it form my side , integration seems solid in release mode also. So far no errors or bugs .

@GabrielCoffee9
Copy link
Author

I found a bug that only happens in release mode too (on Android), where the Connection Status does not work correctly due to probably a parsing problem, could it be related to these missing classes?

I say this because there are missing classes which have a role of serializing json like com.fasterxml.jackson.databind.deser.std.StdDeserializer and com.fasterxml.jackson.databind.ser.std.StdSerializer

In the function ConnectionStatus _$ConnectionStatusFromJson(Map<String, dynamic> json) in the file:

"C:\Users{USERNAME}\AppData\Local\Pub\Cache\hosted\pub.dev\spotify_sdk-3.0.2\lib\models\connection_status.g.dart"

The parameter json is filled with keys:'a', 'b', 'c' and 'd' when in release mode, instead of 'connected', 'message', 'errorCode' and 'errorDetails'. The values are ok but the json keys are wrong.

I had to make changes to an automatically generated function so that the returned json was read correctly.
@brim-borium I don't know if this bug is directly related to this problem, should I open another issue?

@brim-borium
Copy link
Owner

@GabrielCoffee9 thank you for reporting this, yes please open a separate issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants