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

Auth for android #99

Closed
Nirmitjatana opened this issue May 8, 2021 · 10 comments
Closed

Auth for android #99

Nirmitjatana opened this issue May 8, 2021 · 10 comments
Labels
android Specific for android documentation Improvements or additions to documentation

Comments

@Nirmitjatana
Copy link

I am getting this issue, while trying to run the app. I am only using auth service as of now

Screenshots
image

@brim-borium
Copy link
Owner

@Nirmitjatana it seems that you didn't add all modules, you have to add auth and appremote. Follow the instructions from the readme, especially this part from https://developer.spotify.com/documentation/android/quick-start/

@brim-borium
Copy link
Owner

Ok so this is an issue that we have to fix

Multiple things I found out:

The newest release of android studio removed the option to add .jar/.aar files the old way via the dialogue.
https://developer.android.com/studio/releases#4.2-new-wizards

Here it states the the Project Structure Dialogue is the new way to go: https://developer.android.com/studio/projects/android-library#psd-add-library-dependency

And this states on how to add a .jar/.aar as a dependecy: https://developer.android.com/studio/projects/android-library#psd-add-aar-jar-dependency

The issue we encounter then is that our linking will probably not work but I am not sure yet.

We have to do the linking currently because spotify did not put their sdk into a maven repository, what would be the recommended way of doing things

The recommended way to share dependencies (JARs and AARs) is with a Maven repository, either hosted on a service such as Maven Central or with a directory structure on your local disk. For more information on using Maven repositories, see Remote repositories.

I found out that the auth sdk is already in a maven repo, so we can change that, so that you as a user don't have to add this anymore. -> spotify/android-sdk#271

But the app remote currently has to be added the old/current way.

The optimal way would be that a user does not have to do anything in order to use the package, and I'm investigating if this is doable.

@Nirmitjatana
Copy link
Author

@brim-borium Thanks for the detailed explanation, will look into it.

@fotiDim fotiDim added the android Specific for android label Jun 29, 2021
@irfanakram825
Copy link

When I tried with the old version of Android Studio where it have option to add .jar/.aar files via the dialogue it worked successfully.

@andriy-gulak-ew
Copy link

I've faced the same problem on Android Studio 4.2. Is there any solution to this problem?

@andriy-gulak-ew
Copy link

I've found a solution/workaround. If you are on Android Studio 4.2+ you need to manually do all the things that the option to add .jar/.aar files did via the dialogue:

  1. Open the android folder of your flutter project as an Android Studio project
  2. In the android root folder create 2 folders spotify-app-remote and spotify-auth and place the corresponding aar files and create empty build.gradle files, like on the screenshot below:
    image
  3. Content of the spotify-app-remote/build.gradle file:
configurations.maybeCreate("default")
artifacts.add("default", file('spotify-app-remote-release-0.7.1.aar'))
  1. Content of the spotify-auth/build.gradle file:
configurations.maybeCreate("default")
artifacts.add("default", file('spotify-auth-release-1.2.3.aar'))
  1. In the android root folder find settings.gradle file, open it and add the following line at the top of the file:
include ':spotify-auth'
include ':spotify-app-remote'
  1. That's all! Now build your flutter app!

@brim-borium
Copy link
Owner

@andriy-gulak-ew

Thanks for the solution, do you think that we could also embed this into the package so nobody has to do this manual work?

@andriy-gulak-ew
Copy link

@brim-borium
Yes, it can be part of the package, but in this case, you have to take care of spotify-app-remote and spotify-auth aar versions under the hood of your plugin which is not ideal.

@brim-borium
Copy link
Owner

@brim-borium reminder to add this solution to the documentation

@YasinCelikSoftware
Copy link

YasinCelikSoftware commented Jan 12, 2024

I tried that solution because I am getting "Direct local .aar file dependencies are not supported" error. But didn't worked for me. Here what I do:

  1. I created a folder in android folder.
    image

  2. I copied .aar file into that folder. And created an empty build.gradle file. And put the provided configuration code inside build.gradle file.
    image

  3. Then I edit my settings.gradle file like this (line 7).
    image

But still getting the error. "Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the...." But error is not because of this file. It's throwing error for original file that I copied from node_modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Specific for android documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

6 participants