Eng*_*faq 19 android maven-central android-studio jcenter react-native
我昨天创建了 build 并且运行良好。但是当我今天尝试创建发布版本时,我得到了这个。一些如果这里已经问过的问题
这些问题是针对 android 的,react-native 的新用户无法轻松理解它们。这就是为什么我在这里问另一个专门针对反应本机用户的问题。
我上面提到的问题的答案在某些特定情况下会有所帮助,但是当涉及到在某些情况下进行本机反应时,它确实没有帮助,例如对于 node_modules 中的某些依赖项。
添加上述说明是因为该问题被标记为重复。
构建将继续,但强烈建议您更新项目以使用已使用compileSdk = 33进行测试的较新的Android Gradle插件
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':react-native-community_masked-view:verifyReleaseResources'.
> Could not resolve all task dependencies for configuration ':react-native-community_masked-view:releaseRuntimeClasspath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-community_masked-view
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
> Read timed out
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 45s
5 actionable tasks: 5 up-to-date
Run Code Online (Sandbox Code Playgroud)
我认为这个问题是由于 jcenter deprecation 造成的。jcenter 的任何可能的解决方案或替代方案。这是特定于react-native项目的,其中有很多依赖项,你必须更改。
Eng*_*faq 15
经过数小时的研究,终于发现了这一点。这是由于 jcenter 已关闭而导致的问题。根据官方文档, jcenter 已被废弃,Bintray/JCenter users should start migrating to a new hosting solution.
解决方案是删除 jcenterbuild file并将其替换为
mavenCentral() // <- add it
Run Code Online (Sandbox Code Playgroud)
对于反应本机用户来说,jcenter()可能存在您最近安装的某些依赖项。要检查 jcenter,请打开您的项目android-studio以轻松检查所有build.gradle文件。
另一个解决方案是断开系统与互联网的连接并构建项目。启动项目后,将系统重新连接到互联网。
问题来自于jcenter的关闭。如果您删除应用程序的存储库,如果您的某些声明jcenter().
最好的方法是合并 PR 并更新这些依赖项的版本,但这可能需要一段时间。
同时,您可以在您的 中添加以下内容android/build.gradle:
allprojects {
repositories {
all { ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
if (repo.url.toString().startsWith('https://jcenter.bintray.com/')) {
remove repo
add(mavenCentral())
}
}
}
...
Run Code Online (Sandbox Code Playgroud)
这修复了我所有的构建。
@PhilippeAuriach 的解决方案正在修复它的反应本机!我添加了这个:
allprojects {
repositories {
all { ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
if (repo.url.toString().startsWith('https://jcenter.bintray.com/')) {
remove repo
add(mavenCentral())
}
}
}
Run Code Online (Sandbox Code Playgroud)
对于我的android/build.gradle,经过几个小时的研究后工作得很好!(感谢@PhilippeAuriach)
| 归档时间: |
|
| 查看次数: |
4129 次 |
| 最近记录: |