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

Could not resolve com.google.android.gms:play-services-auth:18.+ #163

Open
black-hawk85 opened this issue Dec 17, 2021 · 12 comments
Open

Could not resolve com.google.android.gms:play-services-auth:18.+ #163

black-hawk85 opened this issue Dec 17, 2021 · 12 comments

Comments

@black-hawk85
Copy link

Since few days I'm getting the following error while gradle build

> Could not resolve all files for configuration ':app:stagingDebugRuntimeClasspath'.
   > Could not resolve com.google.android.gms:play-services-auth:18.+.
     Required by:
         project :app > project :codetrix-studio-capacitor-google-auth
      > Failed to list versions for com.google.android.gms:play-services-auth.
         > Unable to load Maven meta-data from https://dl.bintray.com/ionic-team/capacitor/com/google/android/gms/play-services-auth/maven-metadata.xml.
            > Could not GET 'https://dl.bintray.com/ionic-team/capacitor/com/google/android/gms/play-services-auth/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

I'm using @codetrix-studio/[email protected]

Any idea how to solve this?

@adelabd
Copy link

adelabd commented Dec 17, 2021 via email

@black-hawk85
Copy link
Author

Ya I saw the 502 message aswell while manually opening the URL.
So means shall wait for few days n try again?

@patryk-eco
Copy link
Contributor

jcenter() was deprecated and should be replaced by mavenCentral(). This must be fixed in this plugin.

@black-hawk85
Copy link
Author

Yes, I also saw it.
My temporary workaround is to make an offline gradle build in command line

./gradlew assembleStagingDebug --offline

But I agree with you, it must be fixed in the plugin.

@adelabd
Copy link

adelabd commented Dec 22, 2021

@patryk-eco has right.
https://developer.android.com/studio/build/jcenter-migration

patryk-eco added a commit to patryk-eco/CapacitorGoogleAuth that referenced this issue Dec 22, 2021
@patryk-eco
Copy link
Contributor

You can use my fork https://github.com/patryk-eco/CapacitorGoogleAuth.git in the package.json:

npm i -D patryk-eco/CapacitorGoogleAuth#fix-jcenter

@patryk-eco
Copy link
Contributor

I had to make an additional fix. This should work for you, if you are curious:
npm i github:patryk-eco/CapacitorGoogleAuth#d09f1e5

@black-hawk85
Copy link
Author

Unfortunately still getting errors.
Does your fork work with Capacitor 2?

@carsten-klaffke
Copy link

Hey guys, just to prevent duplication: Did you inform the capacitor-google-auth project? Otherwise, I would create an issue there.

@black-hawk85
Copy link
Author

@carsten-klaffke I haven't created an issue there yet. You can do it if you want

@carsten-klaffke
Copy link

carsten-klaffke commented Dec 30, 2021

@black-hawk85

Unfortunately still getting errors. Does your fork work with Capacitor 2?

For me it worked!
Did you run "npm install" and "npm run build" in the fork? And then "ionic cap update" and "ionic cap sync" in your project?

@Nikita-schetko
Copy link

Nikita-schetko commented Jan 10, 2022

My workaround to fix this issue:

Step 1, set up postinstall step:
Create in a root of your project file called 'postinstall.ts' and add this string to your package.json (to the "scripts"):
"postinstall": "node postinstall.ts"

Step 2, Add package to replace required string in CapactiorGoogleAuth:
npm i replace-in-file --save

Step 3, content of postinstall.ts :

const replace = require('replace-in-file');

const set_specific_version = {
  files: 'node_modules/@codetrix-studio/capacitor-google-auth/android/build.gradle',
  from: 'gms:play-services-auth:18.+',
  to: 'gms:play-services-auth:18.1.0',
  allowEmptyPaths: false,
};
replace(set_specific_version)
  .then(() => {
    console.log('postinstall.ts: Modified file succesfully !');
  })
  .catch(error => {
    console.error('postinstall.ts: Error occurred:', error);
  });

Now, on each npm install, npm will automatically patch capacitor-google-auth with specific version of play-services, and gradle build will work;

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

5 participants