2 Replies Latest reply on Jun 25, 2016 12:05 PM by 1193581561

    I can't build a PhoneGap app.

    1193581561

      I just created a new PhoneGap application, tried to build it with PhoneGap cli and the following error occured. But it builds without errors if I use build.phonegap.com. How to build it by PhoneGap cli?

       

      PS P:\Applications\Android\MyPhoneGapFirstApp> phonegap build android

      (node:3984) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

      [phonegap] executing 'cordova build android ' ...

      ANDROID_HOME=C:\Users\Хакер\AppData\Local\Android\sdk

       

      JAVA_HOME=C:\Program Files\java\jdk1.7.0_25

       

      :preBuild

      UP-TO-DATE

      :preDebugBuild

      UP-TO-DATE

      :checkDebugManifest

      :CordovaLib:preBuild

      UP-TO-DATE

      :CordovaLib:preDebugBuild

      UP-TO-DATE

      :CordovaLib:compileDebugNdk

      UP-TO-DATE

      :CordovaLib:compileLint

      :CordovaLib:copyDebugLint

      UP-TO-DATE

      :CordovaLib:mergeDebugProguardFiles

      :CordovaLib:packageDebugRenderscript

      UP-TO-DATE

      :CordovaLib:checkDebugManifest

      :CordovaLib:prepareDebugDependencies

      :CordovaLib:compileDebugRenderscript

      :CordovaLib:generateDebugResValues

      :CordovaLib:generateDebugResources

      :CordovaLib:packageDebugResources

      :CordovaLib:compileDebugAidl

      :CordovaLib:generateDebugBuildConfig

      :CordovaLib:generateDebugAssets

      UP-TO-DATE

      :CordovaLib:mergeDebugAssets

      :CordovaLib:processDebugManifest

      :CordovaLib:processDebugResources

      :CordovaLib:generateDebugSources

      :CordovaLib:compileDebugJavaWithJavac

      Note: Some input files use or override a deprecated API.

      Note: Recompile with -Xlint:deprecation for details.

      :CordovaLib:processDebugJavaRes

      UP-TO-DATE

      :CordovaLib:transformResourcesWithMergeJavaResForDebug

      :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

      :CordovaLib:mergeDebugJniLibFolders

      :CordovaLib:transformNative_libsWithMergeJniLibsForDebug

      :CordovaLib:transformNative_libsWithSyncJniLibsForDebug

      :CordovaLib:bundleDebug

      :prepareAndroidCordovaLibUnspecifiedDebugLibrary

      :prepareDebugDependencies

      :compileDebugAidl

      :compileDebugRenderscript

      :generateDebugBuildConfig

      :generateDebugAssets

      UP-TO-DATE

      :mergeDebugAssets

      :generateDebugResValues

      :generateDebugResources

      :mergeDebugResources

      :processDebugManifest

      :processDebugResources

      :generateDebugSources

      :compileDebugJavaWithJavac

      Note: Some input files use or override a deprecated API.

      Note: Recompile with -Xlint:deprecation for details.

      Note: Some input files use unchecked or unsafe operations.

      Note: Recompile with -Xlint:unchecked for details.

      :compileDebugNdk

      UP-TO-DATE

      :compileDebugSources

      :transformClassesWithDexForDebug

      java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

       

              at java.lang.ClassLoader.defineClass1(Native Method)

              at java.lang.ClassLoader.defineClass(ClassLoader.java:792)

              at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

              at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

              at java.net.URLClassLoader.access$100(URLClassLoader.java:71)

              at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

       

       

              at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

              at java.security.AccessController.doPrivileged(Native Method)

       

       

              at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

       

       

              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

              at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

      Exception in thread "main"

       

      FAILED

       

      FAILURE:

      Build failed with an exception.

       

      * What went wrong:

       

      Execution failed for task ':transformClassesWithDexForDebug'.

       

      >

      com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_25\bin\java.exe'' finished with non-zero exit value 1

       

      * 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: 9.468 secs

       

      java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

       

              at java.lang.ClassLoader.defineClass1(Native Method)

              at java.lang.ClassLoader.defineClass(ClassLoader.java:792)

              at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

              at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

              at java.net.URLClassLoader.access$100(URLClassLoader.java:71)

              at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

              at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

              at java.security.AccessController.doPrivileged(Native Method)

              at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

       

              at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

              at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

      Exception in thread "main"

       

      Error: Error code 1 for command: cmd with args: /s,/c,"P:\Applications\Android\MyPhoneGapFirstApp\platforms\android\gradlew cdvBuildDebug -b P:\Applications\Android\MyPhoneGapFirstApp\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"

       

      PS P:\Applications\Android\MyPhoneGapFirstApp>

       

      Adding the following code to gradle.build doesn't work:

       

      dexOptions {

              javaMaxHeapSize "4g"

          }

       

      This also doesn't work:

       

      android {

          compileSdkVersion 21

          buildToolsVersion "21.1.0"

       

          defaultConfig {

              ...

              minSdkVersion 14

              targetSdkVersion 21

              ...

       

              // Enabling multidex support.

              multiDexEnabled true

          }

          ...

      }

       

       

      dependencies {

        compile 'com.android.support:multidex:1.0.0'

      }