Building a cordova app with Polymer run into failure


#1

I am working on a Meteor cordova app.
Today I tried to add polymer to my app using:
meteor add boxxa:polymer
meteor add boxxa:polymer-paper

For build the APK file I use the following script:

#!/bin/sh

rm -rf .meteor/local/cordova-build/
meteor reset

BUILD_NAME=../build_tester
rm -rf $BUILD_NAME
VULCANIZE=true
meteor build $BUILD_NAME --server 192.168.178.53:3000

cd $BUILD_NAME/android
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 unaligned.apk MwsTester

~/.meteor/android_bundle/android-sdk/build-tools/20.0.0/zipalign 4 unaligned.apk MwsTester.apk

This worked fine before I added poylmer. Now I get after a long time building the project:

.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/fibers/future.js:245
                                                throw(ex);
                                                      ^
Error: The APK file for the Android build was not found.
    at findApkPath (/Users/doedel/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/commands.js:970:11)
    at /Users/doedel/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/commands.js:950:21
    at Array.forEach (native)
    at Function._.each._.forEach (/Users/doedel/.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/underscore/underscore.js:79:11)
    at buildCommand (/Users/doedel/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/commands.js:933:29)
    at Command.main.registerCommand._.extend.name [as func] (/Users/doedel/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/commands.js:746:12)
    at /Users/doedel/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/main.js:1363:23
Enter Passphrase for keystore: Unable to open 'unaligned.apk' as zip archive

The server tar.gz file was created. Around 30 MB.

I also use
https://atmospherejs.com/differential/vulcanize

I think the app becomes to BIG with polymer.


#2

I made a very small meteor project to reproduce this issue:

Build iOS is OK !

I also updated the android sdk and tools using
meteor configure-android


#3

I have the exact same problem. I use polymer 0.5 in my project, but not through any pacakges. Same problem with or without differential:vulcanize.


#4

@n0mn0m what do thing: Is it a meteor or cordova problem ?

I read, that phonegap / cordova can’t handle html imports.


#5

Well, I pulled Polymer/Paper-checkbox by bower into public folder and this is running OK on android emulator:

<head>
  <title>polycordova</title>
  <script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
  <link rel="import" href="bower_components/paper-checkbox/paper-checkbox.html">
</head>

<body>
	<paper-checkbox></paper-checkbox>
  <h1>Welcome to Meteor!</h1>
</body>

#6

@doedel I made a similar testcase as you, but I used bower to get the polymer packages. There was one package that broke the build, and that was paper-dialog. After a little digging, I found that the actual package was the web-animation-js. Inside that folder there was a file called web-animations.min.js.gz, and when I deleted that one it built fine.

I am not sure why you would get this error and I still get it in my non-test project. I will post my findings if I figure out any more.


#7

Polymer runs fine in the Android emulator, but this is just ok for testing.
For the real thing, it must run on the device.


#8

I’ve been in the same issue, but I’m not using polymer…


#9

Sometimes it helps to remove the meteor installation .meteor in user home.
Then re-install the android sdk with all settings on default.

But this dont fix the issues with polymer :grin:


#10

Does anyone are using Facebook Connect cordova plugin? Because in my case, it was solved days ago, take a look:

But I don’t know why this is happening again…after remove facebook connect my build came back to normal…


#11

Awsome! I was able to run my project by deleting web-animations.min.js.gz from the \public\bower_components\web-animations-js\web-animations.min.js.gz.

It now compiles for Android.