Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Latest Play store service breaks phonegap-plugin-push #909

Closed
hereiam133 opened this issue May 20, 2016 · 61 comments
Closed

Latest Play store service breaks phonegap-plugin-push #909

hereiam133 opened this issue May 20, 2016 · 61 comments

Comments

@hereiam133
Copy link

After Google released the last update to the play store and services 2 days ago, none of my new builds work. They all crash as soon as my app calls the plugin to register.

com.adobe.phonegap.push.PushPlugin$1.run
java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
PushPlugin.java, line 73

@vcenturion
Copy link

+1

1 similar comment
@iwc
Copy link

iwc commented May 20, 2016

+1

@ppark482
Copy link

ppark482 commented May 20, 2016

+1

10+ build crashes with this same error

@RobertCoop
Copy link

+1

2 similar comments
@kevboutin
Copy link

+1

@Jojr
Copy link

Jojr commented May 20, 2016

+1

@Jojr
Copy link

Jojr commented May 21, 2016

That's solution used by @zimski

I fixed the issue by removing the support of v4 in app/platforms/android/project.properties
Line to remove

cordova.system.library.2=com.android.support:support-v4:+

this file in my case already contains an other version of support

cordova.system.library.3=com.android.support:support-v13:23+

I think the v4 is deprecated for the latest version of service-gcm
The app starts correctly and the register is OK.

If some one can help and explain to me how the project.properties is generated/update ? this will allow us to fix this issue in a cleaner way.

Refer to this issue:
#911 (comment)

@macdonst
Copy link
Member

Geez, a guy goes away to the PhoneGap Day conference and Google updates everything on him. I'll look at this ASAP. However, this plugin uses "com.android.support:support-v13:23+" so the "com.android.support:support-v4:+" must be being included from another package. So, if you folks can help me with a reproduction scenario like what version of android, what version of cordova-android and what plugins you have installed that would be best.

@hiperlouro
Copy link

Hi!

I was having this issue with Cordova 5.2.0 and Android 4.1.1.
I tried the solution proposed by @Jojr and it worked after recreating the platforms with the support V13 only!

Anyways, here's the list of the plugins I'm using:

cordova-fabric-plugin 1.0.7 "cordova-fabric-plugin"
cordova-plugin-camera 2.1.1 "Camera"
cordova-plugin-crosswalk-webview 1.7.0 "Crosswalk WebView Engine"
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 1.1.0 "Device"
cordova-plugin-file 3.0.0 "File"
cordova-plugin-file-transfer 1.4.0 "File Transfer"
cordova-plugin-network-information 1.1.0 "Network Information"
cordova-plugin-vibration 2.0.0 "Vibration"
cordova-plugin-whitelist 1.2.0 "Whitelist"
nl.x-services.plugins.toast 2.0.4 "Toast"
phonegap-plugin-push 1.6.3 "PushPlugin"

@macdonst
Copy link
Member

Working through this now. I created a fresh project, no v4 added, then I added this plugin, still no v4 added. So it is an issue with another plugin. Continuing to investigate.

@zimski
Copy link

zimski commented May 22, 2016

I get the plugin that introduce the support v4

$ grep -r com.android.support plugins
plugins/phonegap-plugin-push/plugin.xml:        <framework src="com.android.support:support-v13:23+" />
plugins/cordova-plugin-mauron85-background-geolocation/plugin.xml:        <framework src="com.android.support:support-v4:+" />

So the cordova-plugin-mauron85-background-geolocation is responsible for the mess :).
You can run this command in the root of your project folder to identify the plugin

grep -r com.android.support plugins

cordova just read the plugin.xml of each plugins and add the dependency to the global project, maybe cordova need to be more smart when adding dependency and pick the recent one if several versions are found.

@macdonst
Copy link
Member

@hiperlouro I went though your list of plugins and added them all to my test project except the Fabric one as I do not have a valid API key. Right now I can't reproduce the issue.

@zimski yes thanks, I see that cordova-plugin-mauron85-background-geolocation uses v4 support. In this case I don't think it is cordova that needs to be more smart it is Google. They introduced an incompatibility in their latest Play Services and previous support libraries. Trying to find the right combination that works for everyone.

@khamaileon
Copy link

khamaileon commented May 22, 2016

Same problem here.
Cordova 6.1.1
node 4.4.3

  "cordovaPlugins": [
    "cordova-plugin-appsettings",
    "cordova-plugin-compat",
    "cordova-plugin-console",
    "cordova-plugin-crosswalk-webview",
    "cordova-plugin-device",
    "cordova-plugin-dialogs",
    "cordova-plugin-file",
    "cordova-plugin-file-transfer",
    "cordova-plugin-network-information",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "cordova-plugin-whitelist",
    "ionic-plugin-keyboard",
    {
      "id": "phonegap-plugin-push",
      "locator": "phonegap-plugin-push",
      "variables": {
        "SENDER_ID": "XXXXXXXXXXXX"
      }
    },
    {
      "locator": "https://github.com/mnill/cordova-app-updater.git",
      "id": "com.likesmagia.cordova.updater"
    }
  ],

project.properties

target=android-23
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-crosswalk-webview/myproject-xwalk.gradle
cordova.gradle.include.2=phonegap-plugin-push/myproject-push.gradle
cordova.system.library.1=com.android.support:support-v13:23+
cordova.system.library.2=com.google.android.gms:play-services-gcm:+

It stops crashing when I stop initializing PushNotification in my JS code.

@macdonst
Copy link
Member

Folks are you using the command line to build or Android Studio? I've upgraded everything for my command line builds. Currently running:

Android support repository 32
Android support library 23.2.1
Google Play Services 30
Google Repository 26

but I cannot duplicate the build error.

I'm telling Android Studio to go update everything as well but that may take a while to download so additional information to help figure this out is appreciated.

@macdonst
Copy link
Member

Duplicated it.

@macdonst
Copy link
Member

Yipes, this seems to be a colossal mistake by Google. Taking out any plugin that depends on v4 support seems to work but that's not a great solution. Still researching, all info and help is appreciated.

@khamaileon
Copy link

khamaileon commented May 22, 2016

@macdonst
I'm using the command line (ionic-cli).
I've got the same versions:

Android Support Repository 32
Android Support Library 23.2.1
Google Play services 30
Google Repository 26

and no references to support-v4

$ grep -r com.android.support plugins
plugins/phonegap-plugin-push/plugin.xml:        <framework src="com.android.support:support-v13:23+" />

@macdonst
Copy link
Member

@khamaileon and you are still seeing the crash? If so can you tell me what version of Play Services is installed on your test device?

@khamaileon
Copy link

@khamaileon
Copy link

If so can you tell me what version of Play Services is installed on your test device?
Where do I find it ?

@macdonst
Copy link
Member

@khamaileon that's the same crash error for sure. Regarding play services. It should be in your apps section of the settings app. You may need to turn on show system apps in order to see it in the list.

@khamaileon
Copy link

khamaileon commented May 22, 2016

Google Play services Version 9.0.83
Android 6.0.1
Galaxy S6

@macdonst
Copy link
Member

@khamaileon same as me, that leads me to believe that crosswalk includes the v4 dependency somewhere.

@khamaileon
Copy link

Android support libraries (e.g. support-v4, support-v7 etc) are no longer bundled by Crosswalk and should be included explicitly if required.

@vhmolinar
Copy link

After downloading Android Api Level updates of name rev. 3 (or something like that) the build has back working. Thanks.

@ernstdevries
Copy link

I got android support repository 32 , but where do i find 1.6.4 plugin is this phonegap push plugin version 1.6.4? Because now i still get this error Error:Failed to resolve: com.android.support:support-v4:23.4.0

@srkgupta
Copy link

srkgupta commented Jun 11, 2016

Upgrading to the latest packages and cleaning up the existing android platform helped me resolved this issue.

Google Play Services -> Rev. 30
Android Support Repository -> Rev. 32
Google Repository -> Rev. 28
Android SDK Tools -> Rev. 25.1.7

This is how I did. Open Android SDK Manager and check for any updates required for any of the packages. If so, update all of them.

Then in your project's directory, go to /platforms/android/cordova/ and run the command ./clean

Recompile the android package and the issue is resolved.

macdonst added a commit that referenced this issue Jun 16, 2016
https://developers.google.com/android/guides/releases

Google Play services updated to 9.0.1
The Google Play services version 9.0.1 release is now available. This release fixes the following issues with the version 9.0.0 release:

Fixes a class change compilation error with ContextCompat.getNoBackupFilesDir().
jcesarmobile pushed a commit to jcesarmobile/phonegap-plugin-push that referenced this issue Jun 20, 2016
https://developers.google.com/android/guides/releases

Google Play services updated to 9.0.1
The Google Play services version 9.0.1 release is now available. This release fixes the following issues with the version 9.0.0 release:

Fixes a class change compilation error with ContextCompat.getNoBackupFilesDir().
@escolhatecnologia
Copy link

+1

@nocodedweb
Copy link

App started crashing today after I installed Android library updates. The only thing I could do to fix was to uninstall and reinstall the phonegap-plugin-push plugin and it worked like a charm.

@macdonst
Copy link
Member

@nocodedweb see #1591

@lock
Copy link

lock bot commented Jun 4, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests