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

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

Open
omkarpattanaik opened this issue Jul 24, 2021 · 9 comments

Comments

@omkarpattanaik
Copy link

omkarpattanaik commented Jul 24, 2021

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.

@spacedog4
Copy link

spacedog4 commented Aug 13, 2021

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

@kevinboosten
Copy link

# 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.

@omkarpattanaik
Copy link
Author

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

@bazini
Copy link

bazini commented Oct 6, 2021

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

@zdhiu
Copy link

zdhiu commented May 17, 2022

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'!

@etiennejoel
Copy link

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

@etiennejoel
Copy link

How can i do?

@subins829
Copy link

subins829 commented Oct 16, 2023

Any commnets on this issue ?

image

image

@Will-at-FreedomDev
Copy link

I setup Android via command line to avoid Android studio and I setup my ANDROID_HOME & ANDROID_SDK_ROOT paths incorrectly. I had them set to C:\Android\cmd-line-tools but it had to be changed to the parent directory of cmd-line-tools (C:\Android). That's all it was.

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

8 participants