【问题标题】:Android build miss intellijAndroid构建小姐intellij
【发布时间】:2018-10-23 09:49:11
【问题描述】:

从今天开始,由于这个错误,我无法构建我的 android 项目:

> Could not resolve all files for configuration ':classpath'.
   > Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar

Android 工作室 3.2.1 com.android.tools.build:gradle:3.0.1

你有什么线索吗??? 非常感谢

弗拉德

【问题讨论】:

标签: android-studio gradle build


【解决方案1】:

我在 cordova-android@7.1.1 项目中遇到了同样的问题。我读了这个问题Android Studio - Could not find intellij-core.jar 并通过加入多个答案来解决。

前提:

  • Android Studio 3.2.1
  • Cordova Android 7.1.1
  • 科尔多瓦 Cli 8.1.2

分辨率:

文件:platforms/android/build.gradle

...
buildscript {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
    dependencies {

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}
...

文件:platforms/android/app/build.gradle

...
buildscript {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}
...

文件:platforms/android/CordovaLib/build.gradle

...
buildscript {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
    }
}
...

此解决方案对我有用,希望对您有所帮助

【讨论】:

  • 任何熟悉插件/挂钩的人,因为我的问题出在我的 CI 服务器上?
  • 我认为为这个问题写一个钩子是非常昂贵的。已经有一个拉取请求来解决这个问题github.com/apache/cordova-android/pull/525。我们希望他们能尽快发布更新。
【解决方案2】:

我也有同样的问题,换成classpath 'com.android.tools.build:gradle:3.1.0'解决我的问题。你可以试试看。

【讨论】:

    【解决方案3】:

    这个答案很大程度上基于 ionic 文章:https://ionic.zendesk.com/hc/en-us/articles/360005529314

    此脚本可以添加到挂钩中,因此无需手动修改平台代码。

    使用以下内容创建maven_swap.sh

    #!/bin/bash
    
    #remove jcenter
    sed -i.bak '/jcenter()/d' platforms/android/CordovaLib/build.gradle
    #append jcenter
    sed -i.bak  '/maven {/{
    N
    N
    a\
    jcenter()
    }' platforms/android/CordovaLib/build.gradle
    cat platforms/android/CordovaLib/build.gradle
    rm platforms/android/CordovaLib/build.gradle.bak
    

    注意:sed -i.bak 确保 linux 和 mac 兼容性。

    确保文件是可执行的chmod +x maven_swap.sh

    config.xml中添加以下内容:

    <platform name="android">
        <hook src="maven_swap.sh" type="before_compile" />
        ...
    </platform>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-27
      • 2011-06-26
      • 2016-07-18
      相关资源
      最近更新 更多