Android Studio 您的位置:首页>>>>>>>>>>

aoyhnmkz  于 2022-11-16  发布在  Android
关注(0)|答案(4)|浏览(130)

此问题在此处已有答案

JCenter deprecation; impact on Gradle and Android(共10个答案)
15天前关闭。
此帖子已在11天前编辑并提交审核,未能重新打开:
原始关闭原因未解决
我昨天创建了build,它运行得很好。但是当我今天尝试创建发布build时,我得到了这个。一些问题已经在这里提出了

这些问题是专门为android和新用户的React不能理解他们容易。所以这就是为什么我问另一个问题在这里专门为React原生用户。
我上面提到的问题有答案,在一些特定的情况下有帮助,但当它在某些情况下对本地做出React时,它没有帮助,比如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

我认为这个问题是由于jcenter的不赞成。任何可能的解决方案或jcenter的替代方案。这是特定的React原生项目,其中有许多依赖关系,你必须改变。

ocebsuys

ocebsuys1#

经过几个小时的研究,最终发现这是由于jcenter关闭造成的问题。根据x1e0 f1.和Bintray/JCenter users should start migrating to a new hosting solution.,此问题的解决方案是从build file中删除jcenter,并将其替换为

mavenCentral() // <- add it

对于react-native用户,jcenter()可能存在于您最近安装的某些dependency中。要检查jcenter,请在android-studio中打开您的项目,以轻松检查所有build.gradle文件。
另一个解决方案是断开您的系统从互联网和建立您的项目。在您lanuc您的项目重新连接您的系统到互联网。

ikfrs5lh

ikfrs5lh2#

jcenter宕机了,所以在它上线之前,一个临时的解决方案只是断开互联网并构建你的项目,一旦构建完成,应用程序启动,你就可以重新连接。

ifmq2ha2

ifmq2ha23#

问题来自于jcenter.event的关闭。如果你删除了你的应用程序的存储库,如果你的一些声明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())
                }
            }
        }
...

这修复了我所有的构建。

gtlvzcf8

gtlvzcf84#

来自@PhilippeAuriach的解决方案正在为react-native修复它!我添加了以下内容:

allprojects {
repositories {
    all { ArtifactRepository repo ->
        if (repo instanceof MavenArtifactRepository) {
            if (repo.url.toString().startsWith('https://jcenter.bintray.com/')) {
                remove repo
                add(mavenCentral())
            }
        }
    }

我的android/build.gradle,经过几个小时的研究后,我的工作很好!(感谢@PhilippeAuriach)

相关问题