Meteor-Community-Packages / raix-push

DEPRECATED: Push notifications for cordova (ios, android) browser (Chrome, Safari, Firefox)
https://atmospherejs.com/raix/push
MIT License
514 stars 197 forks source link

Android build errors with Meteor 1.8.1 #366

Closed davinderkumar closed 5 years ago

davinderkumar commented 5 years ago

I had this plugin working fine with Meteor 1.8.0.2 but after upgrading to latest Meteor 1.8.1, I am unable to build my app for Android. I am getting build errors.

I am using raix:push 3.4.1
cordova:cordova-plugin-device 2.0.2 cordova:phonegap-plugin-push 2.1.2

I'm getting following error:

  • Where: Script '/myapp/app/.meteor/local/cordova-build/platforms/android/phonegap-plugin-push/myaddresspin-push.gradle' line: 35

  • What went wrong: A problem occurred evaluating project ':app'.

    Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin'] For input string: "+"

After following the Readme instructions and making changes to build.gradle, I am getting this error:

  • Where: Build file 'myapp/app/.meteor/local/cordova-build/platforms/android/build.gradle' line: 56

    • What went wrong: A problem occurred evaluating root project 'android'.

      Declaring custom 'clean' task when using the standard Gradle lifecycle plugins is not allowed.

my build gradle looks like

// Top-level build file where you can add configuration options common to all sub-projects/modules.

apply plugin: 'com.android.application'

buildscript {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
    dependencies {

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:4.1.0'
        classpath 'com.google.firebase:firebase-core:11.0.1'
    }
}

allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
    //This replaces project.properties w.r.t. build settings
    project.ext {
      defaultBuildToolsVersion="27.0.1" //String
      defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
      defaultTargetSdkVersion=27 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=27 //Integer - We ALWAYS compile with the latest by default
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

configurations.all {
  resolutionStrategy {
    force 'com.android.support:support-v4:27.1.0'
  }
}

configurations {
  all*.exclude group: 'com.android.support', module: 'support-v13'
}

apply plugin: 'com.google.gms.google-services'

any help would be appreciated.

shivang007 commented 5 years ago

@davinderkumar, yes the build is failing in 1.8.1. Will look into it and update further.

davinderkumar commented 5 years ago

Okay. Please update in this thread once this issue is resolved. I am unable to proceed further.

shivang007 commented 5 years ago

@davinderkumar, Sure I will update it. By the way for meteor 1.8.1 you are not supposed to make changes in your myapp/app/.meteor/local/cordova-build/platforms/android/build.gradle. It says right on top NOTE: Do not place your application dependencies here. As for the changes needed for meteor 1.8.1, I am still getting following error:

Could not load asset manager cache
E MeteorWebApp: java.io.FileNotFoundException: cdvasset.manifest

Will update once I get this working. Till then please use meteor 1.8.0.2 / Or any pull request will be appreciated.

shivang007 commented 5 years ago

@davinderkumar the error I was receiving was due to other plugin. In your case for meteor 1.8.1 use cordova:phonegap-plugin-push 2.2.3 and put your google-settings.json file inside .meteor/local/cordova-build/platforms/android/app/. No need to make any changes to build.gradle for 1.8.1.

davinderkumar commented 5 years ago

@shivang007 It is still crashing for me with same error even after project reset.

While building Cordova app for platform Android:
   Error: /Users/davinder/Work/map/myaddresspin/app/.meteor/local/cordova-build/platforms/android/gradlew: Command failed with exit code 1 Error output:
   FAILURE: Build failed with an exception.

   * Where:
   Script '/app/.meteor/local/cordova-build/platforms/android/cordova-support-google-services/myaddresspin-build.gradle' line: 16

   * What went wrong:
   A problem occurred evaluating project ':app'.
   > Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "+"
shivang007 commented 5 years ago

Could you post your list of installed Cordova plugins?

davinderkumar commented 5 years ago

here is list of plugins

cordova:cordova-plugin-camera 4.0.3 cordova:cordova-plugin-contacts 3.0.1 cordova:cordova-plugin-customurlscheme 4.4.0 cordova:cordova-plugin-device 2.0.2 cordova:cordova-plugin-googleplus 7.0.0 cordova:cordova-plugin-inappbrowser 3.0.0 cordova:cordova-plugin-ios-non-exempt-encryption 1.0.0 cordova:cordova-plugin-meteor-webapp 1.6.5 cordova:cordova-plugin-opensettings 1.3.0 cordova:cordova-plugin-splashscreen 5.0.2 cordova:cordova-plugin-statusbar 2.4.2 cordova:cordova-plugin-x-socialsharing 5.4.4 cordova:phonegap-plugin-push 2.2.3

I tried removing cordova:cordova-plugin-googleplus but no change. however i tried push-plugin in a fresh demo project and that worked fine. so one of the plugins must be causing problem.

shivang007 commented 5 years ago

Yes please check out the conflicting plugin. I have been able to build with the following cordova plugins:

cordova-plugin-device@2.0.2
cordova-plugin-inappbrowser@3.0.0
cordova-plugin-splashscreen@5.0.2
cordova-plugin-statusbar@2.4.2
phonegap-plugin-push@2.2.3
cordova-plugin-meteor-webapp@1.6.5
cordova-plugin-camera@4.0.3
cordova-plugin-contacts@3.0.1
cordova-plugin-opensettings@1.3.0
cordova-plugin-x-socialsharing@5.4.4
cordova-plugin-ios-non-exempt-encryption@1.0.0

You may also try to delete your local folder inside your .meteor folder and also clean up your Meteor package cache!

Meanwhile, I am closing this issue. If you have any queries, you can still post it here.

davinderkumar commented 5 years ago

@shivang007 I think I found the problem. This error occurs when we use accounts-google package along with raix:push / cordova:phonegap-plugin-push plugins.

Here is what I did

If we use both plugins independently then they work fine. Here is list of plugins

accounts-google 1.3.2 Login service for Google accounts blaze-html-templates 1.1.2 Compile HTML templates into reactive UI with Meteor Blaze cordova:cordova-plugin-device 2.0.2 cordova:phonegap-plugin-push 2.2.3 ecmascript 0.12.7 Compiler plugin that supports ES2015+ in all .js files es5-shim 4.8.0 Shims and polyfills to improve ECMAScript 5 support johanbrook:publication-collector 1.1.0 Test a Meteor publication by collecting its output. kadira:blaze-layout 2.3.0 Layout Manager for Blaze (works well with FlowRouter) kadira:flow-router 2.12.1 Carefully Designed Client Side Router for Meteor less 2.8.0 Leaner CSS language meteor-base 1.4.0 Packages that every Meteor app needs meteortesting:mocha 1.1.2 Run Meteor package or app tests with Mocha mobile-experience 1.0.5 Packages for a great mobile user experience mongo 1.6.2 Adaptor for using MongoDB and Minimongo over DDP raix:push 3.4.1 Isomorphic Push notifications for APN and GCM reactive-var 1.0.11 Reactive variable shell-server 0.4.0 Server-side component of the meteor shell command. standard-minifier-css 1.5.3 Standard css minifier used with Meteor apps by default. standard-minifier-js 2.4.1 Standard javascript minifiers used with Meteor apps by default. tracker 1.2.0 Dependency tracker to allow reactive callbacks

davinderkumar commented 5 years ago

In project.properties, these two libraries are mentioned like cordova.system.library.1=com.google.android.gms:play-services-auth:+ cordova.system.library.2=com.google.android.gms:play-services-identity:+

I changed these to cordova.system.library.1=com.google.android.gms:play-services-auth:11.6.2 cordova.system.library.2=com.google.android.gms:play-services-identity:11.6.2

and it worked. I'm not sure whose plugin script is causing this.

shivang007 commented 5 years ago

@davinderkumar Glad to hear it finally worked for you! Also you can go through phonegap plugin push docs, they might have some better way to resolve your conflict with other plugin.

Wade-BuildOtto commented 4 years ago

anyone found a permeant fix for this?

shivang007 commented 4 years ago

@Wade-BuildOtto raix:push works fine for Meteor 1.8.1. The problem that the author of this issue faced was due to conflicting plugin. If that is the issue with you, you might want to figure out which one it is. As for raix:push, just make sure to use proper versions of cordova plugins phonegap-plugin-push@2.2.3, cordova-plugin-device@1.1.6 and add your google-services.json file and it should work like a charm.

If you are facing any specific error, then comment the logs.