Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

cordova - Building combined armv7/x86 apk after Crosswalk integration in an Ionic project

I have added Crosswalk to my ionic project. When i do ionic build android it outputs two separate APK files, one for armv7 and one for x86.

However i want one single apk file bundling two architectures together.

I tried setting BUILD_MULTIPLE_APKS = false but it's still building two separate apks.

There is a post here saying :

Took me a minute but you can get the single build file by commenting out the cdvBuildMultipleApks=true line in the platforms/android/gradle.properties

Cheers

But i don't have any gradle.properties file in my platforms/android/ folder, i have a project.properties file and there is no cdvBuildMultipleApks=true line in it to comment out.

I tried to manually create a gradle.properties file and putting cdvBuildMultipleApks=false in there but still two outputs.

Any ideas how to achieve this?

Update:

My Cordova version is 5.1.1

Solution:

What did work for me as suggested by @mudasserajaz and here, was to :

  1. Create a file named build-extras.gradle inside my /platform/android/ directory.
  2. put ext.cdvBuildMultipleApks=false inside it.
  3. ionic build android --release then and Voila, it worked.

@mudasserajaz suggested the same thing except variable name is cdvBuildMultipleApks=false so in case it didn't work out for you, don't forget the ext

question from:https://stackoverflow.com/questions/32535551/building-combined-armv7-x86-apk-after-crosswalk-integration-in-an-ionic-project

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here are steps to do that:

  1. Make a file build-extras.gradle and put it into platforms/android/. Add line cdvBuildMultipleApks=false into build-extras.gradle.
  2. Now run ionic run android, it will create combined single build android-debug.apk.

build.gradle will automaticaly import build-extras.gradle,if that is defined.You can see code of build.gradle doing this :

def hasBuildExtras = file('build-extras.gradle').exists()
if (hasBuildExtras) {
    apply from: 'build-extras.gradle'
}

Plus these instructions are clearly mentioned in build.gradle line 57 :

Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.

NOTE: Before you follow these steps, remove platform folder and install again.

Observations: Once you have done these steps, and again at some point, you want to make separate builds, then setting cdvBuildMultipleApks=true or commenting out sometimes won't work, you will simply have to install platform again. (P.S this is my personal observation, otherwise deleting build-extras.gradle should be enough.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...