简体   繁体   English

找不到manifest-merger.jar(com.android.tools.build:manifest-merger:26.0.1)

[英]Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.0.1)

I have a unity project I am exporting that project as android studio project while opening the android studio project I am getting this error 我有一个团结项目我将这个项目导出为android studio项目,同时打开android studio项目我收到此错误

Gradle sync failed: Could not find manifest-merger.jar
    (com.android.tools.build:manifest-merger:26.0.1).
    Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/build/manifest-merger/26.0.1/manifest-merger-26.0.1.jar

I have a few old exported project that was working fine before but today they are also giving the same error. 我有一些旧的导出项目,以前工作正常,但今天他们也给出了同样的错误。

I finally fixed the issue. 我终于解决了这个问题。 This may be a workaround but it works. 这可能是一种解决方法,但它有效。 So if anyone having this issue, just follow this: 因此,如果有人遇到此问题,请按照以下步骤操作

  1. Swap the position of jcenter() and google() in project gradle file and in also all the other module you have in your project. 在项目gradle文件中以及项目中的所有其他模块中交换jcenter()google()的位置。 Like in mine I have crashlytics , fabric so just remember to make the changes in their build.gradle file as well: 像我的一样,我有crashlyticsfabric所以只记得在他们的build.gradle文件中进行更改:

     buildscript { repositories { jcenter() google() } } 

    to

     buildscript { repositories { google() jcenter() } } 
  2. Before building your project again go to your project folder and delete the .gradle folder from your project and then build your project. 在再次构建项目之前,请转到项目文件夹并从项目中删除.gradle文件夹,然后构建项目。

  1. Go to Publishing Settings/Build, enable Custom Gradle Template 转到发布设置/构建,启用自定义Gradle模板
  2. Go to Assets/Plugins/Android/mainTemplate.gradle and change the postion from 转到Assets / Plugins / Android / mainTemplate.gradle并更改位置
  buildscript {
    repositories {
        jcenter()
        google()
}

to


 buildscript {
   repositories {
      google()
      jcenter()
}
  1. Remove gradle cache and rebuild. 删除gradle缓存并重建。 For Mac you can run rm -rf $HOME/.gradle/caches/ in terminal. 对于Mac,您可以在终端中运行rm -rf $ HOME / .gradle / caches /。

Jcenter no longer hosts google dependencies, these can be resolved from " https://maven.google.com " so you can simply add that to the resolvers list along with jcenter. Jcenter不再托管谷歌依赖项,这些可以通过“ https://maven.google.com ”解决,因此您只需将其与jcenter一起添加到解析器列表即可。

Regards, Itamar 此致,Itamar

The problem is definitely having jcenter() above google() . 问题是肯定在jcenter()之上有jcenter() google() However for me, my build.gradle was correct. 但对我来说,我的build.gradle是正确的。 The problem happened because of one of my dependencies library had that problem. 问题发生是因为我的一个依赖库有这个问题。 The problem seemingly started happening out of nowhere, probably because my jar was cached. 这个问题似乎从无处发生,可能是因为我的罐子被缓存了。

I solved the problem by upgrading my problematic library to latest version as that contained a fix. 我通过将有问题的库升级到包含修复的最新版本来解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM