[英]Ionic 3 BUILD FAILED with Cordova: cordova\node_modules\cordova-common\src\superspawn.js:169:23
In Ionic 3 with Cordova when I give the command: 在带有Cordova的Ionic 3中,当我给出命令时:
ionic cordova run android --device
i have already installed and set the path in system environment 我已经在系统环境中安装并设置了路径
JDK SDK Node js JDK SDK节点js
I have researched a lot on the internet and I can not solve it. 我在互联网上进行了大量研究,但无法解决。 What can I be doing wrong?
我做错了什么?
Even formatting the computer already formatted. 甚至格式化已经格式化的计算机。 I do not know what to do.
我不知道该怎么办。 Neither messages from other forums with the "supposed" same error, did not work out.
来自其他论坛的带有“应该”相同错误的消息均未解决。
It gives me the following errors: 它给了我以下错误:
`E:\NAB\ionic\new\myApp>ionic cordova run android
Running app-scripts build: --platform android --target cordova
[12:54:42] build dev started ...
[12:54:43] clean started ...
[12:54:43] clean finished in 16 ms
[12:54:43] copy started ...
[12:54:44] deeplinks started ...
[12:54:44] deeplinks finished in 203 ms
[12:54:44] transpile started ...
[12:54:58] transpile finished in 14.50 s
[12:54:58] preprocess started ...
[12:54:58] preprocess finished in less than 1 ms
[12:54:59] webpack started ...
[12:54:59] copy finished in 15.94 s
[12:55:32] webpack finished in 33.82 s
[12:55:32] sass started ...
[12:55:38] sass finished in 5.26 s
[12:55:38] postprocess started ...
[12:55:38] postprocess finished in 78 ms
[12:55:38] lint started ...
[12:55:38] build dev finished in 55.31 s
> cordova run android
Android Studio project detected
ANDROID_HOME=C:\Users\Sohail Akbar\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_171
studio
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find gradle-core.jar (com.android.tools.build:gradle-core:3.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle-core/3.0.0/g
radle-core-3.0.0.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
[12:55:47] lint finished in 9.31 s
(node:2132) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with ex
it code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find gradle-core.jar (com.android.tools.build:gradle-core:3.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle-core/3.0.0/g
radle-core-3.0.0.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
at ChildProcess.whenDone (E:\NAB\ionic\new\myApp\platforms\android\cordova\n
ode_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:2132) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejection
id: 1)
(node:2132) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.`
thanks in advance 提前致谢
Sorry for my bad English, I will try my best to present the answer in easy way. 对不起,我的英语不好,我会尽力以简单的方式提出答案。
I just spend my two days and nights on solving the same issue and finally I found one. 我只花了两天两夜的时间来解决同一问题,最后找到了一个。
The main problem is with the Android-NDK. 主要问题在于Android-NDK。
Ionic framework is looking for mips64el-linux-android
package in the ndk-bundle
folder of Android SDK. Ionic框架正在Android SDK的
ndk-bundle
文件夹中寻找mips64el-linux-android
软件包。
If You visit Your Android-SDK
folder, You will find a folder with name ndk-bundle
, inside this open the folder name toolchains
You will see that toolchains
doesn't contains the package mips64el-linux-android
. 如果访问
Android-SDK
文件夹,则将找到一个名为ndk-bundle
的文件夹,在该文件夹中,将打开名为toolchains
的文件夹。您会看到该toolchains
不包含软件包mips64el-linux-android
。
You have to download it manually. 您必须手动下载。 You can download the latest version of
Android-NDK
here , but unfortunately this latest version doesn't contain the package we need. 您可以在此处下载最新版本的
Android-NDK
,但是很遗憾,该最新版本不包含我们所需的软件包。
At the bottom of this page You will find a link to download the older versions of Android-NDK
, follow that link and download Android NDK, Revision 14b (March 2017)
. 在此页面的底部,您将找到一个链接,用于下载较旧版本的
Android-NDK
,然后Android NDK, Revision 14b (March 2017)
该链接并下载Android NDK, Revision 14b (March 2017)
。 That's the NDK
version Ionic looking for. 那是Ionic寻找的
NDK
版本。 Now go to Your Android-SDK
path, then NDK-Bundle
and delete everything from that folder. 现在转到您的
Android-SDK
路径,然后转到NDK-Bundle
,然后从该文件夹中删除所有内容。 And extract the downloaded file in NDK-Bundle folder
, You will see the package mips64el-linux-android
. 并将下载的文件解压缩到
NDK-Bundle folder
,您将看到包mips64el-linux-android
。
Everything is good to go now. 现在一切都很好。 Hope so it will work.
希望它会起作用。
Below is a summation of my experience installing cordova on ionic-4 . 以下是我在ionic-4上安装cordova的经验总结。 See in particular the section on mips64el-linux-android error.
特别请参阅关于mips64el-linux-android错误的部分。 Just follow along and create the dummy folder and subfolders as explained.
只需按照说明创建虚拟文件夹和子文件夹即可。
Cordova expects to see the path to C:\\Users\\myusernamehere\\AppData\\Local\\Android\\Sdk\\ndk-bundle\\toolchains\\mips64el-linux-android-4.9\\prebuilt\\windows-x86_64\\bin\\mips64el-linux-android-strip
but does not require it (in my case) and will throw an error if absent. 科尔多瓦希望看到
C:\\Users\\myusernamehere\\AppData\\Local\\Android\\Sdk\\ndk-bundle\\toolchains\\mips64el-linux-android-4.9\\prebuilt\\windows-x86_64\\bin\\mips64el-linux-android-strip
但不需要(在我的情况下),如果不存在,将抛出错误。
Ionic Cordova Installation experience. Ionic Cordova安装经验。
• Re- install Java JDK 8 to the latest update.
• Add ANDROID_SDK_ROOT variable to point to existing installation of Android Studio SDK
• Add Java JDK\bin to the environment PATH variable on user and system
• Download Gradle 5.2 and create folder C:\Gradle and extract the contents inside. Your
The path should look like this
C:\\Gradle\\gradle-5.2\\bin\\gradle.bat
Add "C:\\Gradle\\gradle-5.2\\bin"
to PATH variable on System 将
"C:\\Gradle\\gradle-5.2\\bin"
到系统上的PATH变量
From the command line do the following .. 从命令行执行以下操作。
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
• Using a previously installed edition of Android Studio go to Tools => SDK Tools
And check the NDK checkbox for download, click apply and ok.
• In the project terminal - Enter
ionic cordova prepare android
离子科尔多瓦准备android
to build Cordova. 建立科尔多瓦。
If there are errors delete the platforms\\android
project directory and rebuild. 如果有错误,请删除
platforms\\android
项目目录并重建。
If there is a Gradle error looking for NDK "mips64el-linux-android-version"
如果有Gradle错误,则寻找NDK
"mips64el-linux-android-version"
Do the following ..
• Open the NDK bundle\toolchains folder within Android SDK eg C:\Users\Shay\AppData\Local\Android\sdk\ndk-bundle\toolchains
• And using command line create a folder "mips64el-linux-android-4.9" ( same version number (4.9) as other folders) inside create folder "prebuilt" .. then folder "windows-x86_64" and inside place and empty text file for contents.
The created path should look like .. "C:\Users\Shay\AppData\Local\Android\sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\dummy file" is not required by Cordova but is expected to be in its path .. otherwise it will throw an error and fail to build.
Alternatively, download an older build such as https://developer.android.com/ndk/downloads/older_releases/android-ndk-r16b-windows-x86_64.zip and extract the required folder to the new ndk folder in the same location as above. 或者,下载旧版本,例如https://developer.android.com/ndk/downloads/older_releases/android-ndk-r16b-windows-x86_64.zip,然后将所需的文件夹提取到新的ndk文件夹中,该文件夹与以上。
• Finally, once again enter
ionic cordova prepare android
离子科尔多瓦准备android
to build Cordova 建立科尔多瓦
The Ionic build order (as I observed it) is a follows ..
1. It looks for all the relevant Java and Android SDK paths ..
2. Then uses Gradle as the build system ..
3. Check for NDK bundle ..
4. Build project
The above took me two days to figure out. 以上花了我两天时间才弄清楚。 Hope it helps and saves you the headache.
希望它能帮助您,并且省去您的头痛。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.