在 Ionic 项目中集成 Crosswalk 后构建组合的 armv7/x86 apk [英] Building combined armv7/x86 apk after Crosswalk integration in an Ionic project
问题描述
我已将 Crosswalk 添加到我的 ionic 项目中.当我执行 ionic build android
时,它会输出两个单独的 APK 文件,一个用于 armv7,另一个用于 x86.
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.
但是我想要一个将两种架构捆绑在一起的 apk 文件.
However i want one single apk file bundling two architectures together.
我尝试设置 BUILD_MULTIPLE_APKS = false
但它仍在构建两个单独的 apk.
I tried setting BUILD_MULTIPLE_APKS = false
but it's still building two separate apks.
有一个帖子这里 说:
花了我一分钟,但您可以通过评论获得单个构建文件出 cdvBuildMultipleApks=true 行平台/android/gradle.properties
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
干杯
但是我的平台/android/文件夹中没有任何 gradle.properties 文件,我有一个 project.properties 文件并且其中没有 cdvBuildMultipleApks=true
行可以注释掉.
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.
我尝试手动创建一个 gradle.properties 文件并将 cdvBuildMultipleApks=false
放在那里,但仍然有两个输出.
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?
更新:
我的 Cordova 版本是 5.1.1
My Cordova version is 5.1.1
解决方案:
@mudasserajaz 和 这里,是:
What did work for me as suggested by @mudasserajaz and here, was to :
- 在我的
/platform/android/
目录中创建一个名为build-extras.gradle
的文件. - 将
ext.cdvBuildMultipleApks=false
放入其中. ionic build android --release
然后瞧,它奏效了.
- Create a file named
build-extras.gradle
inside my/platform/android/
directory. - put
ext.cdvBuildMultipleApks=false
inside it. ionic build android --release
then and Voila, it worked.
@mudasserajaz 建议相同的事情,除了变量名称是 cdvBuildMultipleApks=false
所以如果它不适合你,不要忘记 ext
>
@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
推荐答案
以下是执行此操作的步骤:
Here are steps to do that:
- 制作一个文件
build-extras.gradle
并将其放入platforms/android/
.将cdvBuildMultipleApks=false
行添加到build-extras.gradle
中. - 现在运行
ionic run android
,它将创建组合的单一构建android-debug.apk
.
- Make a file
build-extras.gradle
and put it intoplatforms/android/
. Add linecdvBuildMultipleApks=false
intobuild-extras.gradle
. - Now run
ionic run android
, it will create combined single buildandroid-debug.apk
.
build.gradle
会自动导入build-extras.gradle
,如果定义了.你可以看到build.gradle
的代码在做这:
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'
}
此外,build.gradle
第 57 行明确提到了这些说明:
Plus these instructions are clearly mentioned in build.gradle
line 57 :
配置属性.通过环境变量设置这些,build-extras.gradle 或 gradle.properties.
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.
观察:一旦你完成了这些步骤,并且在某个时候,你想要进行单独的构建,然后设置 cdvBuildMultipleApks=true
或注释掉有时不会't 工作,你只需要再次安装平台.(P.S 这是我个人的观察,否则删除 build-extras.gradle
应该就足够了.)
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.)
这篇关于在 Ionic 项目中集成 Crosswalk 后构建组合的 armv7/x86 apk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!