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

[Spotify App Remote] Direct local .aar file dependencies are not supported when building an AAR #271

Open
Volatile-Memory opened this issue Aug 30, 2020 · 8 comments

Comments

@Volatile-Memory
Copy link

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
@ChinaVolvocars
Copy link

api fileTree(dir: "libs", include: ['*.jar', '*.aar'])

@ChinaVolvocars
Copy link

USE '' NOT ""

@Volatile-Memory
Copy link
Author

USE '' NOT ""

?

@hufman
Copy link

hufman commented Oct 18, 2020

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.

@benlane2003
Copy link

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.

@NicolasLaurentGarnotel
Copy link

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;"

@larssn
Copy link

larssn commented Mar 30, 2021

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).

@brim-borium
Copy link

brim-borium commented May 11, 2021

How easy/hard is it to add the remote sdk to a maven repository?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants