How do I start seeing an Event Log message that I chose to not see again? - intellij-idea

In my Event Log in Intellij IDEA 2016, I used to see this message:
Unlinked Gradle project?
Import Gradle project, this will also enable Gradle Tool Window.
Don't want to see the message for the project again: press here.
At some point, I clicked on the "press here" link indicating that I don't want to see the message again. Since then, I have decided that I'd like to see it again.
How do I start seeing this Event Log message that I chose to not see again?

You can re-enable notifications balloon popups and logs from the (obviously) Notifications settings window, which you can open in (at least) 2 ways:
1) From the Event log window click on the settings button
2) File -> Settings -> Appearance & behaviour -> Notifications

I just tried the specific notification that has been asked about (Unlinked Gradle Project?). The only way that I found to re-enable the notification was to delete the .idea folder inside the project and re-open the project in Intellij.
Other notifications, such as Maven: non-managed pom.xml work as expected so this bug is specific to the Unlinked Gradle Project? notification.
This appears to be a bug in Intellij Idea as of this build:
IntelliJ IDEA 2016.2.5
Build #IU-162.2228.15, built on October 14, 2016
JRE: 1.8.0_112-release-287-b2 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
I have raised an issue for this : https://youtrack.jetbrains.com/issue/IDEA-162936
Also, I found that these notification settings are not stored in a project specific file. This file, on OSX, is ~/Library/Preferences/IntelliJIdea2016.2/options/notifications.xml, on Windows it would reside in a folder according to this.
These were the contents of the file for me, when I was testing this notification:
<application>
<component name="NotificationConfiguration">
<notification groupId="Gradle Notification Group" shouldReadAloud="true" />
<notification groupId="Maven: non-managed pom.xml" displayType="STICKY_BALLOON" shouldLog="false" />
<notification groupId="Project Startup Tasks Messages" displayType="STICKY_BALLOON" />
</component>
</application>
I noticed that changing the Popup Type for 'Gradle Notification Group' correctly updates ~/Library/Preferences/IntelliJIdea2016.2/options/notifications.xml, however even when the Popup type is 'BALLOON' or 'STICKY_BALLOON', it does not result in Intellij re-notifying the user about the Unlinked gradle project.

Related

Can't get kotlin "hello world" example to Run in intelliJ

I'm following the intelliJ IDEA tutorial titled Create your first Kotlin application
(Last modified: 08 March 2021). Here are the various versions I'm using:
~$ java -version
java version "16" 2021-03-16
Java(TM) SE Runtime Environment (build 16+36-2231)
Java HotSpot(TM) 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)
~$ javac -version
javac 16
Here's my code:
fun main(args: Array<String>) {
println("What is your name?")
val name = readLine()
println("Hello $name")
}
Here's what my project structure looks like:
I notice that it says "Kotlin not configured" above my code, but when I go to Tools > Kotlin > Configure Kotlin in Project, I get
:
In the Event Log pane, I see this:
4/15/21
1:54 PM Download pre-built shared indexes
Reduce the indexing time and CPU load with pre-built JDK shared indexes
Always download
Download once
Don't show again
Configure...
1:54 PM Gradle sync started
1:54 PM Gradle sync failed: Unsupported class file major version 60 (5 s 329 ms)
1:55 PM No IDE or plugin updates available
In the Problems(?) pane, I see this:
Unresolved reference: println
Unresolved reference: readLine
Unresolved reference: println
Parameter 'args' is never used
Package directive doesn't match file location
Any ideas on why the basic functions in my program are not recognized?
Thanks for looking!
Edit: I tried downloading JDK 15 and specifying that in my Project Structure, but I got the same results:
try build>clean project.
As for your unresolved references, you can double-click/left-click > show context options. If that doesn't work then maybe reinstall InteliJ Idea or download Android Studio which has a lot more support on google and yt.
Okay, I got it working. I'll try to figure out what I did.
tldr; I had to switch from JDK 16 to JDK 15 to get my hello world console application to run.
First, when I was setting up the project, I chose the wrong Project Template: I selected JVM - Application rather than JVM - Console Application. This is what I needed to do:
So, I started a new project, chose the right template, and I typed in my code, and I noticed a Build pane at the bottom left displayed:
I tried Build > Build Project, and nothing changed. So, I tried the Run menu item: the first section of the Run menu was grayed out, but there was another Run command in the second section of the Run menu. I selected that Run, and a little window popped up with the following:
Run
0 Edit Configurations
The "0 Edit Configurations" line was highlighted, and I got nowhere trying to figure out how to Run my code.
So, I started yet another new project, and this time I selected a different JDK, version 15:
After clicking Next, then Finish, I typed in my code, and this time the Build pane looked like the following (without me doing anything but typing in my code):
After I finished typing in my code, as the tutorial described, this time there was a little green arrow in the gutter:
When I clicked on the green arrow in the gutter, I could successfully Run my program.
So, it appears that you cannot use JDK 16, and you have to use JDK 15. intelliJ was able to detect all my installed Java versions, so any version you have installed should appear as a choice in the the project settings. You may have to quit intelliJ, then restart intelliJ after you install JDK 15 in order to see it listed as a choice under Project JDK: when you create a project.

How to add JVMOptions in a JavaFX bundle created on Intellij Idea

I'm trying to bundle a JavaFX application adding a JVMOption to able virtual keyboard in my software, adding the "VM options" in the "Run/Debug Configurations" form works perfect in a test context, but when I build a DMG bundle and then run the app the keyboard is not shown. When I inspect the package content directly from the Application folder I found that the file "Content/Java/project.cfg" doesn't have JVM options
[Application]
app.name=Project
app.mainjar=Project.jar
app.version=0.6.1
app.preferences.id=Project_id
app.mainclass=co/Main
app.classpath=
app.runtime=$APPDIR/PlugIns/Java.runtime
app.identifier=Project_id
[JVMOptions]
[JVMUserOptions]
[ArgOptions]
If I add the option manually and save the file, the application works well showing the virtual keyboard.
[Application]
app.name=Project
app.mainjar=Project.jar
app.version=0.6.1
app.preferences.id=Project_id
app.mainclass=co/Main
app.classpath=
app.runtime=$APPDIR/PlugIns/Java.runtime
app.identifier=Project_id
[JVMOptions]
-Dcom.sun.javafx.isEmbedded=true
-Dcom.sun.javafx.touch=true
-Dcom.sun.javafx.virtualKeyboard=javafx
[JVMUserOptions]
[ArgOptions]
Does somebody know how to add these options without hacking any file? just adding it to a configuration file inside the project.
My project was created using Java 8, JavaFX, IntelliJ Idea CE (2019), Gradle 4.8
Add the following to your build.xml file:
<fx:platform basedir="${JAVA_HOME}">
<fx:property name="com.sun.javafx.isEmbedded" value="true"/>
<fx:property name="com.sun.javafx.touch" value="true"/>
<fx:property name="com.sun.javafx.virtualKeyboard" value="javafx"/>
</fx:platform>

Pycharm, keep getting Flow Tool panel with "Error: Flow executable path is incorrect"

After updating to Pycharm 2017.2.1 I got this Flow Tool panel (although not having flow installed) which pops up and I can not get rid of it.
This appears to be a bug. A workaround is mentioned:
edit .idea/workspace.xml and remove the
<component name="JsFlowSettings">
...
</component>
section
Another workaround which seemed to work for me:
select Flow under [file/settings/languages&frameworks/javascript] as Javascript Language version and untick all flow settings options that then appear.

Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'

I am a greenhorn in gradle and i just tried to create a new Android Gradle Project in IntelliJ. After filling up the necessities it started to download something which took hours so i decided to force quit my IDE and open the project again.
And now I am getting this:
And when I open the IDE logs, I see this:
2014-12-13 22:27:37,940 [103759372] INFO - .BaseProjectImportErrorHandler - Failed to import Gradle project at '/Users/ramswaroop/Documents/My Workspace/PopoPics'
org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'.
at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:124)
at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:112)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter.run(DefaultBuildActionExecuter.java:46)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.doResolveProjectInfo(GradleProjectResolver.java:177)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.access$300(GradleProjectResolver.java:63)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:363)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:335)
at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:214)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:95)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:63)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:41)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:51)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:137)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:123)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.execute(ExternalSystemUtil.java:475)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3$2.run(ExternalSystemUtil.java:552)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:621)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$3.run(ProgressManagerImpl.java:194)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.a(ProgressManagerImpl.java:281)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:233)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:181)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$9.run(ProgressManagerImpl.java:530)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:405)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
Caused by: java.nio.channels.OverlappingFileLockException
at sun.nio.ch.FileChannelImpl$SharedFileLockTable.checkList(FileChannelImpl.java:1166)
at sun.nio.ch.FileChannelImpl$SharedFileLockTable.add(FileChannelImpl.java:1068)
at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:868)
at java.nio.channels.FileChannel.tryLock(FileChannel.java:962)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:51)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:118)
at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:112)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
2014-12-13 22:27:37,941 [103759373] WARN - nal.AbstractExternalSystemTask - Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'.
com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'.
at org.jetbrains.plugins.gradle.service.project.AbstractProjectImportErrorHandler.createUserFriendlyError(AbstractProjectImportErrorHandler.java:106)
at org.jetbrains.plugins.gradle.service.project.BaseProjectImportErrorHandler.getUserFriendlyError(BaseProjectImportErrorHandler.java:158)
at org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension.getUserFriendlyError(BaseGradleProjectResolverExtension.java:401)
at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver.getUserFriendlyError(AndroidGradleProjectResolver.java:309)
at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(AbstractProjectResolverExtension.java:164)
at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(AbstractProjectResolverExtension.java:164)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:369)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:335)
at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:214)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:95)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:63)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:41)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:51)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:137)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:123)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.execute(ExternalSystemUtil.java:475)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3$2.run(ExternalSystemUtil.java:552)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:621)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$3.run(ProgressManagerImpl.java:194)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.a(ProgressManagerImpl.java:281)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:233)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:181)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$9.run(ProgressManagerImpl.java:530)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:405)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
2014-12-13 22:27:37,942 [103759374] WARN - radle.project.ProjectSetUpTask -
2014-12-13 22:27:37,942 [103759374] INFO - radle.project.ProjectSetUpTask - Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'.
Consult IDE log for more details (Help | Show Log)
INFO: Running on Mac Yosemite with Gradle 2.2 and IntelliJ IDEA 14 Ultimate.
It could be that the gradle-2.1 distribution specified by the wrapper was not downloaded properly. This was the root cause of the same problem in my environment.
Look into this directory:
ls -l ~/.gradle/wrapper/dists/
In there you should find a gradle-2.1 folder.
Delete it like so:
rm -rf ~/.gradle/wrapper/dists/gradle-2.1-bin/
Restart IntelliJ, after that it will restart the download from the beginning and hopefully work.
If you are on Windows, you can go to:
C:\Users\{your_name}\.gradle
And delete all the references of the gradle package you can find in those folders:
caches
daemon
wrapper
Then re-open your project and sync gradle
1 Close Android Studio (AS)
2 Delete the folder in C:\Users.gradle\wrapper\dists\gradle-2.1-all
3 Run as admin
4 Sync your project files
First check your Internet conection..
or try with
Tools -> Android -> Sync
or Try
File -> Settings -> Gradle -> Check Offline Work
I had the same problem.
(My problem is with gradle 4.4 files)
Actually the problem is incorrect downloading of 4.4 gradle which already I had.
When I delete gradle 4.4 version
C:\Users\$Your_User\.gradle\wrapper\dists\gradle-4.4-all
Android studio again downloads gradle-4.4 and syncs with my project.
Now it had rectified with the help of Michelin Man
Thanks for your answer Michelin
I cannot believe the below solution, but it did solve it.
in gradle-wrapper.properties file:
change
distributionUrl=http\://services.gradle.org/distributions/gradle-6.1.1-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
you should also check if you are connecting via proxy. If there is a proxy set it up using File > Settings > Appearance and Behavior > System settings > HTTP Proxy
https://services.gradle.org/distributions/gradle-2.1-all.zip
open this link in the browser and download the zip file and extract it to folder
Before extraction please delete the old folder whose name ends gradle-2.1-all and then you can start extracting
if you are window user extract it to this folder
C:\Users{Your-Name}.gradle\wrapper\dists
after that just restart your android studio.
I hope it works it works for me .
For me, it was just close the android studio and restart as Administrator.
If all above solutions is not working and In case of your project was working fine and now getting this issue, then try this,
go to android studio setting.
select gradle under build,execution.
then again just set path of gradle user home
(C:/Users/%user_name%/.gradle/wrapper/dists/gradle-6.5-bin)
just rebuild again, this helps me.
It could be that the corresponding Gradle version was not downloaded properly.
You could delete the broken file at
rm -rf .gradle/wrapper/dists/
and restart studio.
or try
File -> Settings -> Gradle -> Check Offline Work
and download the file from the official site and extract to the destination location
.gradle/wrapper/dists/
In my case, the problem was that I was not connected to the same VPN with which I installed Android Studio, I do not know why it happens, but even if I have internet access, if I am not connected to the original VPN, the downloads from IDE do not work correctly.
I connected the VPN, I did the gradle again and finally it started to download and install everything correctly.
I also checked that I didn't go through any proxy or anything similar in my Android configuration.
I recently had this same error, but it was due to an outbound firewall / monitoring tool silently killing the download requests in the background.
Sometimes the problem isn't Android Studio or your gradle configuration at all!
In Android Studio, if you open the Design window for the app, there is error message about Gradle being not synched properly. Next to the error, there is a 'Try Again' button. If you click on that, Android studio tries to sycn up again.
That worked for me.
In my case I had to go to
File -> Settings -> Build, Execution, Deployment -> Gradle
and then I changed the Service directory path, which was pointing to a wrong location.
Delete .gradle data
CtrlAltS then navigate to File -> Settings -> Build, Execution, Deployment -> Compiler then check "Sync project with gradle before building, if needed".
My problem was fixed with this method.
Change the distributionUrl=https://services.gradle.org/distributions/gradle-2.1-bin.zip from the Your project folder\gradle\wrapper\gradle-wrapper.properties to new one.
what worked for me is
distributionUrl=https://services.gradle.org/distributions/gradle-6.2.2-all.zip
One more reason for this error (assuming that gradle properly setup) is incompatibility between andorid.gradle tools and gradle itself - check out this answer for the complete compatibility table.
In my case the error was the same as in the question and the stacktrace as following:
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at com.android.build.gradle.BasePlugin.lambda$configureProject$1(BasePlugin.java:436)
at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
...
I've fixed that by upgrading com.android.tools.build:gradle to the current latest 3.1.4
buildscript {
repositories {
...
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
Gradle version is 4.6
I was facing the same problem in IntelliJ. It was working from command line though.
I found the issue was because of an improper Gradle config in the IDE. I wasn't using the "default Gradle wrapper" as recommended:
On MAC Remove gradle-2.1-all folder from the following path /Users/amitsapra/.gradle/wrapper/dists/gradle-2.1-all and then try gradle build again. I faced same issues with 5.4.1-all.
It takes a little time but fixes everything
For me, the reason is that the gradle.zip IDE downloaded is broken (I cannot uncompress it manually), and following steps help.
gradle sync, and it says could not install from ${link}, ${gralde.zip} ...
download from ${link} manually
go to the ${gradle.zip}'s location
replace the ${gradle.zip} with the one downloaded, remove the .lck file on the same path.
gradle sync.
Note:
${link} is something like https://services.gradle.org/distributions/gradle-4.6-all.zip
${gradle.zip} looks like ~/.gradle/wrapper/dists/gradle-${version}-all/${a-serial-string}/gradle-${version}-all.zip
I have also recieved this issue inside of InteliJ.
Go to the gradle/wrapper folder and modify distributionUrl inside of gradle-wrapper.properties to a correct version.
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
It also disturb me a lot but now it is fine
The solution is very simple (written blow) [window (android studio)]
go to C:\Users\your user name.gradle
open wrapper/dists and delete the folder that is distrubing you in my case --gradle-6.5--
then go back to .gradle folder and this time open daemon folder and delete the folder with same number that is disturbing you in my case --6.5--
Then again go back to .gradle folder and this time open caches folder and delete the folder with same number that is disturbing you in my case --6.5--
now if your android studio is open then close it and again start it but this time with administrator mode by right clicking on the icon of android studio icon it is important
you should have internet connection and now your android studio will setup every thing by its own (please don't distrub it while it is doing its operation)
I solve it by downloading zip file from https://services.gradle.org/distributions/gradle-2.1-all.zip manually, put it inside C:\Users\<username>\.gradle, and sync.
(Only for Mac Users)
download the gradle file from the link and then close the project then at the front page ,under the creat project option there is option called Import project(Gradle,Eclipse ADT,etc) here you have to select the gradle file which you have downloded earlier .
Then restart the Android studio .....hope your problem is solved now
In my case I solved the problem with
Ctrl + Shift+ F
Type 2.1 or just type the version of the gradle that can't be installed
replace the version of gradle with the correct one in the gradle-Wrapper.properties
File in my case I replaced it with 6.1.1
Guys In my case the gradle is not properly install thats why this issue is happan with me.
Resolution:
Go to User Directory
Then Go to .gradle\wrapper\dists
Remove the folder which you are facing error
Invalidate cache and restart your android studio
Download directly from Gradle: https://services.gradle.org/distributions/
Choose the relative version, pay attention to the name behind the version
Open the folder
as shown
enter image description here
You can delete the contents in the wrapper folder before, replace it with the Gradle file you just downloaded, and unzip it. After unzipping, you can delete the compressed file.
Open Gradle settings. Modify the path problem, and then synchronize it. There should be no problem
Here is what worked for me on windows 10.
Close my project.
Close Android Studio.
Run Android Studio.
Open project.
Android studio takes a few minutes while everything sorts itself out.
I thought that maybe Android Studio just needed sufficient rights to extract and put the files in all the right locations and possibly set the path variables.

What's the reason for "Error:Cannot determine Java VM executable in selected JDK"?

I am using IntelliJ IDEA 13.1.4 and also tried the latest release 14.
Running SBT I get the following error:
Error:Cannot determine Java VM executable in selected JDK
I have JDK 1.7 installed on my machine and on PATH.
In the logs (~/Library/Logs/IntelliJIdea14/idea.log on MacOS) there's the following stack trace:
2014-11-03 11:22:05,054 [4896641] WARN - nal.AbstractExternalSystemTask - Cannot determine Java VM executable in selected JDK
com.intellij.openapi.externalSystem.model.ExternalSystemException: Cannot determine Java VM executable in selected JDK
at org.jetbrains.sbt.project.SbtExternalSystemManager$$anonfun$10.apply(SbtExternalSystemManager.scala:97)
at org.jetbrains.sbt.project.SbtExternalSystemManager$$anonfun$10.apply(SbtExternalSystemManager.scala:97)
at scala.Option.getOrElse(Option.scala:120)
at org.jetbrains.sbt.project.SbtExternalSystemManager$.executionSettingsFor(SbtExternalSystemManager.scala:96)
at org.jetbrains.sbt.project.SbtExternalSystemManager$$anonfun$getExecutionSettingsProvider$1.apply(SbtExternalSystemManager.scala:54)
at org.jetbrains.sbt.project.SbtExternalSystemManager$$anonfun$getExecutionSettingsProvider$1.apply(SbtExternalSystemManager.scala:54)
at org.jetbrains.sbt.package$$anon$3.fun(package.scala:29)
at org.jetbrains.sbt.package$$anon$3.fun(package.scala:28)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.getExecutionSettings(ExternalSystemApiUtil.java:590)
at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager.a(ExternalSystemFacadeManager.java:201)
at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager.a(ExternalSystemFacadeManager.java:178)
at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager.doInvoke(ExternalSystemFacadeManager.java:133)
at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager$MyHandler.invoke(ExternalSystemFacadeManager.java:270)
at com.sun.proxy.$Proxy57.getResolver(Unknown Source)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:48)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:137)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:123)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.execute(ExternalSystemUtil.java:475)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3$1.run(ExternalSystemUtil.java:543)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:609)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$7.run(ProgressManagerImpl.java:410)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$3.run(ProgressManagerImpl.java:194)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.a(ProgressManagerImpl.java:281)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:233)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:181)
at com.intellij.openapi.application.impl.ApplicationImpl$10$1.run(ApplicationImpl.java:640)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:405)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
What can be the reason for this?
You should be able to work it around by setting the jdk from the settings not from the open/import project dialog.
From the welcome screen, go to Configure -> Project defaults -> Project structure and add the jdk.
Opening the sbt project should work well then.
Found solution from here
Another way to set JDK is from your current module/project settings (for your current project)
PickOpen Module Settings from project context menu (or default hit F4), then from left tab select Project and point correct Project SDK on dropdown.
The issue is usually caused by a wrong JDK version in ".idea/sbt.xml", e.g.:
<option name="jdk" value="1.7" />
This option is not updated accordingly when the Project SDK is changed, see SCL-10085. If you have the other JDK (1.7 in my example) generally configured, no error will occur, but the Project SDK will silently be changed back. Otherwise, this error occurs.
The problem can easily be resolved by manually editing the value in ".idea/sbt.xml" to the right JDK version.
Same error also occurs when you try to do a refresh in "SBT tasks".
Open
Preferences -> Language & Frameworks -> Scala Compiler Server
Turn on
Run compile server (in external build mode)
Once you done with refreshing the project, turn it off again to enable hotswapping back when you change your code in the editor.
I had to open Settings -> Language & Frameworks -> Scala Compiler Server
Then set the JVM SDK there, which was <No SDK>.
This was in addition to setting the Project SDK in Project Structure -> Project.
See the screenshot here.
IntelliJ 13.1.6 > File > Project Structure > set Project SDK
I got the same problem after I delete Java1.6 and Java1.7 from Project Settings(with Java8 as default).
Finally I solve the problem by change SBT JVM config to Custom Java(Settings -> Build, Execution, Deployment -> Build Tools -> SBT).
For me the above suggestions did not help for some reason. However, I did figure out that under Project Defaults > Project Structure (Welcome screen) my default Project SDK was set to the Go SDK.
What worked for me was setting this default SDK to the Java JDK.
For me, I had selected the JDK in "Open Module Settings" > Module > Dependencies > Module SDK.
However, SBT was looking for JDK at project level which is set in "Open Module Settings" > Project > Project SDK as #michasm has pointed out above
The latest Nightlies of the Scala plugin change how the project JDK is set, which should solve this in most cases. Let me know if it still breaks on some cases.
This happened to me in a multi-language project when my primary module's Project SDK was Python and I was trying to add a secondary module that was JDK (importing an sbt project).
I had to temporarily switch the primary module's Project SDK to JDK in order to add the sbt module. I then had the ability to go back and change each module to the correct SDK.