Bintray 502 bad gateway in android Studio

4.8k views Asked by At

I'm using maven { url "http://dl.bintray.com/populov/maven" } in my project-level build.gradle file. Since bintray is shutdown, what can be the replacement of this repo?

Could not resolve androidx.room:room-compiler:2.2.4. > Could not get resource 'http://dl.bintray.com/populov/maven/androidx/room/room-compiler/2.2.4/room-compiler-2.2.4.pom'. > Could not HEAD 'http://dl.bintray.com/populov/maven/androidx/room/room-compiler/2.2.4/room-compiler-2.2.4.pom'. Received status code 502 from server: Bad Gateway

4

There are 4 answers

2
Amit Kundu On

Until you find a valid replacement you can turn on Gradle Offline sync. Go to Gradle -> Toggle Offline Mode

enter image description here

0
ebrahim hassan On

if you have a lot of node module which needed to be updated you can do this solution

yarn add -D replace-in-file

const replaceInFiles = require('replace-in-file');
const options = {
  // See more: https://www.npmjs.com/package/globby
  // Single file or glob
  //   node_modules/react-native-pdf/android/build.gradle
  files: './node_modules/**/android/build.gradle',
  // See more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
  // Replacement
  from: /jcenter\(\)/g, // string or regex
  to: 'mavenCentral()', // string or fn  (fn: carrying last argument - path to replaced file)

  // See more: https://www.npmjs.com/package/glob
  optionsForFiles: {
    // default
    ignore: [],
  },
  saveOldFile: false,
  encoding: 'utf8',

  shouldSkipBinaryFiles: true, // default
  onlyFindPathsWithoutReplace: false,
  returnPaths: true,
  returnCountOfMatchesByPaths: true,
};
replaceInFiles(options)
  .then(({ changedFiles, countOfMatchesByPaths }) => {
    console.log('Modified files:', changedFiles);
    console.log('Count of matches by paths:', countOfMatchesByPaths);
    console.log('was called with:', options);
  })
  .catch((error) => {
    console.error('Error occurred:', error);
  });
and add this line into package.json scripts

    "postinstall": "node fix-jcenter.js"
0
Gevorg Sahakyan On

it's a global outage in JCenter. You can monitor status here https://status.gradle.com it replaces bintray status page which seems is now fully sunset and returns 502 error.

JCenter is now back online, systems are fully operational.

1
Cesar Balzer On

It worked like this here:

Update your android/build.gradle file and change where you have jcenter() to mavenCentral().

In my case I had to update the flipper version in android/gradle.properties FLIPPER_VERSION=0.54.0 to FLIPPER_VERSION=0.93.0.

Now it's back to building for android.