Ionic Package: Android builds failing

Hi Ionic,

Since the update to the new app-scripts@0.0.39, I have had problems building with ionic package build android --profile prod --release:

You have been opted out of telemetry. To change this, run: cordova telemetry on.
ANDROID_HOME=/usr/local/src/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-oracle

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.google.android.gms:play-services-gcm:9.8+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/
         file:/usr/local/src/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-gcm/maven-metadata.xml
         file:/usr/local/src/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-gcm/
         file:/usr/local/src/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-gcm/maven-metadata.xml
     Required by:
         :android:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.939 secs
Error: Error code 1 for command: /home/package/workspace/apps-abae991f-67/cordova/platforms/android/gradlew with args: cdvBuildRelease,-b,/home/package/workspace/apps-abae991f-67/cordova/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

My config.xml plugins:

<plugin name="cordova-plugin-device" spec="~1.1.3"/>
<plugin name="cordova-plugin-console" spec="~1.0.4"/>
<plugin name="cordova-plugin-whitelist" spec="~1.3.0"/>
<plugin name="cordova-plugin-statusbar" spec="~2.2.0"/>
<plugin name="ionic-plugin-keyboard" spec="~2.2.1"/>
<plugin name="cordova-plugin-network-information" spec="~1.3.0"/>
<plugin name="phonegap-plugin-push" spec="~1.8.4">
  <variable name="SENDER_ID" value="**************"/>
</plugin>
<plugin name="cordova-plugin-splashscreen" spec="~3.2.2"/>
<plugin name="cordova-plugin-camera" spec="~2.2.0"/>

This fails for both development and production builds. Running ionic run android or ionic build android --release works fine. My guess is an updated Google Support Repo?

On a sidenote, iOS .ipa files are building just fine.

1 Like

Also been having this issue…

Same issue for me. How can I fix it

Same over here!

My plugins:


  
  
  
  
  
  
  
    
  
  

Found out that build will succeed if I remove phonegap-plugin-push.

I do want the push messages to work, but the original problem might be related to the push plugin?

For me, upgrading extras in SDK manager solved the issue.

I get that problem when I’m building through the cloud.

Yes, exactly the same problem. But my app-scripts were 0.0.36 and it didn’t work. I updated to 0.0.39 and still the same problem. I am using phonegap-plugin-push, so that should be the problem.

Thanks everyone for chiming in. I think the problem lies on the Ionic Cloud side. In the meanwhile, I have been building using the Ionic CLI command ionic build android and it works great, even with phonegap-plugin-push.

EDIT: I actually found a new quirk related to building with Android, but I’m not sure if this is an app-scripts problem. You can find the thread here.

yeah if you remove

<plugin name="phonegap-plugin-push" spec="~1.8.3"> it builds fine, very strange

Same issue for me. How can I fix it??

Same issue for me… Only happen in Cloud

1 Like

I can also confirm, that this error is only occuring in Cloud. The only workaround at this point seems to build locally.

Hello again! Any solution??? =(

Hey guys. Still no updates on this, I’ll open a Github issue tomorrow (not too sure where though).

EDIT: Issue opened here.

Nobody cares that “ionic package build android” always failed?
Am i only one who need it working?
I have lots of updates published on IOS, but i cant publish same updates for Android because of this problem!
Who can solve it?

Hi. Is there something stopping you from building with Ionic CLI? I usually use ionic package to build for iOS because I’m on Windows. I think for most people in this thread, they are in the same situation, so they are able to workaround temporarily with ionic build android.

I always use ionic package for IOS and Android. Once i tried to build release app by ionic bulid android, then I managed that it is much easier to built with cloud, and now I dont remember how to build without clouds.

I understand that this can be a tricky task and one or two steps can be easily missed if you don’t follow each and every step meticulously.

Go through these steps and if you encounter any problems, please feel free to ask.

Android Platform Guide

Quick update: it seems like they fixed the problem. It is working again.