1

The following build output is received while trying to build a cordova app in VS 2017:

MSBUILD : cordova-build error : PARSE ERROR:

MSBUILD : cordova-build error : unsupported class file version 52.0

MSBUILD : cordova-build error : ...while parsing com/google/android/gms/StrictVersionMatcherPlugin.class

MSBUILD : cordova-build error : 1 error; aborting

MSBUILD : cordova-build error : Picked up _JAVA_OPTIONS: -Xmx512M

MSBUILD : cordova-build error : FAILURE: Build failed with an exception.

MSBUILD : cordova-build error : * What went wrong:

MSBUILD : cordova-build error : Execution failed for task ':transformClassesWithDexForDebug'.

MSBUILD : cordova-build error : > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Java\jdk1.8.0_161\bin\java.exe'' finished with non-zero exit value 1

Please comment what additional info is needed and i will edit the question.

Edit: Not solved. Would be glad to get a solution.

Community
  • 1
  • 1
Dorad
  • 3,413
  • 2
  • 44
  • 71

1 Answers1

0

Without using Visual studio, but only the cordova tools, I have created a sample app that works in browser, android, windows - other plaforms I did not check.

Here is the project:

https://github.com/manoharreddyporeddy/programming-language-notes/tree/master/my-cordova


If you have not tried these, worth a try:

If android studio is used, try these:

  1. Rebuild the project
  2. Else, update the Android Studio, & then rebuild the project
  3. Else, Fix the build.gradle.
    • add multiDexEnabled true inside 'android' because your method references in your app exceeds the 65K limit, add dependencies 'com.android.support:multidex:1.0.0', update manifest android:name="android.support.multidex.MultiDexApplication"> under application, see http://developer.android.com/studio/build/multidex.html
    • Else, add multiDexEnabled true inside defaultConfig
  4. Else, delete YOUR_APP_NAME\app\build\intermediates file
  5. You need to use Android Studio when this error occurs please see 2 things:
    a. com.android.ide.common in your error message showing it is related to android
    b. see this video others have the same issue, so they start android studio and build there instead please see, youtu.be/-JxciEQ1YnQ?t=214

Edit: If no android studio is required, try these:

  1. Uninstall & reinstall, I am able to work without any issues with VS 2017 & default cordova (6.3.1 version), I have updated VS2017 a few days back in Jan 2019
  2. If you want to use latest cordova then do this
    then edit config.xml
    you may need Android SDK Build Tools & Android SDK Manager to manage versions (no need to get Android Studio) you will need Is GUI for Android SDK manager gone? more help here: Cannot select Cordova Global on Visual Studio 2017

Some environment related things:
1. https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#requirements-and-support

Manohar Reddy Poreddy
  • 25,399
  • 9
  • 157
  • 140
  • hello @Manohar, as tagged, it's a cordova project in VS. we don't use Android studio at all. – Dorad Jan 08 '19 at 06:33
  • @Dorad, Sure, but you need to use `Android Studio` when this error occurs, please see 2 things: 1. `com.android.ide.common` in your error message showing it is related to android, 2. see this video others have the same issue, so they start android studio and build there instead, please see, https://youtu.be/-JxciEQ1YnQ?t=214 – Manohar Reddy Poreddy Jan 08 '19 at 13:23
  • Sure, using Twitter to contact vs-corodova product team can help, https://twitter.com/VSCordovaTools , also you can try VS 2019 that is in preview here: https://visualstudio.microsoft.com/vs/preview/ may be it is better, best of luck – Manohar Reddy Poreddy Jan 08 '19 at 15:23
  • Unfortunately, VS 2019 preview doesn't contain cordova. – Dorad Jan 11 '19 at 13:56
  • Sad again from MS, possibly they will add in future. I have updated my answer at the end, try those. – Manohar Reddy Poreddy Jan 12 '19 at 08:07
  • 1. In vs, try 'clear cordova cache' and rebuild. If not ok, then 2. try to create a new cordova project and build. If not ok, show me the error log. If ok, add the api in your old project to this new project 'One By One', and rebuild after adding each api. Some api simply do not work at all. – Kenneth Li Jan 12 '19 at 18:27
  • Some environment-related things here: https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#requirements-and-support – Manohar Reddy Poreddy Feb 26 '19 at 13:29
  • @Dorad if any consolation, i used only cordova tools, and created a sample app that I verified it works in android, browser & windows. see updated answer, & README file suggests how to run. – Manohar Reddy Poreddy Feb 28 '19 at 19:30