我在我的專案級 build.gradle 檔案中使用 maven { url "http://dl.bintray.com/populov/maven" }。由于 bintray 已關閉,這個 repo 的替代品是什么?
無法決議 androidx.room:room-compiler:2.2.4。> 無法獲取資源“http://dl.bintray.com/populov/maven/androidx/room/room-compiler/2.2.4/room-compiler-2.2.4.pom”。> 無法 HEAD 'http://dl.bintray.com/populov/maven/androidx/room/room-compiler/2.2.4/room-compiler-2.2.4.pom'。從服務器收到狀態碼 502:Bad Gateway
uj5u.com熱心網友回復:
在找到有效的替代品之前,您可以打開 Gradle 離線同步。轉到 Gradle -> 切換離線模式

uj5u.com熱心網友回復:
如果您有很多需要更新的節點模塊,您可以執行此解決方案
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);
});
并將這一行添加到 package.json 腳本中
"postinstall": "node fix-jcenter.js"
uj5u.com熱心網友回復:
這是因為 Bintray 日落。請閱讀此博客https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
更新:Jcenter 仍將繼續是只讀的,它似乎已關閉但現在備份可訪問
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/409531.html
標籤:
