android-sdk
android-sdk copied to clipboard
[Spotify App Remote] Direct local .aar file dependencies are not supported when building an AAR
I am building a modular application that makes use of gradle android submodules.
One of the submodules is specific to Spotify and thus it depends on
implementation files("libs/spotify/app-remote-lib/spotify-app-remote-release-0.7.0.aar")
implementation "com.spotify.android:auth:1.2.3"
Does the spotify-app-remote library have a gradle repo that hosts it like there is for the "com.spotify.android:auth" one? Whenever I try to build my app with the direct dependency on the spotify-app-remote-release-0.7.0.aar, I get this error from gradle:
Direct local .aar file dependencies are not supported when building an AAR.
The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR.
Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error).
The following direct local .aar file dependencies of the :spotify project caused this error: ../StudioProjects/Kit/spotify/libs/spotify/app-remote-lib/spotify-app-remote-release-0.7.0.aar
api fileTree(dir: "libs", include: ['*.jar', '*.aar'])
USE '' NOT ""
USE '' NOT ""
?
I am also interested in a Maven dependency instead of a bundled AAR file. The Android ecosystem uses Maven to organize dependencies and to help keep libraries updated, instead of manually including a binary blob in the project.
What a coincidence, I am trying a similar thing too. I am currently attempting to build an AAR plugin for Unity 3D with this Spotify Android SDK. I have gotten through your issue by using "compileOnly files('libs/spotify-app-remote-release-0.7.1.aar')" in the dependencies instead of "implementation files("libs/spotify/app-remote-lib/spotify-app-remote-release-0.7.1.aar")" (Notice the file name, we might be using different versions of the remote library) But even after this and I got my plugin to compile, i'm still getting an ERROR called : "Call Exception: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/spotify/android/appremote/api/ConnectionParams$Builder;" When I try to use it. Try out the solution i just mentioned, it might solve the problem you are currently facing and let me know if it works/if you manage to get the SDK to behave like its supposed to.
I have exactly the same problem when I follow the Spotify documentation to the letter.
In Android Studio, the Spotify SDK is well recognized because I can use the SDK's features, but as soon as the application launches and uses ConnectionParams.Builder, I get the error
"Call Exception: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/spotify/android/appremote/api/ConnectionParams$Builder;"
What a coincidence, I am trying a similar thing too. I am currently attempting to build an AAR plugin for Unity 3D with this Spotify Android SDK. I have gotten through your issue by using "compileOnly files('libs/spotify-app-remote-release-0.7.1.aar')" in the dependencies instead of "implementation files("libs/spotify/app-remote-lib/spotify-app-remote-release-0.7.1.aar")" (Notice the file name, we might be using different versions of the remote library) But even after this and I got my plugin to compile, i'm still getting an ERROR called : "Call Exception: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/spotify/android/appremote/api/ConnectionParams$Builder;" When I try to use it. Try out the solution i just mentioned, it might solve the problem you are currently facing and let me know if it works/if you manage to get the SDK to behave like its supposed to.
Thats because compileOnly does not support aar files. Source: https://developer.android.com/studio/build/dependencies
I'm basically stuck as well (but for another project, unrelated to spotify).
How easy/hard is it to add the remote sdk to a maven repository?