以下是我在ionic 上安装cordova 的经验总结。请特别参阅mips64el-linux-android 错误部分。只需按照说明创建虚拟文件夹和子文件夹即可。
Cordova 希望看到到 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 安装经验。
• 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
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 准备安卓
构建 Cordova。
如果有错误删除platforms\android项目目录并重建。
如果在寻找 NDK 时出现 Gradle 错误 "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.
或者,下载旧版本(例如 https://developer.android.com/ndk/downloads/older_releases/android-ndk-r16b-windows-x86_64.zip)并将所需文件夹解压缩到与上述相同位置的新 ndk 文件夹中。
• Finally, once again enter
ionic 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
以上内容我花了两天时间才弄明白。希望它对您有所帮助并减轻您的头痛。