Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cordova build is rejecting the plugin #123

Closed
htsnet opened this issue Jul 13, 2015 · 67 comments
Closed

Cordova build is rejecting the plugin #123

htsnet opened this issue Jul 13, 2015 · 67 comments

Comments

@htsnet
Copy link

htsnet commented Jul 13, 2015

I don´t know why, but today (07/13/15 19h00 -3GMT) my APP using your plugin is not been build. I use the XDK Intel. The program do not inform any addicional information, but end the building.

What can be happened?

@ashconnell
Copy link

Yep, updating the latest version broke our build that we've been using for 6+ months

@ashconnell
Copy link

Ref to pr: #118

@danwilson
Copy link
Owner

Researching (but currently unable to reproduce, any other information you can give would be helpful)...

In the meantime, you can always revert to the older version by running:

cordova plugin add cordova-plugin-google-analytics@0.7.1

@DaveH1234
Copy link

I've just created a new project and the same is occurring for me.

Error Log:

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-analytics:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-analytics/maven-   metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-analytics/
     Required by:
         :android:unspecified

I guess i'm using the incorrect play-services? But I just added it to my build with the command
cordova plugin add com.google.play.services
so not sure what's wrong here. I also can't seem to get the revert working, I uninstalled the plugin and re-added with the command above and got this error:

Fetching from npm failed: version not found: 0.7.2 : cordova-plugin-google-analytics/0.7.2
Error: version not found: 0.7.2 : cordova-plugin-google-analytics/0.7.2

@danwilson
Copy link
Owner

I apologize, the previous version on npm was 0.7.1 - I have updated the previous comment.

cordova plugin add cordova-plugin-google-analytics@0.7.1

@danwilson danwilson reopened this Jul 14, 2015
@ashconnell
Copy link

I fixed this by running android and making sure i had the latest revisions of:

  • Android Support Repository
  • Android Support Library
  • Goole Play Services
  • Google Repository

EXCEPT... i get another error when building:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)

Which i assume is because another plugin uses a bundled version of the support library

@ohh2ahh
Copy link

ohh2ahh commented Jul 15, 2015

I've got the same error as @Deminetix (Multiple dex files...). I reverted the plugin back to 0.7.1 and everything works fine again.

@htsnet
Copy link
Author

htsnet commented Jul 15, 2015

I will try it too. Thank you.

@ashconnell
Copy link

I couldn't fix it so i just used @0.7.1

@xale76
Copy link

xale76 commented Jul 17, 2015

@htsnet did you solved? I use XDK too and I cannot build!
I install plugin from button "Get Plugin From The Web"...my question is: what to write in REPO URL to use 0.7.1 version? I've tried #r0.7.1, #0.7.1, @0.7.1 but nothing works

@htsnet
Copy link
Author

htsnet commented Jul 17, 2015

I tryed and occurs error too. Considering that I was hurry, I used another plugin with a little changes.

@canadaka
Copy link

I also just recently can no longer add this plugin to my project. And I can't install from the Cordova registry or npm, only the git url. But like @xale76 says, don't know how to specify a version in the git url.

It seems this plugin is no longer in the registry
http://plugins.cordova.io/#/search?search=google-analytics-plugin

@BondaCB
Copy link

BondaCB commented Jul 20, 2015

Having the same issue here.
I've been looking on the internet and looks like doing a $ gradle -q dependencies shows wich packages are collisioning with the dex definitions, though i cannot test it because i dont have graddle installed on this computer.

Anyways, looking for updates on the topic.

@kreck
Copy link

kreck commented Jul 21, 2015

Same issue here - any update on the issue or a fix?

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
   > Could not find any version that matches com.google.android.gms:play-services-analytics:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-analytics/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-analytics/
         https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com/google/android/gms/play-services-analytics/maven-metadata.xml
         https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com/google/android/gms/play-services-analytics/
         file:/usr/local/Cellar/android-sdk/22.2.1/extras/android/m2repository/com/google/android/gms/play-services-analytics/maven-metadata.xml
         file:/usr/local/Cellar/android-sdk/22.2.1/extras/android/m2repository/com/google/android/gms/play-services-analytics/
     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

@writeosahon
Copy link

Just to confirm that the latest version of this plugin DOES NOT work with INTEL XDK. Unfortunately, no error log is provided by the XDK build.
Please continue to use version 0.7.1.

when using XDK, first Download the 0.7.1 version from npm, then add the downloaded folder to your project as a "Local Plugin"

@xale76
Copy link

xale76 commented Jul 25, 2015

ok but how to donwload from npm?

@joseanmun
Copy link

Hello guys, I am using phonegap 4.1.2 so I can't download the plugin from npm. Have you found a solution without use npm?

@adriangordon1231
Copy link

I was able to resolve the issue for myself by installing the Android Support Repository in my Android sdk manager (under the "extras" section).

@divick
Copy link

divick commented Sep 12, 2015

+1
I too find the same results as @Deminetix i.e. after upgrading the following to latest, it was able to proceed further but then complained with "Multiple dex file define ..." error.

Android Support Repository
Android Support Library
Goole Play Services
Google Repository

@dwmkerr
Copy link
Contributor

dwmkerr commented Sep 21, 2015

+1 same issue for me here!

@cobbdb
Copy link

cobbdb commented Oct 6, 2015

Looks like that 0.7.1 version is at risk of losing its gplay dependency with the move to npm. So to help future-proof the build just install the dep manually using cordova-plugin-googleplayservices then after that install cordova-plugin-google-analytics@0.7.1 and then everything will be pulling from npm.

@bmatto
Copy link

bmatto commented Oct 14, 2015

I was attempting to revert to 0.7.1, and ran into an issue where this line

cordova.system.library.1=com.google.android.gms:play-services-analytics:+

...persisted in my project.properties file. Removing that line, and reinstalling with 0.7.1 via cordova plugin add cordova-plugin-google-analytics@0.7.1 worked.

@kim3er
Copy link

kim3er commented Oct 26, 2015

As per @Deminetix's comments, I updated:

  • Android Support Repository
  • Android Support Library
  • Goole Play Services
  • Google Repository

Then bumped into the same issue:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)

I resolved this by deleting the google services jar from /libs. Rocking now.

@danwilson
Copy link
Owner

I think the steps @Deminetix and @kim3er used are the way to go to be on the latest version and get rid of lingering files from the old version of the plugin - thanks!

@NkHAp
Copy link

NkHAp commented Oct 30, 2015

@danwilson I am using Phonegap Build to compile the code So I guess I won't be able to remove Google service jar as suggested by @kim3er. So can you help me how can I get it resolved for Phonegap Build. I am using Phonegap CLI-5.2.0

Build Date: 2015-10-30 07:06:18 +0000
Running: /project/gradlew cdvBuildRelease -b /project/build.gradle -Dorg.gradle.daemon=true -x lintVitalRelease
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'project'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.google.android.gms:play-services-analytics:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-analytics/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-analytics/
         file:/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-analytics/maven-metadata.xml
         file:/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-analytics/
     Required by:
         :project: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: 38.004 secs
/project/cordova/node_modules/q/q.js:126
                    throw e;
                    ^
Error code 1 for command: /project/gradlew with args: cdvBuildRelease,-b,/project/build.gradle,-Dorg.gradle.daemon=true,-x,lintVitalRelease 

P.S. I am also using phonegap-plugin-push which is also running with similar error regarding Google play service issue.

@MazzMazz
Copy link

Now i'm getting this error if i try to iinstall google analytics @0.7.1

Fetching plugin "cordova-plugin-google-analytics@0.7.1" via npm
Installing "cordova-plugin-google-analytics" for android
Notice: com.google.playservices@19.0.0 has been automatically converted to cordova-plugin-googleplayservices and fetched from npm. This is due to our old plugins registry shutting down.
Fetching plugin "cordova-plugin-googleplayservices@19.0.0" via npm
Failed to install 'cordova-plugin-google-analytics':CordovaError: Failed to fetch plugin cordova-plugin-googleplayservices@19.0.0 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: version not found: cordova-plugin-googleplayservices@19.0.0
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:146:33
    at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:797:24)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:823:30
    at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1035:31)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:741:41)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:355:11)
Error: Failed to fetch plugin cordova-plugin-googleplayservices@19.0.0 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: version not found: cordova-plugin-googleplayservices@19.0.0

@dpolivy
Copy link
Contributor

dpolivy commented Jan 23, 2016

@MazzMazz As to why it works in one but not the other, my guess is that it relates to what dependencies other plugins have -- likely no other plugins you use have a dependency on Google Play Services, or if they do it ends up being specified in the same way as this plugin in 0.8.1.

As for your second error, I believe that is because cordova-plugin-googleplayservices@19.0.0 isn't published on npm. The version to use is 19.0.3, and you may have to update the plugin.xml to adjust the version spec appropriately, Or try to manually install cordova-plugin-googleplayservices first and then install the Google Analytics plugin.

@betorobson
Copy link

After update:
Android Support Repository
Android Support Library
Google Play Services
Google Repository

Do not forget to restart Android SDK Manager and update any other version which has appear.
Do this process until there is no more updates to do.

@ghost
Copy link

ghost commented Feb 25, 2016

Is this still an issue? I'm still getting errors even after following the steps described above.

@Decoherence
Copy link

@johannds I was also encountering build issues after following the steps above.

For me, the Android Support Repository package wasn't available in the Android SDK Manager (android).

I tried installing Extras -> Local Maven Repository for Support Libraries, and then the build worked.

@betorobson
Copy link

try this
$ cordova plugin remove cordova-plugin-google-analytics
$ cordova plugin add cordova-plugin-google-analytics@0.8.0

@fryck
Copy link

fryck commented Mar 17, 2016

I've tried all your solutions, but i still get the error...

:transformClassesWithDexForArmv7Release
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

All is up-to-date in my SDK Manager

I use cordova-cli v6 and local maven package for crosswalk-lite.

@fryck
Copy link

fryck commented Mar 17, 2016

I've just removed "googleplayservice" cordova plugin, and everything works fine now. :)

@betorobson
Copy link

@fryck, For sure googleplayservice plugin was a workaround for old cordova versions.

@YuniorGlez
Copy link

The com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 error is because yo have more than 65K Methods in the project due to plugins :)

I resolve with this http://developer.android.com/intl/es/tools/building/multidex.html

@fidelisrafael
Copy link

I solved this problem for for Installing all tools in Extra section, I tried installing only Google Play Services and Android Support Repository but did not workout, so as I don't have much time to investigate this much deeper, this saved my day \o/

captura de tela 2016-04-20 as 5 31 36 pm

@michelevirgilio
Copy link

I've followed all of suggested solutions but no luck.
The app compiles fine, ios analytics are fine, android not, without errors.
Any clue?

@andrewbusch7
Copy link

@michelevirgilio What do you mean Android doesn't compile but shows no errors? What does it say?

@RezaRahmati
Copy link

RezaRahmati commented May 22, 2016

I've followed the suggestion, for me compile is fine, but when I open the application on android it says "Unfortunately xx has stopped "
Cordova v5.4.1
Android 5.1.1
Plugin v0.8

4

@niraj-shah
Copy link

@RezaRahmati I had the same issue. Turns out that adding the applicationId to platforms/android/build.gradle fixed the issue for me:

android {
    ...
    defaultConfig {
        applicationId "com.example.my.app"
        ...
    }
}

@RezaRahmati
Copy link

@niraj-shah Thanks for answer, I will try that

@rahulinaction
Copy link

This did it for me
And add this line to build.gradle: configurations { all*.exclude group: 'com.android.support', module: 'support-v4' }
Referenced from
(Wizcorp/phonegap-facebook-plugin#992)

@jmereaux
Copy link

jmereaux commented Oct 11, 2016

I still have the issue
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzpz;

Tried everything proposed on this thread.

cordova@6.3.1
ionic@1.7.16
cordova-plugin-google-analytics 1.6.0

Any clear procedure to solve the problem?
Thanks

Edit: Seems like there is a conflict with another plugin I use for Push Notifications (ibm-mfp-push)

@betorobson
Copy link

@jmereaux, have you tried create a new Cordova project, install google-analytics-plugin and build it?

@jmereaux
Copy link

jmereaux commented Oct 11, 2016

@betorobson, no I have not. But as I edited the post above, seems like there is a conflict with the google analytics plugin and another plugin I use for push notifications
Just found this link that might be helpful

Edit: unfortunately, the link is not so helpful
Edit2: I also tried to create a brand new ionic project and added the google-analytics and ibm-mfp-push plugins. Same error when running a ionic build android

@jmereaux
Copy link

Modifying the project.properties file in the android platform folder seems to have done the trick...
Updated:
cordova.system.library.1=com.google.android.gms:play-services-analytics:+
to
cordova.system.library.1=com.google.android.gms:play-services-analytics:7.8.0

@peterpeterparker
Copy link

For the record I had that error too. Installing both Google Play Services and Android Support Repository and still no luck. Tried to change the number as @jmereaux did but wasn't successful...finally it turns out my ANDROID_HOME was pointing to the wrong path. Fixing it and everything works perfectly

P.S.: Ionic RC.1

@mapierce
Copy link

Still having this issue. Running:

cordova@6.2.0
ionic@1.7.16
cordova-plugin-google-analytics 1.6.0

@jmereaux I tried your fix of switching the cordova system library, but it didn't seem to do anything. For the record my project.properties file looks like this

cordova.gradle.include.1=cordova-plugin-intercom/appname-intercom.gradle
cordova.system.library.1=com.google.android.gms:play-services-gcm:8.+
cordova.gradle.include.2=cordova-plugin-intercom/appname-build-extras-intercom.gradle
cordova.system.library.2=com.google.android.gms:play-services-analytics:+

@mapierce
Copy link

Right seems to be a conflict with the intercom plugin. Running intercom plugin version 1.1.7

@mapierce
Copy link

Changing

cordova.system.library.2=com.google.android.gms:play-services-gcm:8.+

to

cordova.system.library.2=com.google.android.gms:play-services-gcm:+

has resolved my issue. 🎉

@garyconstable
Copy link

this worked for me:

Looks like that 0.7.1 version is at risk of losing its gplay dependency with the move to npm. So to help future-proof the build just install the dep manually using cordova-plugin-googleplayservices then after that install cordova-plugin-google-analytics@0.7.1 and then everything will be pulling from npm.

@liquidcms
Copy link

as per kim3er: "I resolved this by deleting the google services jar from /libs." - where is this?

@sidjainrise
Copy link

My issue was with another plugin trying to use another version of com.google.android.gms:play-service. By updating all plugins to their latest version respectively and making sure they all use the same version of play-service, the issue was resolved

@clewsk8er
Copy link

(may need sudo) cordova plugin add cordova-plugin-google-analytics@latest --variable GMS_VERSION=(your version) (latest = 16.0.8)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests