0 Replies Latest reply on Oct 10, 2018 1:41 AM by benr48764503

    PhoneGap CLI issue with Gradle

    benr48764503 Level 1

      Hello, I will try to detail this issue as much as I can as it has been driving me crazy for 3 days. Steps: Phonegap CLI was working fine until I decide to update Android Studio from 3.0 to 3.2 Scripts versions:

       

      PS C:\laragon\www\keep-android> gradle --version

       

       

       

      Kotlin DSL:   1.0-rc-6

      Kotlin:       1.2.61

      Groovy:       2.4.15

      Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018

      JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)

      OS:           Windows 10 10.0 amd64

      phonegap 8.0.0

      gradle       4.10.2

      node         8.12.0

       

       

      When I run this command via the CLI:

      PS C:\laragon\www\keep-android> phonegap run -d android

       

       

      I get this error:

       

      [phonegap] executing 'cordova run -d android' ...
      No scripts found for hook "before_run".
      
      
      No scripts found for hook "before_prepare".
      
      
      Checking config.xml and package.json for saved platforms that haven't been added to the project
      
      
      Config.xml and package.json platforms are the same. No pkg.json modification.
      
      Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
      
      PlatformApi successfully found for platform android
      
      
      Android Studio project detected
      
      
      Checking config.xml for saved plugins that haven't been added to the project
      
      
      Checking for any plugins added to the project that have not been installed in android platform
      
      
      No differences found between plugins added to project and installed in android platform. Continuing...
      
      
      Generating platform-specific config.xml from defaults for android at C:\laragon\www\keep-android\platforms\android\app\src\main\res\xml\config.xml
      
      
      Merging project's config.xml into platform-specific android config.xml
      
      
      Merging and updating files from [www, platforms\android\platform_www] to platforms\android\app\src\main\assets\www
      
      
        copy platforms\android\platform_www\cordova_plugins.js platforms\android\app\src\main\assets\www\cordova_plugins.js (updated file)
      
      
      Wrote out android application name "Keep Android" to C:\laragon\www\keep-android\platforms\android\app\src\main\res\values\strings.xml
      
      
      android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000
      
      
      Wrote out Android package name "com.keep" to C:\laragon\www\keep-android\platforms\android\app\src\main\java\com\keep\MainActivity.java
      
      
      Updating icons at platforms\android\app\src\main\res
      
      
      Updating splash screens at platforms\android\app\src\main\res
      
      This app does not have additional resource files defined
      
      Prepared android project successfully
      
      No scripts found for hook "after_prepare".
      
      
      ANDROID_HOME=C:\Users\Ben\AppData\Local\Android\Sdk
      
      JAVA_HOME=C:\Program Files\Java\jdk1.8.0_181
      
      studio
      
      Subproject Path: CordovaLib
      
      Subproject Path: app
      
      Running command: cmd "/s /c "C:\laragon\www\keep-android\platforms\android\gradlew.bat cdvBuildDebug -b C:\laragon\www\keep-android\platforms\android\build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true""
      
      
      Exception in thread "main"
      java.lang.RuntimeException: Could not load wrapper properties from 'C:\laragon\www\keep-android\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
        at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
        at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:60)
      Caused by: java.lang.RuntimeException: No value with key 'distributionUrl' specified in wrapper properties file 'C:\laragon\www\keep-android\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
        at org.gradle.wrapper.WrapperExecutor.reportMissingProperty(WrapperExecutor.java:135)
        at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:78)
        at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
        at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
        ... 2 more
      
      Command finished with error code 1: cmd /s /c "C:\laragon\www\keep-android\platforms\android\gradlew.bat cdvBuildDebug -b C:\laragon\www\keep-android\platforms\android\build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true"
      
      
      (node:8024) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
      Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\laragon\www\keep-android\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
        at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
        at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:60)
      Caused by: java.lang.RuntimeException: No value with key 'distributionUrl' specified in wrapper properties file 'C:\laragon\www\keep-android\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
        at org.gradle.wrapper.WrapperExecutor.reportMissingProperty(WrapperExecutor.java:135)
        at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:78)
        at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
        at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
        ... 2 more
        at ChildProcess.whenDone (C:\laragon\www\keep-android\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
        at ChildProcess.emit (events.js:182:13)
        at maybeClose (internal/child_process.js:961:16)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
      
      (node:8024) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
      (node:8024) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
      
      [phonegap] completed 'cordova run -d android --no-telemetry'

       

       

       

      What I have tried the last 3 days:

      I uninstalled everything including Phonegap, android studio, node, jdk

      Reinstalled everything, same issue.

       

       

      I tried to get to the file:

      C:\laragon\www\keep-android\platforms\android\cordova\lib\builders\GradleBuilder.js

       

       

      And change

       

      var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-4.1-all.zip';

      to

      var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'file:///c:/laragon/gradle-4.1-all.zip';

       

       

      Same issue unfortunately.

       

       

      One thing I have noticed is that my platforms\android\gradle\wrapper\gradle-wrapper.properties has no data in it, is this normal?

       

      As the error seems to be pointing to this file.

       

       

      Thank you.