Unsupported method: GradleProject.getBuildScript() - gradle

I am getting this error while importing an adt project(after exporting and creating gradle file) into Android Studio on mac os x.
The android-studio version is 3.6 (latest) and the gradle version is 1.8 (latest).
The error shows up as:
Unsupported method: GradleProject.getBuildScript(). The version of
Gradle you connect to does not support that method. To resolve the
problem you can change/upgrade the target version of Gradle you
connect to. Alternatively, you can ignore this exception and read
other information from the model.
Consult IDE log for more details (Help | Show Log)
I have no idea where to look for IDE logs...

I was getting a similar error today opening a project after upgrading to Android Studio 0.3.6. Here is what I had to change to get it working again for me.
Changed the following line in gradle-wrapper.properties from gradle-1.6-bin.zip to gradle-1.8-bin.zip
distributionUrl=http://services.gradle.org/distributions/gradle-1.8-bin.zip
Also changed the following line in build.gradle from 0.5.+ to 0.6.+
classpath 'com.android.tools.build:gradle:0.6.+'
In Windows, gradle-wrapper.properties is located at \project folder\gradle\wrapper\gradle-wrapper.properties
build.gradle is located at \project folder\module folder\build.gradle
The Files that Needed changed are highlighted in the project explorer screen shot below.
After those changes I sync'd the project with the gradle files and then could build and test.
Hope that helps.
Note that you should use default or customizable gradle wrapper:

Related

gradle-wrapper.properties not found after clean install intellij idea 2020.1.2 community edition on windows 10

Installed clean windows10(1607) and intellij idea(2020.1.2 community edition). When i create new gradle project
Invalid Gradle JDK configuration found. Open Gradle Settings
"gradle-wrapper.properties not found".
How can I fix it?
Install gradle 6.7
sdk install gradle 6.7
brew install gradle
Go to IntelliJ and set gradle version:
On File >> Settings >> Build, Execution , Deployment >> Gradle
or
Preferences >> Gradle
In Use Gradke from specific the correct location
If IDEA is set to use the Gradle wrapper (as it is in your screenshot: "Use Gradle from:" is set to "gradle-wrapper.properties"), IDEA expects the following file structure:
Gradle wrapper JAR: [project root]/gradle/wrapper/gradle-wrapper.jar
Gradle wrapper properties: [project root]/gradle/wrapper/gradle-wrapper.properties
Gradle wrapper script: [project root]/gradlew.bat
If you are missing one of these three elements, IDEA will attempt to generate the wrapper by calling the gradle wrapper task. It will do this using the Gradle JDK, which may or may not be the project SDK (File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JVM).
I'm not sure how it selects the version of Gradle it uses - I only have 6.8.3 installed on my machine, and I had my wrapper properties set to 7.0-rc-1, yet somehow it used 6.7.0 when generating the wrapper.
I tried various options for clearing the cache, but did not get the result.
Openjdk-14 installed by default and does not work. From site adoptopenjdk.net install OpenJDK 11 (LTS). When creating the project, I chose 11 version. Then the program suggested updating gradle to version 6 and it worked.
I ran into this problem a while ago when I upgraded to intellij 2020.* The first time I created a new project there was no problem: gradle daemon did its work and the project was created with no problems.
In my case, the project would start a new gradle daemon, and attempt to build the project, would get rejected by windows Security, and nothing would happen, so intellij goes ahead and starts another (unsuccessful) daemon. Soon, I had 20+ gradle daemon processes running on my system, all of them doing nothing.
So, it looks like intellij has messed in enabling that it places the appropriate permissions it requires for these folders that it depends on to run properly. So, you need to manually give these permissions, and then things (should) work.
The real issue here is security on your machine: either a virus checker or the security software, Windows Security on Windows 10, for example. The first time you make a project, Intellij goes and produces a number of folders that they need access to.
However, once these folders are available, for whatever, intellij doesn't make sure to give itself access.
On windows 10, in AppData, you'll find several folders required by Intellij to produce, in my case, produce gradle projects.
Try finding the various folders that Intellij has produced on your system, and give them exceptions on your virus checker and on whatever firewall/security software programs that may block access.

Android build failed: Could not resolve all files for configuration ':debugCompileClasspath'

I'm new to Android development and keep running into this specific error when I try building my test app via the Windows command: python setup.py android -s:
Could not resolve all files for configuration ':debugCompileClasspath'
Could not find com.android.support:appcompat-v7:25.1.1.
So how do I resolve all files for configuration?
After several hours of troubleshooting, related answers to this question have not worked for me. For instance, I have tried manipulating my build.gradle file in the following manner:
Modified maven() to maven {url "https://maven.google.com" }
Modified jcenter() to jcenter { url "http://jcenter.bintray.com/" }
Moved jcenter... to be the last item in the list under repositories { .... (there is no allprojects { ... category)
Added buildToolsVersion "27.0.3" under android { ....
Modified the classpath version to the latest gradle version 3.1.0 like so classpath 'com.android.tools.build:gradle:3.1.0' (it was initially using an out of date version)
Updated Android Studio IDE
Uninstalled and reinstalled all SDK-tools under the SDK Manager
(Full build.gradle here, on pastebin)
The only remaining helpful hint I have here is the information provided by the log.
It tells me that it can't find files in directories on my hard drive. All other related outputs I've seen from others is the location specifiying actual websites related to google or gradle.
Could not resolve all files for configuration ':debugCompileClasspath'.
> Could not find com.android.support:appcompat-v7:25.1.1.
Searched in the following locations:
file:/C:/Users/USERNAME/AppData/Local/Android/sdk/extras/m2repository/com/android/support/appcompat-v7/25.1.1/appcompat-v7-25.1.1.pom
file:/C:/Users/USERNAME/AppData/Local/Android/sdk/extras/m2repository/com/android/support/appcompat-v7/25.1.1/appcompat-v7-25.1.1.jar
file:/C:/Users/USERNAME/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/25.1.1/appcompat-v7-25.1.1.pom
file:/C:/Users/USERNAME/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/25.1.1/appcompat-v7-25.1.1.jar
file:/C:/Users/USERNAME/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/25.1.1/appcompat-v7-25.1.1.pom
file:/C:/Users/USERNAME/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/25.1.1/appcompat-v7-25.1.1.jar
I also have this error, which may or may not contribute to the files not being in the specified directory:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.7/userguide/command_line_interface.html#sec:command_line_warnings
Can anyone help me troubleshoot this issue and essentially resolve all files for configuration so that I can run my test app? Any help is greatly appreciated. Feel free to let me know if there's any additional I can provide.

Eclipse JDT LS & Gradle - Resource Exception "Invalid project description"

Summary
I've been trying to get Eclipse's JDT LS (JLS) working with vim-lsp (in Neovim), but have been unsuccessful in synchronising the JLS with a Gradle project. I am, unfortunately, constrained to Windows.
The Problem
Using this configuration (commit #d1c7a25 at the time of posting), I cannot synchronise the JLS with a Gradle project "due to an error configuring Eclipse" because of an "invalid project description" (see log).
Trawling through Google and the GitHub issues of both the JLS and vim-lsp plugin has gotten me nowhere.
Remarks
I feel like it's most likely an issue with my configuration. If anyone has got this working with other LSP plugins aside from YouCompleteMe (such as CoC or LanguageClient) those setups are also welcome, but vim-lsp is preferred.
To reiterate, and just in case:
Windows 10 Pro (v1803 build 17134.407)
Neovim (v0.3.1) with plugin vim-lsp
Gradle wrapper (v4.10.2)
Eclipse JDT LS (v0.28.0 build 201811140630) [.tar.gz]
using this configuration (originally #d1c7a25)
Thanks!
Figured it out.
The workspace directory for the JLS (specified by the command line argument -data) can't be nested under the project's own directory.
*bashes head on desk*

Run Corda project on IntelliJ

I'm using a MacBook Air OS X 10.9 (Mavericks) and IntelliJ IDEA, but the IDE won't let me execute the test "ProjectImportedOKTest" which is in src/test/java/java_bootcamp/. I followed the exact same steps of this video:
https://www.youtube.com/watch?v=ZgKxjwImKAs&index=3&list=PLi1PppB3-YrVq5Qy_RM9Qidq0eh-nL11N
But for some reason my green arrow to run the test is always disabled. It could be something with the configuration option in the top left of IntelliJ, which I left blank or even something with gradle.
Thanks a lot!!
You can invalidate the caches of the intelliJ by using the option
file -> invalidate caches/Restart.
It helped for me.
There are several things you could try.
Ensure that your source java or kotlin folder is marked as "Sources Root". Do this by right clicking the folder and selecting "Mark Directory as"
Go to view -> Tool Windows -> Gradle and hit the refresh icon
Try opening the project a different way, such as importing the project or just opening the project
Rebuild the project and ensure there are no errors
Go to File -> Project Structure and ensure Java 1.8 is set as the Project SDK
Got to File -> Settings 0> Build, Execution, Deployment and select Gradle. Ensure Gradle JVM has Java 1.8 and that "Use default gradle wrapper" is selected.
Again under Settings and Build, Execution, Deployment, go to Compiler -> Kotlin Compiler and check that Target JVM version is set to 1.8
I ran into the same problem running on Windows and ran into this question trying to find the solution. It turns out Gradle wasn't installed on my machine and that was causing the problems.
According to the Corda Docs - "Gradle - we use 4.10 and the gradlew script in the project / samples directories will download it for you."
However, I installed from the Gradle website here - https://gradle.org/install/#with-a-package-manager -and configured it in the PATH variable. After doing so, my green arrow was enabled and I was able to run the test successfully.

Project won't compile in IntelliJ IDEA after adding Maven support because of complaints about the JDK version

I'm using IntellJ 14.1.4 Community Edition
My project compiled fine before (I have it set up to use the Eclipse compiler)
But I tried to Mavenize it...
I added Maven via the Add Framework | Maven command
Now my problem is (still using the Eclipse Compiler)...
It gives me error messages like:
Error:(21, 78) java: '<>' operator is not allowed for source level below 1.7
Which leads me to suspect that it is not compiling to 1.8
However, I didn't change anything other than Mavenizing it
The Project SDK in IDEA is set to use 1.8
I did notice some setting about bytecode being 1.5.. but i tried to change that to 1.8 but still get this error message.
Anyone have any clue what's going on?
this was essentially the correct advice of course - in the comments, however I had been trying to do it for a long time both via maven-compiler-plugin and properties... to no success, even though I was refreshing Maven after making changes to pom.xml. Finally, I restarted the IDE .. and .. it works! I can compile..

Resources