Ionic 3 产品发布构建问题与 intellij-core-26.0.1
Ionic 3 prod release build issue with intellij-core-26.0.1
我正在使用以下版本创建发布 APK:
节点 - 8.12.0
gradle - 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" URL 时,其显示状态为 404。
任何人,请建议
转到platforms/android/build.gradle
改变这个:
jcenter()
maven {
url "https://maven.google.com"
}
至
maven {
url "https://maven.google.com"
}
jcenter() //Just move this line
根据 Ruben Sala 的建议,这对我不起作用。但是,如果您编辑 platforms/android/CordovaLib/build.gradle
,并应用 Ruben 建议的相同修复方法,它会起作用。
即变化:
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
收件人:
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
ionic cordova 平台删除 android
ionic cordova 平台添加 android@7.0.0
将 platforms\android\CordovaLib\build 中的构建脚本部分从
更改为 gradle
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
至
repositories {
google()
jcenter()
}
为我解决了这个问题。 CLI 和 AS 现在构建良好。
我通过编辑 \platforms\android\build.gradle 文件(第 39 行)修复了这个问题:
// 允许插件通过 build-extras.gradle.
声明 Maven 依赖
allprojects {
repositories {
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
看来问题是今天提早出现的。
有几件事可以奏效:
对我有用的步骤是:
编辑“\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, as pointed by 'netexpo', here
allprojects {
repositories {
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
另一个:
由 MeterMoDev 发布here
Was able to build as well but did the following:
Closed Android Studio also had VS closed.
Removed the Android platform.
Add the Android platform again.
Before running any builds open up the \platforms\android\build.gradle and edit the repositories like @netexpo recommended, and save the file. Open up your project in Android Studio waited for studio do sync the gradle file, it downloaded a couple of items. After the sync process was completed the file had been build.
repositories {
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
如果有人在 CI(Jenkins/Travis) 中遇到问题,而不是每次都手动更改 build hook 会很方便
在 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. 我没有写完整的脚本,但修改它来解决这个问题
尝试
ionic cordova platform remove android
ionic cordova platform add android@latest
这对我来说最终起作用了。别无他法
ps。它安装了 android 7.1.4
我正在使用以下版本创建发布 APK: 节点 - 8.12.0 gradle - 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" URL 时,其显示状态为 404。
任何人,请建议
转到platforms/android/build.gradle
改变这个:
jcenter()
maven {
url "https://maven.google.com"
}
至
maven {
url "https://maven.google.com"
}
jcenter() //Just move this line
根据 Ruben Sala 的建议,这对我不起作用。但是,如果您编辑 platforms/android/CordovaLib/build.gradle
,并应用 Ruben 建议的相同修复方法,它会起作用。
即变化:
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
收件人:
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
ionic cordova 平台删除 android
ionic cordova 平台添加 android@7.0.0
将 platforms\android\CordovaLib\build 中的构建脚本部分从
更改为 gradlerepositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
至
repositories {
google()
jcenter()
}
为我解决了这个问题。 CLI 和 AS 现在构建良好。
我通过编辑 \platforms\android\build.gradle 文件(第 39 行)修复了这个问题: // 允许插件通过 build-extras.gradle.
声明 Maven 依赖 allprojects {
repositories {
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
看来问题是今天提早出现的。
有几件事可以奏效:
对我有用的步骤是:
编辑“\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, as pointed by 'netexpo', here
allprojects {
repositories {
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
另一个:
由 MeterMoDev 发布here
Was able to build as well but did the following:
Closed Android Studio also had VS closed. Removed the Android platform. Add the Android platform again. Before running any builds open up the \platforms\android\build.gradle and edit the repositories like @netexpo recommended, and save the file. Open up your project in Android Studio waited for studio do sync the gradle file, it downloaded a couple of items. After the sync process was completed the file had been build.
repositories {
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
如果有人在 CI(Jenkins/Travis) 中遇到问题,而不是每次都手动更改 build hook 会很方便
在 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. 我没有写完整的脚本,但修改它来解决这个问题
尝试
ionic cordova platform remove android
ionic cordova platform add android@latest
这对我来说最终起作用了。别无他法
ps。它安装了 android 7.1.4