Android build fails


#1

Hi all,

I’m having trouble building meteor apps to android, using OSX.
On a vanilla app (which I just created and added the android platform) I get the error:

Error while building for mobile platforms: Error running                           
/Users/andrade/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/cordova-scripts/cordova.sh


/Users/andrade/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/src/cli.js:115
console.error(err.stack);
^
TypeError: Cannot read property 'stack' of undefined
at process.<anonymous>
(/Users/andrade/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/src/cli.js:115:30)
at process.emit (events.js:95:17)
at process._fatalException (node.js:295:26)


Fetching plugin "org.apache.cordova.console@0.2.13" via plugin registry

Any ideas on what could be causing this?
By the way, the same vanilla app will build without errors on ubuntu but will only produce unaligned.apk… shouldn’t it also output the aligned.apk?

Thanks


#2

In case anyone is facing the same issue, here an update: the cordova related errors above remain when building on OSX but I was able work around it (in some cases) by using an ubuntu virtual machine to produce the android builds.

The unaligned.apk built on ubuntu wouldn’t work on the device as it was but signing it as described in https://github.com/meteor/meteor/wiki/How-to-submit-your-Android-app-to-Play-Store did the trick. I supposed that would only be required if you were submitting to the Play Store.

keytool -genkey -alias your-app-name -keyalg RSA -keysize 2048 -validity 10000

jarsigner -digestalg SHA1 unaligned.apk your-app-name

#3

As I understand it, the build will only generate the unaligned.apk. And the unaligned.apk cannot be run a device until it is “aligned” (aka signed). Thus, even if you were not intending to distribute on the Play Store, and simply wanted to sideload the apk, you would still have to sign the apk in order for it to work on your device.


#4

After trying different things, including removing and re-installing meteor, what seemed to work for me on OSX was to delete both the .android and .meteor directories from my home directory (/Users/your-user), as well as .meteor/local from the project directory before building again.


#5

I had a similar problema with this when trying to upload to my server using MUP, and what worked was running the command using sudo before it.