react-native-spotify-remote icon indicating copy to clipboard operation
react-native-spotify-remote copied to clipboard

Plugin with id 'maven' not found.

Open suryababus opened this issue 3 years ago • 13 comments

I created a react native project using npx react-native init SocioMusic --template react-native-template-typescript. And I did yarn add react-native-spotify-remote.

Tried running react-native android. Got the below error. Please help.

* What went wrong:
A problem occurred evaluating project ':react-native-spotify-remote'.
> Plugin with id 'maven' not found.

suryababus avatar Jul 10 '22 04:07 suryababus

I'm running into the same problem and it appears that gradle 7 has deprecated the maven plugin. See this expo issue. Based on that it seems like downgrading to gradle 6 will resolve it.

@cjam is anyone working on upgrading this to gradle 7? I wouldn't mind doing the work

Danondso avatar Aug 05 '22 14:08 Danondso

@Danondso that would be amazing. I haven't had a chance to look as I've been under water with work.

cjam avatar Aug 09 '22 16:08 cjam

@suryababus what version are you using? There have been quite a few changes that were pushed to the @next tag. Could you try that version and see if the issue persists?

cjam avatar Aug 10 '22 12:08 cjam

I'll start looking into this and if @next is doing all right then I'll drop it 👍

Danondso avatar Aug 10 '22 17:08 Danondso

Okay I did notice that this commit removes the offending line regarding the apply plugin: 'maven'. So the current master doesn't reflect the issue the latest release has. I'm going to try the RC 1.0.0-1 to see if I can compile android.

Danondso avatar Aug 13 '22 13:08 Danondso

Upgraded to 1.0.0-1 and I got an error saying the .aar files couldn't be found. I reverted the build.gradle changes back to using files() to get the .aar dependencies and it compiles now.

edit: I stepped thru the remaining setup process to use it and I've logged in thru an android sim without issue. Though the expirationDate is coming back as a java.util.GregorianCalendar object.

// build.gradle
repositories {
    mavenLocal()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
    google()
    mavenCentral()
    jcenter()
    // remove these
    // flatDir {
    //     dirs 'external/SpotifySDK/app-remote-lib'
    //     dirs 'external/SpotifySDK/auth-lib'
    // }
}

dependencies {
    // use the old files syntax
    implementation (files('external/SpotifySDK/auth-lib/spotify-auth-release-1.2.3.aar'))
    implementation (files('external/SpotifySDK/app-remote-lib/spotify-app-remote-release-0.7.2.aar'))
    implementation "com.google.code.gson:gson:2.8.5"  // needed by spotify-app-remote
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
}

Danondso avatar Aug 13 '22 14:08 Danondso

Upgraded to 1.0.0-1 and I got an error saying the .aar files couldn't be found. I reverted the build.gradle changes back to using files() to get the .aar dependencies and it compiles now.

edit: I stepped thru the remaining setup process to use it and I've logged in thru an android sim without issue. Though the expirationDate is coming back as a java.util.GregorianCalendar object.

// build.gradle
repositories {
    mavenLocal()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
    google()
    mavenCentral()
    jcenter()
    // remove these
    // flatDir {
    //     dirs 'external/SpotifySDK/app-remote-lib'
    //     dirs 'external/SpotifySDK/auth-lib'
    // }
}

dependencies {
    // use the old files syntax
    implementation (files('external/SpotifySDK/auth-lib/spotify-auth-release-1.2.3.aar'))
    implementation (files('external/SpotifySDK/app-remote-lib/spotify-app-remote-release-0.7.2.aar'))
    implementation "com.google.code.gson:gson:2.8.5"  // needed by spotify-app-remote
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
}

Hey Guys I'm getting the same issue here, but I don't know if I follow strait right this solution, @Danondso what did you changed to managed the missing .aar files?

marcelocrljunior avatar Aug 16 '22 21:08 marcelocrljunior

In my project I opened up /node_modules/react-native-spotify-remote/android/build.gradle and modified the file like in my original post. More specifically I commented out lines 62-65 then I changed lines 69-70 to use the files() function to pull in the .aar files. The v0.3.10 version uses that syntax.

@cjam I can put up a PR for these if that fix seems appropriate.

Danondso avatar Aug 16 '22 21:08 Danondso

In my project I opened up /node_modules/react-native-spotify-remote/android/build.gradle and modified the file like in my original post. More specifically I commented out lines 62-65 then I changed lines 69-70 to use the files() function to pull in the .aar files. The v0.3.10 version uses that syntax.

@cjam I can put up a PR for these if that fix seems appropriate.

Now it's working thanks

marcelocrljunior avatar Aug 16 '22 21:08 marcelocrljunior

@Danondso Hey, I'm still having this issue. Tried doing the steps you described in your comment but the referenced lines were not corresponding, apparently. I didn't understand, did you use your initial PR also for this issue?

busybox11 avatar May 13 '23 15:05 busybox11

@busybox11 I need to rework how I had it setup. I upgraded gradle to version 7 in my repo and using the files() function to import those doesn't work anymore.

I'm going to fork this repo and try to upgrade gradle and get it cooperating with my app to start.

Danondso avatar Jun 26 '23 00:06 Danondso

@Danondso did you find any solution?

CaptainHaider avatar Jan 24 '24 21:01 CaptainHaider

@Danondso did you find any solution?

Not for solving this. I switched to use react-native-app-auth. They have a spotify auth example.

Danondso avatar Jan 24 '24 22:01 Danondso