Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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). This, by default, generates a bunch of apk's on cordova build which is fine.

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.

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. How can I do this?

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

Notes:

  • this is for a debug build for local development, not for release.
  • using [email protected] instead of 7.0.0 works fine, it installs the correct apk.

Thank you!

like image 506
Teodor Sandu Avatar asked Apr 02 '18 10:04

Teodor Sandu


2 Answers

Crosswalk git repository report same issue: 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.

I solved the problem. I found that the plugin works correctly in my case. The problem was with the Android Studio. Android Studio 3.0.1 uses arm64Debug by default. To solve this problem I have taken the following steps in the Android Studio:

  • click on the app Build
  • Select Build Variant
  • Select armv7Debug

Hope it helps.

like image 157
Frix33 Avatar answered Sep 25 '22 18:09

Frix33


I've resolved this issue follow @Mtz recommendation:

1) Install https://github.com/MBuchalik/cordova-build-architecture plugin adding to config.xml like this

<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:

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

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

like image 29
Jorge Granados Avatar answered Sep 24 '22 18:09

Jorge Granados