setup-ionic icon indicating copy to clipboard operation
setup-ionic copied to clipboard

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

Open omkarpattanaik opened this issue 3 years ago • 8 comments

Hello everyone,

I tried creating an android package using these steps but I am getting error.

 runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-java@v2
      with:
       distribution: 'adopt' # See 'Supported distributions' for available options
       java-version: '8'
    - name: Use coturiv/setup-ionic
      uses: ./
    - name: Run cordova project tests
      run: |
        ionic start testapp blank --cordova --type angular --no-link --no-git --no-interactive --confirm
        cd testapp
        ionic cordova platform add android@latest
        ionic cordova build android

Action Error Logs:


You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 13s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Downloading https://services.gradle.org/distributions/gradle-7.1.1-all.zip
..............10%...............20%...............30%...............40%..............50%...............60%...............70%...............80%..............90%...............100%
Observed package id 'ndk;21.4.7075529' in inconsistent location '/usr/local/lib/android/sdk/ndk-bundle' (Expected '/usr/local/lib/android/sdk/ndk/21.4.7075529')
Build-tool 31.0.0 is missing DX at /usr/local/lib/android/sdk/build-tools/31.0.0/dx
Observed package id 'ndk;21.4.7075529' in inconsistent location '/usr/local/lib/android/sdk/ndk-bundle' (Expected '/usr/local/lib/android/sdk/ndk/21.4.7075529')
File /home/runner/.android/repositories.cfg could not be loaded.

Observed package id 'ndk;21.4.7075529' in inconsistent location '/usr/local/lib/android/sdk/ndk-bundle' (Expected '/usr/local/lib/android/sdk/ndk/21.4.7075529')
FAILURE: Build failed with an exception.
Build-tool 31.0.0 is missing DX at /usr/local/lib/android/sdk/build-tools/31.0.0/dx


* What went wrong:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
> Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 46s
Command failed with exit code 1: /home/runner/work/setup-ionic/setup-ionic/testapp/platforms/android/gradlew cdvBuildDebug -b /home/runner/work/setup-ionic/setup-ionic/testapp/platforms/android/build.gradle
[ERROR] An error occurred while running subprocess cordova.
        
        cordova build android exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.

From what I could understand from the logs is it could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

So I also tried using this

- uses: actions/setup-java@v1
      with:
        java-version: 1.8

and

    - uses: actions/setup-java@v2
      with:
       distribution: 'adopt' # See 'Supported distributions' for available options
       java-version: '11'

but still I am facing the same error as above.

I also tried creating the same in my local machine and build was successful.

Can someone plz help ?

Thanks you in advance.

omkarpattanaik avatar Jul 24 '21 08:07 omkarpattanaik

Have you solved your problem? I'm having an similar error, but for me is Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.

It seens to be related to build tools version as you can see on this line Build-tool 31.0.0 is missing DX at /usr/local/lib/android/sdk/build-tools/31.0.0/dx on my machine it runs at build tool version 29, and looking up in the internet it seens that this version has this problem

Is there a way to change this build tool version? I already have android-minSdkVersion on my config.xml

spacedog4 avatar Aug 13 '21 13:08 spacedog4

# Workaround to use older build-tools on Github virtual-environments # See: https://stackoverflow.com/a/68488745/2087831 - run: $ANDROID_SDK_ROOT/tools/bin/sdkmanager --uninstall 'build-tools;31.0.0' name: Remove build-tools version 31

this works in the Fastlane + Github Actions setup that I’m using.

kevinboosten avatar Aug 13 '21 21:08 kevinboosten

Thank You @kevinboosten

Build-tool 31.0.0 installed in virtual environment was causing this error. Adding your solution worked for me

- name: Uninstall  build-tool version 31.0.0
  run: $ANDROID_SDK_ROOT/tools/bin/sdkmanager --uninstall 'build-tools;31.0.0'

Also i had to remove
ionic cordova platform add android@latest uses ([email protected])
and add ionic cordova platform add android uses ([email protected])

As [email protected] was also causing app:compileReleaseJavaWithJavac FAILED

Task :app:compileReleaseJavaWithJavac FAILED ^ symbol: class Whitelist location: package org.apache.cordova /home/runner/work/setup-ionic/testapp /platforms/android/app/src/main/java/org/apache/cordova/whitelist/WhitelistPlugin.java:32: error: cannot find symbol private Whitelist allowedNavigations; ^ symbol: class Whitelist location: class org.apache.cordova.whitelist.WhitelistPlugin /home/runner/work/setup-ionic/testapp /platforms/android/app/src/main/java/org/apache/cordova/whitelist/WhitelistPlugin.java:33: error: cannot find symbol

Modified Working Workflow:

runs-on: ubuntu-latest
   steps:
   - uses: actions/checkout@v2
   - uses: actions/setup-java@v2
     with:
      distribution: 'adopt' # See 'Supported distributions' for available options
      java-version: '8'
   - name: Use coturiv/setup-ionic
     uses: coturiv/[email protected]

   - name: Uninstall 31.0.0 Build tool
     run: $ANDROID_SDK_ROOT/tools/bin/sdkmanager --uninstall 'build-tools;31.0.0'

   - name: Run cordova project tests
     run: |
       ionic start testapp blank --cordova --type angular --no-link --no-git --no-interactive --confirm
       cd testapp
       ionic cordova platform add android
       ionic cordova build android

omkarpattanaik avatar Aug 14 '21 11:08 omkarpattanaik

If not, open your Android project part in Android Studio to install all necessary tools for Android development under Ionic. It solves my problems

bazini avatar Oct 06 '21 10:10 bazini

I have the same issue when run 'ionic cordova build android'. The output is as: FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.

Installed Build Tools revision 33.0.0-rc4 is corrupted. Remove and install again using the SDK Manager.

I re-install the Android SDK Build-tools 33.00rc4, does not solve this issue. I then open file ...\platforms\android\build.gradle, it's said "defaultBuildToolsVersion="29.0.2"". After I uninstalling current revision and installing revision 29.0.2 of Android SDK Build-tools, I passed the 'ionic cordova build android'!

zdhiu avatar May 17 '22 23:05 zdhiu

I have the same problem but i use flutter in Android studio

etiennejoel avatar Mar 03 '23 12:03 etiennejoel

How can i do?

etiennejoel avatar Mar 03 '23 12:03 etiennejoel

Any commnets on this issue ?

image

image

subins829 avatar Oct 16 '23 15:10 subins829