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 build Flutter Android Build : Received status code 502 from bintray #516

Closed
Davete0302 opened this issue Dec 14, 2021 · 14 comments

Comments

@Davete0302
Copy link

Davete0302 commented Dec 14, 2021

Description:

Hi I am trying to run my flutter app debug. I last opened this app on November 3rd week but Today when I build the app debug I am facing below exception. I've been told that bintray has been sunset, but confused as how to replace/update my gradle.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.onesignal:OneSignal:[3.11.2,3.99.99].
     Required by:
         project :app
      > Failed to list versions for com.onesignal:OneSignal.
         > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/onesignal/OneSignal/maven-metadata.xml.
            > Could not get resource 'https://google.bintray.com/exoplayer/com/onesignal/OneSignal/maven-metadata.xml'.
               > Could not GET 'https://google.bintray.com/exoplayer/com/onesignal/OneSignal/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

* 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 18s
Exception: Gradle task assembleDebug failed with exit code 1

Environment

These are my Flutter and Dart Versions:

  • Flutter 1.17.5
  • Dart Dart 2.8.4

OneSignal Plugin

onesignal_flutter: ^2.6.4

Anything else:

Distribution URL in gradle.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

Project Level Gradle:

buildscript {
    repositories {
        google()
        mavenCentral()
//        jcenter()
        maven {
           url 'https://maven.fabric.io/public'
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'
        classpath 'com.google.gms:google-services:3.2.1'   // new
        classpath 'io.fabric.tools:gradle:1.+'
    }

    // #jf1dt support multidex + androidX
    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                        && !details.requested.name.contains('multidex') ) {
                    details.useVersion "27.1.1"
                }

                if (details.requested.group == 'androidx.core'
                        && !details.requested.name.contains('androidx') ) {
                    details.useVersion "1.0.1"
                }
            }
        }
    }
}

allprojects {
    repositories {
        mavenCentral()
        google()
//        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

flutter pub deps

Dart SDK 2.8.4
Flutter SDK 1.17.5
payaxe_ewallet 1.0.0+1
|-- camera 0.5.8+17
|   '-- flutter...
|-- carousel_slider 1.4.1
|   '-- flutter...
|-- connectivity 0.4.9+5
|   |-- connectivity_for_web 0.3.1+4
|   |   |-- connectivity_platform_interface...
|   |   |-- flutter...
|   |   '-- flutter_web_plugins...
|   |-- connectivity_macos 0.1.0+7
|   |   '-- flutter...
|   |-- connectivity_platform_interface 1.0.6
|   |   |-- flutter...
|   |   |-- meta...
|   |   '-- plugin_platform_interface...
|   |-- flutter...
|   '-- meta...
|-- contacts_service 0.3.10
|   |-- collection...
|   |-- flutter...
|   '-- quiver 2.1.3
|       |-- matcher...
|       '-- meta...
|-- country_pickers 1.3.0
|   '-- flutter...
|-- crypto 2.1.4
|   |-- collection...
|   |-- convert...
|   '-- typed_data...
|-- cupertino_icons 0.1.3
|-- device_info 0.4.2+10
|   |-- device_info_platform_interface 1.0.1
|   |   |-- flutter...
|   |   |-- meta...
|   |   '-- plugin_platform_interface...
|   '-- flutter...
|-- diacritic 0.1.1
|-- encrypt 3.3.1
|   |-- args 1.6.0
|   |-- asn1lib 0.5.15
|   |-- clock 1.0.1
|   |   '-- meta...
|   |-- collection...
|   |-- crypto...
|   '-- pointycastle 1.0.2
|-- equatable 0.1.10
|-- flushbar 1.10.4
|   '-- flutter...
|-- flutter 0.0.0
|   |-- collection 1.14.12
|   |-- meta 1.1.8
|   |-- sky_engine 0.0.99
|   |-- typed_data 1.1.6
|   '-- vector_math 2.0.8
|-- flutter_appcenter_bundle 1.1.0+1
|   '-- flutter...
|-- flutter_crashlytics 1.0.0
|   |-- flutter...
|   '-- stack_trace 1.9.3
|       '-- path...
|-- flutter_masked_text 0.8.0
|   '-- flutter...
|-- flutter_money_formatter 0.8.3
|   |-- flutter...
|   '-- intl...
|-- flutter_secure_storage 3.3.3
|   |-- flutter...
|   '-- meta...
|-- flutter_test 0.0.0
|   |-- archive...
|   |-- args...
|   |-- async...
|   |-- boolean_selector 2.0.0
|   |   |-- source_span...
|   |   '-- string_scanner...
|   |-- charcode 1.1.3
|   |-- collection...
|   |-- convert...
|   |-- crypto...
|   |-- flutter...
|   |-- image...
|   |-- matcher 0.12.6
|   |   '-- stack_trace...
|   |-- meta...
|   |-- path...
|   |-- petitparser 2.4.0
|   |   '-- meta...
|   |-- quiver...
|   |-- source_span 1.7.0
|   |   |-- charcode...
|   |   |-- collection...
|   |   |-- meta...
|   |   |-- path...
|   |   '-- term_glyph...
|   |-- stack_trace...
|   |-- stream_channel...
|   |-- string_scanner 1.0.5
|   |   |-- charcode...
|   |   |-- meta...
|   |   '-- source_span...
|   |-- term_glyph 1.1.0
|   |-- test_api 0.2.15
|   |   |-- async...
|   |   |-- boolean_selector...
|   |   |-- collection...
|   |   |-- matcher...
|   |   |-- meta...
|   |   |-- path...
|   |   |-- source_span...
|   |   |-- stack_trace...
|   |   |-- stream_channel...
|   |   |-- string_scanner...
|   |   '-- term_glyph...
|   |-- typed_data...
|   |-- vector_math...
|   '-- xml...
|-- font_awesome_flutter 8.12.0
|   '-- flutter...
|-- global_configuration 0.1.4
|   |-- flutter...
|   '-- http...
|-- http 0.12.2
|   |-- http_parser 3.1.4
|   |   |-- charcode...
|   |   |-- collection...
|   |   |-- source_span...
|   |   |-- string_scanner...
|   |   '-- typed_data...
|   |-- path 1.6.4
|   '-- pedantic 1.9.0
|-- iban 0.1.1
|   '-- mod97 0.1.0
|-- image 2.1.12
|   |-- archive 2.0.13
|   |   |-- args...
|   |   |-- crypto...
|   |   '-- path...
|   '-- xml 3.6.1
|       |-- collection...
|       |-- convert...
|       |-- meta...
|       '-- petitparser...
|-- image_picker 0.6.7+22
|   |-- flutter...
|   |-- flutter_plugin_android_lifecycle 1.0.11
|   |   '-- flutter...
|   '-- image_picker_platform_interface 1.1.6
|       |-- flutter...
|       |-- http...
|       |-- meta...
|       '-- plugin_platform_interface 1.0.3
|           '-- meta...
|-- intl 0.15.8
|   '-- path...
|-- introduction_screen 1.0.9
|   |-- dots_indicator 1.2.0
|   |   '-- flutter...
|   '-- flutter...
|-- local_auth 0.4.0+1
|   |-- flutter...
|   |-- intl...
|   '-- meta...
|-- logger 0.7.0+2
|-- mask_text_input_formatter 1.2.1
|   '-- flutter...
|-- onesignal_flutter 2.6.4
|   '-- flutter...
|-- package_info 0.4.3+4
|   '-- flutter...
|-- path_provider 0.5.0+1
|   '-- flutter...
|-- permission_handler 3.3.0
|   |-- flutter...
|   '-- meta...
|-- rxdart 0.22.6
|-- shared_preferences 0.5.12+4
|   |-- flutter...
|   |-- meta...
|   |-- shared_preferences_linux 0.0.2+4
|   |   |-- file 5.2.1
|   |   |   |-- intl...
|   |   |   |-- meta...
|   |   |   '-- path...
|   |   |-- flutter...
|   |   |-- meta...
|   |   |-- path...
|   |   |-- path_provider_linux 0.0.1+2
|   |   |   |-- flutter...
|   |   |   |-- path...
|   |   |   |-- path_provider_platform_interface...
|   |   |   '-- xdg_directories 0.1.0
|   |   |       |-- flutter...
|   |   |       |-- path...
|   |   |       '-- process 3.0.13
|   |   |           |-- file...
|   |   |           |-- intl...
|   |   |           |-- meta...
|   |   |           |-- path...
|   |   |           '-- platform...
|   |   '-- shared_preferences_platform_interface...
|   |-- shared_preferences_macos 0.0.1+11
|   |   |-- flutter...
|   |   '-- shared_preferences_platform_interface...
|   |-- shared_preferences_platform_interface 1.0.4
|   |   |-- flutter...
|   |   '-- meta...
|   |-- shared_preferences_web 0.1.2+7
|   |   |-- flutter...
|   |   |-- flutter_web_plugins 0.0.0
|   |   |   |-- collection...
|   |   |   |-- flutter...
|   |   |   |-- meta...
|   |   |   |-- typed_data...
|   |   |   '-- vector_math...
|   |   |-- meta...
|   |   '-- shared_preferences_platform_interface...
|   '-- shared_preferences_windows 0.0.2+3
|       |-- file...
|       |-- flutter...
|       |-- meta...
|       |-- path...
|       |-- path_provider_platform_interface 1.0.4
|       |   |-- flutter...
|       |   |-- meta...
|       |   |-- platform 2.2.1
|       |   '-- plugin_platform_interface...
|       |-- path_provider_windows 0.0.4+3
|       |   |-- ffi 0.1.3
|       |   |-- flutter...
|       |   |-- meta...
|       |   |-- path...
|       |   |-- path_provider_platform_interface...
|       |   '-- win32 1.7.4+1
|       |       '-- ffi...
|       '-- shared_preferences_platform_interface...
|-- tutorial_coach_mark 0.3.0
|   '-- flutter...
|-- url_launcher 5.7.6
|   |-- flutter...
|   |-- url_launcher_linux 0.0.1+4
|   |   '-- flutter...
|   |-- url_launcher_macos 0.0.1+9
|   |   '-- flutter...
|   |-- url_launcher_platform_interface 1.0.8
|   |   |-- flutter...
|   |   |-- meta...
|   |   '-- plugin_platform_interface...
|   |-- url_launcher_web 0.1.4+1
|   |   |-- flutter...
|   |   |-- flutter_web_plugins...
|   |   |-- meta...
|   |   '-- url_launcher_platform_interface...
|   '-- url_launcher_windows 0.0.1+3
|       '-- flutter...
|-- uuid 2.2.2
|   |-- convert 2.1.1
|   |   |-- charcode...
|   |   '-- typed_data...
|   '-- crypto...
|-- validators 2.0.0+1
|-- video_player 0.5.2
|   |-- flutter...
|   '-- meta...
'-- web_socket_channel 1.1.0
    |-- async 2.4.1
    |   '-- collection...
    |-- crypto...
    '-- stream_channel 2.0.0
        '-- async...

(crash stacktraces, as well as any other information here)

@jkasten2
Copy link
Member

@Davete0302 I see /exoplayer/ in the URL it has an issue trying to get, do you have that plugin in your app? Please run flutter pub deps and share incase any other plugins include it.

I recommend searching through your project directory to make sure that no build.gradle file has jcenter(), as this is the most common cause for why bintray.com is trying to be accessed.

@Davete0302
Copy link
Author

Davete0302 commented Dec 14, 2021

@jkasten2 Updated to include pub deps . After searching jcenter in scope level. I found several plugins that use jcenter. Do I replace this with mavenCentral() ?
Also no I don't have /exoplayer/ plugin in the app

@jkasten2
Copy link
Member

@Davete0302 Yes as a work around for now you should be able to replace jcenter() with mavenCentral() in all your build.gradle files. Almost all libraries hosted on jcenter are also on Maven Central. OneSignal will be making an update to remove all jcenter() references soon as well.

@mnorhamizan
Copy link

mnorhamizan commented Dec 14, 2021

I have the same problem. We're using mavenCentral() and it's giving build errors when trying to build for debug or release.

Using version 2.6.4 on Flutter 1.22.6

FAILURE: Build failed with an exception.



* What went wrong:

Execution failed for task ':app:mergeDevProfileAssets'.

> Could not resolve all files for configuration ':app:devProfileRuntimeClasspath'.

   > Could not resolve com.google.android.gms:play-services-location:[15.0.0, 16.0.0).

     Required by:

         project :app > project :onesignal_flutter > com.onesignal:OneSignal:3.15.7

      > Failed to list versions for com.google.android.gms:play-services-location.

         > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml.

            > Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'.

               > Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway



* 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 1m 11s

Running Gradle task 'assembleDevProfile'...                        71.6s
Gradle task assembleDevProfile failed with exit code 1

@Davete0302
Copy link
Author

Davete0302 commented Dec 15, 2021

@jkasten2 I replaced jcenter() with mavenCentral() in onesignal_flutter build.gradle but the issue still persists. Tried removing one signal plugin and app built successfully, so I think this is a one signal issue. Also followed steps to upgrade at: OneSignal/OneSignal-Android-SDK#1293. Unfortunately the steps have not resolved the issues.

One signal build.gradle for details

group 'com.onesignal.flutter'
version '2.6.3'

buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
    }
}

rootProject.allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28

    defaultConfig {
        minSdkVersion 16
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    lintOptions {
        disable 'InvalidPackage'
    }
}

dependencies {
    api 'com.onesignal:OneSignal:3.16.0'
}

// Adds required manifestPlaceholders keys to allow mainifest merge gradle step to complete
// The OneSignal app id should be set in your JS code.
// Google project number / FCM Sender ID will be pulled in from the OneSignal dashbaord
class DefaultManifestPlaceHolders {
    static final MANIFEST_PLACEHOLDERS_DEFAULTS = [
        onesignal_app_id: '${onesignal_app_id}',
        onesignal_google_project_number: '${onesignal_google_project_number}'
    ]

    static void addManifestToAppProject(Project proj) {
        def androidApp = proj.android
        MANIFEST_PLACEHOLDERS_DEFAULTS.each { defKey, defValue ->
            if (!androidApp.defaultConfig.manifestPlaceholders.containsKey(defKey)) {
                androidApp.defaultConfig.manifestPlaceholders[defKey] = defValue

                androidApp.buildTypes.each { buildType ->
                    if (!buildType.manifestPlaceholders.containsKey(defKey))
                        buildType.manifestPlaceholders[defKey] = defValue
                }
            }
        }
    }
}

rootProject.childProjects.each { projName, proj ->
    if (projName != 'app' && projName != 'onesignal_flutter')
        return

    if (proj.hasProperty('android')) {
        DefaultManifestPlaceHolders.addManifestToAppProject(proj)
        return
    }

    proj.afterEvaluate {
        DefaultManifestPlaceHolders.addManifestToAppProject(proj)
    }
}

@Davete0302 Yes as a work around for now you should be able to replace jcenter() with mavenCentral() in all your build.gradle files. Almost all libraries hosted on jcenter are also on Maven Central. OneSignal will be making an update to remove all jcenter() references soon as well.

@greg-tt
Copy link

greg-tt commented Dec 15, 2021

@jkasten2 I know OneSignal will be making an update to remove all jcenter() references soon as well. Will you be applying that fix to the 2.2.0 flutter plugin version too? We've spent 5 months working on our current project and will use the newer version for future work but we'd be very grateful to be able to finish this work on 2.2.0.

@GJB93
Copy link

GJB93 commented Dec 16, 2021

This seems to be an issue with the plugin.gradle.org/m2 plugin portal more than anything. From what I can tell, it's still redirecting to bintray when trying to fetch some maven-metadata.xml files

@Klucherev
Copy link

Klucherev commented Dec 20, 2021

Same problem ((

@EjazAmir
Copy link

any solution?

@aryapujianto
Copy link

my temporary solution is add this project as submodule in your flutter project
git submodule add https://github.com/OneSignal/OneSignal-Flutter-SDK.git and checkout to version 2.6.4
change onesignal_flutter dependency in pubspect.yaml

onesignal_flutter:
    path: ./OneSignal-Flutter-SDK

replace file /OneSignal-Flutter-SDK/android/build.gradle
with this

group 'com.onesignal.flutter'
version '2.6.4'

buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://maven.google.com' }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.4'
    }
}

rootProject.allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://maven.google.com' }
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 30

    defaultConfig {
        minSdkVersion 21
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    lintOptions {
        disable 'InvalidPackage'
    }
}

dependencies {
    implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'
    implementation 'com.google.android.gms:play-services-base:16.0.0'
    api 'com.onesignal:OneSignal:3.16.0'
}

// Adds required manifestPlaceholders keys to allow mainifest merge gradle step to complete
// The OneSignal app id should be set in your JS code.
// Google project number / FCM Sender ID will be pulled in from the OneSignal dashbaord
class DefaultManifestPlaceHolders {
    static final MANIFEST_PLACEHOLDERS_DEFAULTS = [
        onesignal_app_id: '${onesignal_app_id}',
        onesignal_google_project_number: '${onesignal_google_project_number}'
    ]

    static void addManifestToAppProject(Project proj) {
        def androidApp = proj.android
        MANIFEST_PLACEHOLDERS_DEFAULTS.each { defKey, defValue ->
            if (!androidApp.defaultConfig.manifestPlaceholders.containsKey(defKey)) {
                androidApp.defaultConfig.manifestPlaceholders[defKey] = defValue

                androidApp.buildTypes.each { buildType ->
                    if (!buildType.manifestPlaceholders.containsKey(defKey))
                        buildType.manifestPlaceholders[defKey] = defValue
                }
            }
        }
    }
}

rootProject.childProjects.each { projName, proj ->
    if (projName != 'app' && projName != 'onesignal_flutter')
        return

    if (proj.hasProperty('android')) {
        DefaultManifestPlaceHolders.addManifestToAppProject(proj)
        return
    }

    proj.afterEvaluate {
        DefaultManifestPlaceHolders.addManifestToAppProject(proj)
    }
}

and change file yourproject/android/build.gradle

before dependencies { } add

configurations.all {
    resolutionStrategy {
        force 'com.google.android.gms:play-services-location:16.0.0'
    }
}

done!

note : make sure all jcenter() has been replaced with mavenCentral()

@walikhan226
Copy link

Its been two weeks and still the bintray issue is not fixed, what the fuck is wrong with Android support

@Thiyraash96
Copy link

Same issue man. Aiyo

@Danielcaja
Copy link

Danielcaja commented Jan 4, 2022

Hi, below as you can see, there's the build gradle at the project level, and it had two maven references, i just removed the one related to bintray leaving only the top one (https://plugins.gradle.org/m2/) and it worked for me.

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://plugins.gradle.org/m2/' }
        maven { url 'https://dl.bintray.com/android/android-tools' } // Remove this one
        mavenLocal()
    }

[...]

Using:

Flutter: 2.5.3
Dart: 2.14.4
onesignal_flutter: ^3.2.7

@jkasten2
Copy link
Member

This is now fixed and is part of the OneSignal-Flutter-SDK 3.2.8 Release.

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

No branches or pull requests