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

Gradle 6.5 - "Could not find method leftShift()" #425

Open
3 tasks done
dansolhan opened this issue Sep 30, 2020 · 6 comments · May be fixed by #472
Open
3 tasks done

Gradle 6.5 - "Could not find method leftShift()" #425

dansolhan opened this issue Sep 30, 2020 · 6 comments · May be fixed by #472
Labels

Comments

@dansolhan
Copy link

Bug Report

gradle.extras fail with gradle 6.5

Problem

When using gradle 6.5 to build a cordova Android app, the build crashes with the following error:

"A problem occurred evaluating project ':app'.
Could not find method leftShift() for arguments [build_extras_iirp9rj48r4etl69rhtwhtw1$_run_closure1$_closure2@49b383e8] > on task ':app:cdvCreateAssetManifest' of type org.gradle.api.DefaultTask."

What is expected to happen?

It is expected to build without issues.

What does actually happen?

See problem.

Information

This seems to relate to the fact that the << - notation is deprecated in newer gradle versions.
https://stackoverflow.com/questions/55793095/could-not-find-method-leftshift-for-arguments-after-updating-studio-3-4

Command or Code

building a cordova app to Android

Environment, Platform, Device

Fresh installed Ubuntu with the Angular/Cordova stack.

Version information

Angular: 10.0.14
Cordova: 10
cordova-plugin-file: 6.0.2
Gradle 6.5

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@breautek
Copy link
Contributor

breautek commented Oct 1, 2020

It appears to be caused by

def newTask = task("cdvCreateAssetManifest") << {

However I don't see anywhere how this gradle file is included, and for me this gradle file doesn't actually run. Would you mind sharing a sample reproduction app?

@steinjak
Copy link

steinjak commented Oct 2, 2020

@breautek I think you have to add it manually according to the instructions here: https://github.com/apache/cordova-plugin-file#slow-recursive-operations-for-android_asset

Listing asset directories is really slow on Android. You can speed it up though, by adding src/android/build-extras.gradle to the root of your android project (also requires [email protected] or greater).

@timbru31
Copy link
Member

timbru31 commented Oct 3, 2020

I think this is a low hanging fruit to fix - any Hacktoberfest volunteers here? :)

@dansolhan
Copy link
Author

I know how to fix it, honestly. Just remove the << and wrap the whole block inside a doLast { } - block.
I'm sorry if the solution was unclear, it was on the link I sent.

and @steinjak is right. The script is added manually. It is possible to make changes to it locally and using this version, but I felt it was in good sport to have a non-deprecated version of the script included.

@breautek
Copy link
Contributor

breautek commented Oct 3, 2020

I see. I wonder if there is any reason why this is an opt-in.

Imo the plugin should just include the gradle reference automatically.

@breautek
Copy link
Contributor

breautek commented Oct 3, 2020

I know how to fix it, honestly. Just remove the << and wrap the whole block inside a doLast { } - block.
I'm sorry if the solution was unclear, it was on the link I sent.

and @steinjak is right. The script is added manually. It is possible to make changes to it locally and using this version, but I felt it was in good sport to have a non-deprecated version of the script included.

PR is welcome, I just wanted to make sure the code that appeared to be offending was actually something used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants