【问题标题】:Ionic 3 prod release build issue with intellij-core-26.0.1intellij-core-26.0.1 的 Ionic 3 prod 发布构建问题
【发布时间】:2019-03-27 14:58:48
【问题描述】:

我正在使用以下版本创建发布 APK: 节点 - 8.12.0 毕业 - 4.10.2 离子 CLI - 4.0.5 科尔多瓦 - 8.0.0

当我运行时

ionic cordova build android --prod --release

我收到以下错误。

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib: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

当我将“intellij-core-26.0.1”网址放在浏览器中时,它的显示状态为 404。

请大家推荐

【问题讨论】:

  • 尝试从android studio构建发布apk。
  • @Naveen 我正在构建这个 APK 作为 jenkins JOB 的一部分。我需要解决詹金斯的工作
  • 今天开始发生在我身上!必须是最近的更改。
  • @keldar 是的,我今天收到了这个错误。但我没有找到任何解决方案
  • 似乎还没有解决方案。问题似乎是articfactory 更新了新版本...但新版本缺少 jar 文件..missing jar file

标签: android ionic-framework ionic2 ionic3 hybrid-mobile-app


【解决方案1】:

ionic cordova 平台移除 android

ionic cordova 平台添加android@7.0.0

【讨论】:

  • 这是唯一对我有用的解决方案,谢谢!
  • 我同意这是唯一对我有用的解决方案..谢谢
【解决方案2】:

看来问题今天很早就开始了。

有几件事可以奏效:

对我有用的步骤是:

编辑 "\platforms\android\CordovaLib\build.gradle" 代替 "\platforms\android\build.gradle" 并将 jcenter() 放在 maven... 之后发布here

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

你可以试试:

编辑“platforms/android/build.gradle”,您可以在 Ionic 论坛中看到更多 here,正如“netexpo”所指出的,here

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

另一个:

MeterMoDev 发布 here

也能够构建,但执行了以下操作:

关闭 Android Studio 也关闭了 VS。 移除了安卓平台。 再次添加Android平台。 在运行任何构建之前,打开 \platforms\android\build.gradle 并像@netexpo 推荐的那样编辑存储库,然后保存文件。在 Android Studio 中打开你的项目,等待工作室同步 gradle 文件,它下载了几个项目。同步过程完成后,文件已构建。

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

【讨论】:

    【解决方案3】:

    转到platforms/android/build.gradle

    改变这个:

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

    maven {
       url "https://maven.google.com"
    }
    jcenter()  //Just move this line  
    

    【讨论】:

    • 这在离子构建过程中是不可能的,因为我们在每个构建过程中都会生成这个文件
    • 我的build.gradle 文件已经是这样了(底部有jcenter()),但仍然无法使用
    • 这不起作用,但是如果您编辑platforms/android/CordovaLib/build.gradle 并应用@RubenSala 上面建议的修复,它会起作用。它对我有用:)
    【解决方案4】:

    按照鲁​​本萨拉的建议,这对我不起作用。但是,如果您编辑 platforms/android/CordovaLib/build.gradle,并应用 Ruben 建议的相同修复程序,它确实可以。

    即改变:

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

    收件人:

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

    【讨论】:

    【解决方案5】:

    更改platforms\android\CordovaLib\build.gradle 中的 buildscript 部分
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
    

    repositories {
        google()
        jcenter()
    }
    

    为我解决了这个问题。 CLI 和 AS 现在构建良好。

    【讨论】:

      【解决方案6】:

      我通过编辑 \platforms\android\build.gradle 文件(第 39 行)来修复它: // 允许插件通过 build-extras.gradle 声明 Maven 依赖。

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

      【讨论】:

        【解决方案7】:

        如果有人在 CI(Jenkins/Travis) 中遇到问题,而不是每次构建挂钩都进行手动更改会很方便 ?

        config\before_compile_android.js创建文件

        module.exports = function(ctx) {
            'use strict';
            var fs = ctx.requireCordovaModule('fs'),
                path = ctx.requireCordovaModule('path'),
                deferral = ctx.requireCordovaModule('q').defer(),
                async = require('async');
            var platformRoot = path.join(ctx.opts.projectRoot, 'platforms/android');
            var gradleFiles = [path.join(platformRoot, 'build.gradle'), path.join(platformRoot, 'CordovaLib', 'build.gradle')];
            async.each(gradleFiles, function(f, cb) {
                fs.readFile(f, 'utf8', function(err, data) {
                    if (err) {
                        cb(err);
                        return;
                    }
                    var result = data;
                    if (data.indexOf("maven.google.com") >= 0) {
                        console.log("Mirror already present in gradle file.\nSkipping...");
                    }else{
                        result = data.replace(/jcenter\(\)/g, 'maven{url "https://maven.google.com"}\njcenter()');
                    }
                    fs.writeFile(f, result, 'utf8', cb);
                });
            }, function(err) {
                if (err) {
                    deferral.reject();
                } else {
                    deferral.resolve();
                }
        
            });
            return deferral.promise;
        }
        

        并在config.xml 中为before_compile 配置它

        <platform name="android">
           <hook src="config/before_compile_android.js" type="before_compile" />
        ...
        

        p.s.我还没有写完整的脚本,但是修改它来解决这个问题

        【讨论】:

          【解决方案8】:

          试试

          ionic cordova platform remove android
          ionic cordova platform add android@latest
          

          这对我来说最终起作用了。没有其他方法可以解决问题

          ps。它安装了android 7.1.4

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2019-11-15
            • 2018-04-16
            • 1970-01-01
            • 1970-01-01
            • 2018-10-23
            • 1970-01-01
            • 2018-11-15
            • 2018-05-12
            相关资源
            最近更新 更多