简体   繁体   English

Cordova CLI:CPU架构不匹配

[英]Cordova CLI: Mismatch of CPU architecture

I've been searching through CLI docs, SO questions, Cordova issues and more for quite some time, but I'm stumped. 我一直在搜索CLI文档,SO问题,Cordova问题等等,但我很难过。

So I've created a simple Cordova app for Android using Crosswalk ( cordova create , cordova platform add android , cordova plugin add cordova-plugin-crosswalk-webview , cordova build android , nothing fancy). 所以我使用Crosswalk创建了一个简单的Cordova Android应用程序( cordova createcordova platform add androidcordova plugin add cordova-plugin-crosswalk-webviewcordova build android ,没有什么花哨的)。 This, by default, generates a bunch of apk's on cordova build which is fine. 默认情况下,这会在cordova build生成一堆apk,这很好。

But then cordova run android --device installs the arm64 apk which crashes at startup on my device with the message Mismatch of CPU Architecture - with a button to the store to GET CROSSWALK - which is not what I want. 然后cordova run android --device安装arm64 apk在我的设备启动时崩溃与消息Mismatch of CPU Architecture - 与商店的按钮GET CROSSWALK - 这不是我想要的。

I'd like to instruct cordova run android --device to install and run the armv7 apk, which runs perfectly fine if installed manually via adb install . 我想指示cordova run android --device来安装和运行armv7 apk,如果通过adb install手动adb install ,它运行完全正常。 How can I do this? 我怎样才能做到这一点?

  • cordova v8.0.0 cordova v8.0.0
  • cordova-android v7.0.0 cordova-android v7.0.0
  • cordova-plugin-crosswalk-webview v2.4.0 cordova-plugin-crosswalk-webview v2.4.0

Notes: 笔记:

  • this is for a debug build for local development, not for release . 这是用于本地开发的debug版本,而不是用于release
  • using cordova-android@6.4.0 instead of 7.0.0 works fine, it installs the correct apk. 使用cordova-android@6.4.0而不是7.0.0工作正常,它安装正确的apk。

Thank you! 谢谢!

Crosswalk git repository report same issue: https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview/issues/203 Crosswalk git存储库报告同样的问题: https//github.com/crosswalk-project/cordova-plugin-crosswalk-webview/issues/203

Some user has resolved by open android studio and change default architecture, but i dont know what cordova suitable settings or configurations android studio change with that. 一些用户通过打开android studio解决并更改默认架构,但我不知道什么cordova适当的设置或配置android studio改变了。

I solved the problem. 我解决了这个问题。 I found that the plugin works correctly in my case. 我发现插件在我的情况下正常工作。 The problem was with the Android Studio . 问题出在Android Studio上 Android Studio 3.0.1 uses arm64Debug by default. Android Studio 3.0.1默认使用arm64Debug To solve this problem I have taken the following steps in the Android Studio: 为了解决这个问题,我在Android Studio中采取了以下步骤:

  • click on the app Build 点击应用程序Build
  • Select Build Variant 选择Build Variant
  • Select armv7Debug 选择armv7Debug

Hope it helps. 希望能帮助到你。

I've resolved this issue follow @Mtz recommendation: 我已按照@Mtz推荐解决了这个问题:

1) Install https://github.com/MBuchalik/cordova-build-architecture plugin adding to config.xml like this 1)安装https://github.com/MBuchalik/cordova-build-architecture插件添加到config.xml这样

<plugin name="cordova-build-architecture" spec="https://github.com/MBuchalik/cordova-build-architecture.git#v1.0.4" source="git" />

2) Add this preference to android section in config.xml: 2)将此首选项添加到config.xml中的android部分:

<preference default="arm" name="buildArchitecture" />

3) 3)

cordova clean
cordova build (This step only generates one apk, armv7)
cordova run --devices

The run command will install only armv7 version, remember to remove all apk from your device before trying this run命令只会安装armv7版本,记得在尝试之前从你的设备中删除所有apk

By default, Cordova generate a build.gradle file which changes according to your program behavior or plugins you installed. 默认情况下,Cordova会生成一个build.gradle文件,该文件会根据您安装的程序行为或插件而更改。

In case you only need to install/run your apk for armv7 for debug purpose set the cdvBuildMultipleApks property to false. 如果您只需要为armv7安装/运行apk以进行调试,请将cdvBuildMultipleApks属性设置为false。

check out this Setting Gradle Properties for cdvBuildMultipleApks property and allso, Build Environment UserGuide for setting it in the currect place. 查看这个设置 grav 属性cdvBuildMultipleApks属性和allso, Build Environment UserGuide,用于在当前位置设置它。

this may allso be helpfull aswell: here 这也许也有帮助: 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM