CariusLars / ar_flutter_plugin

Flutter Plugin for AR (Augmented Reality) - Supports ARKit on iOS and ARCore on Android devices
MIT License
322 stars 233 forks source link

Fail to compile `com.google.android.gms:play-services-auth` because `google.bintray.com` is no longer live #68

Open leeprobert opened 2 years ago

leeprobert commented 2 years ago

This is affecting many packages and I have been battling it with other things like location but in this case it seems to be related to play-services-auth. You may not notice this until you clear the gradle cache in Android Studio and it attempts to download files from the specified repository. It wants to use https://google.bintray.com but for some reason this server is now dead. Here's the compilation error:

[ +192 ms] FAILURE: Build failed with an exception.
[   +2 ms] * What went wrong:
[        ] Execution failed for task ':app:checkDebugAarMetadata'.
[        ] > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
[        ]    > Could not resolve com.google.android.gms:play-services-auth:16+.
[        ]      Required by:
[        ]          project :app > project :ar_flutter_plugin
[        ]       > Failed to list versions for com.google.android.gms:play-services-auth.
[   +1 ms]          > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-auth/maven-metadata.xml.
[        ]             > Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-auth/maven-metadata.xml'.
[        ]                > Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-auth/maven-metadata.xml'. Received status code 502 from server: Bad
Gateway
[   +6 ms] * Try:
[        ] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[        ] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 30s

You can see the error is related to its inability to pull the code from the server: Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-auth/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

leeprobert commented 2 years ago

This could help:

//Project level build.gradle

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.+'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.10'
    }
}

//App level build.gradle

configurations.all {
    resolutionStrategy {
        force 'com.google.android.gms:play-services-location:16.0.0'
    }
}
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.android.gms:play-services-location:16.0.0'//add this line 
}
leeprobert commented 2 years ago

This possibly may not affect the main package library but could be necessary for the examples

CariusLars commented 2 years ago

I couldn't reproduce this, do you have any more ideas on how to clear the package from the cache? I've tried running rm -r ~/.pub-cache/hosted, rm -r ~/.pub-cache/git, ./gradlew cleanBuildCache in both the android and the example/android, and flutter pub cache clean and /gradlew cleanBuildCache to no unvail, it still builds fine and doesn't throw the error you reported