Fitri San
Fitri San

Reputation: 21

Has anyone know how to build x64 apk file with Meteor JS?

I tried to build x64-bit apk file using gradle method from this link, but I got armv7 and x86 build only.

I tried to analyzed every apk I build, none them shown any hint of x64 version. Following is my app's gradle,

android {
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }
    }

    defaultConfig {
        ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
        versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
        applicationId privateHelpers.extractStringFromManifest("package")

        if (cdvMinSdkVersion != null) {
            minSdkVersion cdvMinSdkVersion
        }
    }

    lintOptions {
      abortOnError false;
    }

    compileSdkVersion cdvCompileSdkVersion
    buildToolsVersion cdvBuildToolsVersion

    if (Boolean.valueOf(cdvBuildMultipleApks)) {
        flavorDimensions "default"

        productFlavors {
            armv7 {
                versionCode defaultConfig.versionCode*10 + 2
                ndk {
                    abiFilters "armeabi-v7a", ""
                }
            }
            x86 {
                versionCode defaultConfig.versionCode*10 + 4
                ndk {
                    abiFilters "x86", ""
                }
            }
            arm64 {
                versionCode defaultConfig.versionCode*10 + 6
                ndk {
                    abiFilters "arm64-v8a", ""
                }
            }
            x86_64 {
                versionCode defaultConfig.versionCode*10 + 9
                ndk {
                    abiFilters "x86_64", ""
                }
            }
            all {
                ndk {
                    abiFilters "all", ""
                }
            }
        }
    }

I also did followed the steps of accepted answer from this link. Am I missing something? My Meteor version is 1.8.1 . Please let me know, if you guys need any other info related with as I'm new at this platform. Tq

Upvotes: 1

Views: 219

Answers (1)

Fitri San
Fitri San

Reputation: 21

I finally found my answer on my own.

Just figure out, there's problem when using crosswalk for build purpose. I came across this plugin and follow what its say.

Then, I got x64-bit apk version magically! this took me a couple of hours, but worth at the end :)

Here is what I did,

1) I grab a few codes from the plugin and included in App.appendToConfig under root/mobile-config.js. Following is the example,

App.appendToConfig(`
  <plugin name="phonegap-plugin-push" spec="1.6.0">
    <param name="SENDER_ID" value="1044544766362" />
  </plugin>
  <platform name="android">
    <resource-file src="google-services.json" target="google-services.json" />
  </platform>
  <plugin name="cordova-build-architecture" spec="https://github.com/MBuchalik/cordova-build-architecture.git#v1.0.4" source="git" />
  <preference name="xwalk64bit" value="true" />
  <preference name="buildArchitecture" value="arm64" />
`);

// the last three tags are what I included

2) Lastly, run this in your terminal/cmd under your root project,

meteor build ~/your-directory-build --server=https://any.com

You will see an apk file under your-directory-build/android/project/build/outputs/apk/arm64/release .

Keep in mind, the plugin is still experimental. For those who bump an error message say "ERROR: All flavors must now belong to a named flavor dimension" when sync the app's gradle, it can be resolved with this link

Cheers!

Upvotes: 1

Related Questions