Meteor APK build broken with accounts-google

As of this morning, we can no longer build our APK with accounts-google.

This build was working fine as recently as two days ago. Now it would seem that Google have once again broken something.

Steps to produce the issue:

$ meteor create broken-gooogle-oauth-test

$ cd broken-gooogle-oauth-test

$ meteor add-platform android

$ meteor add accounts-google

$ meteor build --verbose ~/test-build --server=http://www.example.com

or:

$ meteor run android-device

Either way, you eventually will see a long list of error messages, starting with:

/home/mad/.gradle/caches/transforms-1/files-1.1/core-1.0.0.aar/37baf6a1e42da25347f527a778e640b7/res/values/values.xml:133:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.

    /home/mad/.gradle/caches/transforms-1/files-1.1/core-1.0.0.aar/37baf6a1e42da25347f527a778e640b7/res/values/values.xml:133:5-70: AAPT: error: resource android:attr/ttcIndex not found.

    /home/mad/androidTest3/.meteor/local/cordova-build/platforms/android/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml:92: error: resource android:attr/fontVariationSettings not found.
    /home/mad/androidTest3/.meteor/local/cordova-build/platforms/android/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml:92: error: resource android:attr/ttcIndex not found.
    error: failed linking references.

    Failed to execute aapt
    com.android.ide.common.process.ProcessException: Failed to execute aapt
        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
        at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
        at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
        at sun.reflect.GeneratedMethodAccessor184.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> Failed to execute aapt

Note that accounts-github, accounts-facebook, and accounts-twitter all build just fine.

Apologies for the double post, but this issue is rather urgent.

Alas, this is impacting a lot of people it seems.

On June 17, Google updated their firebase and google-play-services packages, the newest versions require API version 28, which introduces some new XML features such as ttcIndex and fontVariationSettings, as your error shows. Any cordova plugins you are using that do not explicitly list major version numbers from before the June 17th update will use the latest version by default - thus breaking your build.

You can try forcing your build to use API 28, or manually go in and edit the plugins that depend on these packages to enforce major version numbers from before June 17 - unfortunately, there is no “consistent” version number from before this date, it could be almost literally anything, so you’d need to go find each one and get the latest prior release.

1 Like

In mobile-config.js, I did change the android-targetSdkVersion from 26 to 28, as per the warning that Google gave when I had submitted the APK (minus the breaking accounts-google, of course). This, however, has no effect on the problem at hand.

mobile-config.js now reads:

App.setPreference("android-targetSdkVersion", "28");
App.setPreference("android-minSdkVersion", "19");

Note that, as per the description above, there are no Cordova plugins in this app. There is nothing other than accounts-google here.

I’d guess that accounts google includes some plugins? I know that mobile-experience does that too. Additionally, meteor uses several plugins by default to allow hot code push, etc.

In your project, look in .meteor/local/cordova-build/plugins and .meteor/local/cordova-build/platforms/android - if plugins are causing the problem, they’ll be shown in one of those places.

I’d also make sure that those version changes you specify are actually coming through, .meteor/local/cordova-build/platforms/android/project.properties

1 Like

OK… so that’s odd. This file contains:

target=android-27

not 26, not 28… 27? Now where could this value possibly be coming from?

As for Cordova plugins in .meteor/local/cordova-build/plugins, sure enough, there are a bunch of them, but they do not change when I add/remove accounts-google, so I guess they are not the culprit.

27 is probably coming from the version meteor claims to require? You can try setting that to 28 from there

The other thing accounts-google could be doing is adding config to the XML - also, when you said they remain after removing accounts-google, are you able to build for cordova after removing? Just want to make sure you’re not relying on the plugins being cached or something.

A nice little trick, to save time while debugging these build problems is to just run the android cordova build

from .meteor/local/cordova-build/platforms/android/
run ./gradlew build (I think)

You can iterate much faster while trying to track down the problem

1 Like

Oh that’s a good tip! Thanks.

You say “You can try setting that to 28 from there”… but where, exactly? I don’t follow.

And yes, all I do is add/remove accounts-google. This project is otherwise squeaky clean, having just been initialized with “meteor create”.

change target=android-27 to target=android-28

so

meteor remove accounts-google
meteor reset
meteor run android-device

works?

and

meteor add accounts-google
meteor reset
meteor run android-device

does not?

Very likely, somewhere a build.gradle file has something like com.google.firebase:firebase-auth:+ or something similar with google-play-services basically it’s the + along with the lack of api 28 that’s causing the trouble

Nope. Any other ideas?

~/androidTest3$ find . -name build.gradle
./.meteor/local/cordova-build/platforms/android/app/build.gradle
./.meteor/local/cordova-build/platforms/android/CordovaLib/build.gradle
./.meteor/local/cordova-build/platforms/android/build.gradle
androidTest3$ grep firebase .meteor/local/cordova-build/platforms/android/app/build.gradle
androidTest3$ grep firebase .meteor/local/cordova-build/platforms/android/CordovaLib/build.gradle
androidTest3$ grep firebase .meteor/local/cordova-build/platforms/android/build.gradle
androidTest3$ grep google .meteor/local/cordova-build/platforms/android/build.gradle
            url "https://maven.google.com"
            url "https://maven.google.com"
androidTest3$ grep google .meteor/local/cordova-build/platforms/android/app/build.gradle
            url "https://maven.google.com"
androidTest3$ grep google .meteor/local/cordova-build/platforms/android/CordovaLib/build.gradle
            url "https://maven.google.com"

By the way, we also have another, much more complex project which also fails to build APK in similar fashion, but that one does not contain accounts-google. It will take several hours to determine which of the many Cordova plugins and/or packages is crashing things there.

the change android-27 is in .meteor/local/cordova-build/platforms/android/project.properties

can you send over the list of plugins you have in your plugins folder?

1 Like

accounts-google depends on google-oauth which depends on:

Cordova.depends({
  "cordova-plugin-googleplus": cordovaPluginGooglePlusURL
});

the XML file of which includes:

    <framework src="com.google.android.gms:play-services-auth:+" />
    <framework src="com.google.android.gms:play-services-identity:+" />

thats where your problem will be, those versions (+) will need to be changed to the pre-june 17 versions.

If its critical to get the build going, you can just change the versions in your config.xml file (and I’m fairly sure somewhere you’ve got a gradle file with those dependencies listed too)

NO WAY! YOU FIXED IT!!! :heart: :heart: :heart:

Sorry for being so confused. I didn’t expect to be editing a file under .meteor/local, since that would be overridden with each meteor reset.

Any idea if there is some place I can put this file, like cordova-build-override or something? Anyway, in the meantime, I’ll just hack this change into our build script.

I’m not sure - this approach didn’t work in our app, we depended on plugins that required API 26 for now :frowning: so we went with the approach to hard code the + to a specific version - we only needed to get a build out to get push notifications working, so we probably wont need another build for a year or so

I’ll head over and answer your stack overflow question if you don’t mind :slight_smile:

1 Like

you could try cordova-build-override/platforms/android/project.properties

And I can now confirm that your hack even fixed the actual project, not just my minimal test project!

By all means, answer SO. I’ll accept your answer as soon as your do.

Be glad you’re not in the room with me, or I’d be hugging you right now :smiley:

Lol - I know the feeling. I spent the last two days trying to figure out what was causing this - thought it was a new plugin we’d started using around the same time, turns out it wasnt!