Unable to run new flutter sample code in IntelliJ IDEA - java

I installed IntelliJ IDEA, downloaded both the flutter and dart plugins, Installed android studio and jdk .
I opened configured IntelliJ IDEA to point at the android sdk and jdk.
I opened up IntelliJ IDEA and created new project->flutter. I clicked on build and got an error message.
I am using Ubuntu 16.04 64 bit system
I ran Flutter Doctor and confirmed that i got nothing new or missing installation. The message at debugger is as shown
The built-in library 'dart:ui' is not available on the stand-alone VM.
library handler failed export 'dart:ui' show Locale
Process finished with exit code 254 Failed to connect to the VM observatory service: java.io.IOException: Failed to connect: ws://127.0.0.1:46579/ws Caused by: de.roderick.weberknecht.WebSocketException: error while creating socket to ws://127.0.0.1:46579/ws Caused by: java.net.ConnectException: Connection refused
Standard new flutter project code with output
Debugger output which i copy pasted

It sounds like IntelliJ is configured to run as a Dart command line app instead of a Flutter app. Edit configurations and remove any configurations that look like "Dart Command Line App". Then create a new one for a Flutter app.

Click the name of the test, and choose "Edit configurations"
You'll (probably) notice that the run config is under 'dart' rather than 'flutter test'
Delete this one, create a new one (using the plus button) under 'Flutter Test' and choose / run this manually.
(Also, you need to have the tests in a folder called 'test' at the same level (e.g. as a sister to) the lib folder, and follow the naming convention '*_test.dart' for all tests.)
Happy coding!

When i encountered this issue, I fixed the error by simply by closing the current project and creating a new project. Now when i tried to run the app from the new project, it worked!. Hope it helps someone.

Your setup looks good! I think IntelliJ is trying to run your app as if it was a command-line dart app, not a Flutter one. There are some settings in IntelliJ to allow you to manage your launch configs. I would:
delete the dart command-line one
create a flutter one for your app (or confirm that one exists)
Then, from the launch config drop-down, select the flutter launch config for your app and hit run.
There are some docs here: https://flutter.io/intellij-ide/#running-and-debugging, though they don't cover creating a launch config.
Referenter link description here

I had same issue on Android Studio and I find out that its related to the file (configuration) selected here:
The first one is Dart Command Line App and the second one is Flutter App which should be selected

Related

Why does Android Studio have an internal error after installing

I just downloaded and installed Android Studio. I've tried running it, but there's some internal error. I've tried uninstalling, deleting the JDK, and reinstalling, but I'm still having this same problem. I also tried to download the new installer and install it again but same problem happened.
Here's the error:
java.util.concurrent.CompletionExecption:org.picocontainer.PicoRegistrationException:Keyio.flutter.settings.FlutterSettings duplicated
at java.base/util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
at...(many more errors)
at...(many more errors)
First of all, I will like to know which OS you are on. But try this;
If you have anti-virus, you want to disable it till after a successful installation because some anti-virus delete some files at installation time because those files are read as treat to your PC.
If you are on MacOS ,then try deleting the marketplace directory which contains plugins.
rm -Rf ~/Library/Application\ Support/AndroidStudio2020.3.1/marketplace/
or
~/Library/Application Support/Google/AndroidStudio202.3.1/plugins
There can be Android Studio under Application Support but that is not the correct one.
If you use Windows then , try the following ways:-
Changing these lines of code
Open the folder where you installed Android Studio:
ex: C:Program FilesAndroidAndroid Studiobin
Find and edit idea.properties. You can edit this with use notepad++ or
any similar application that allows text editing.
Add this line as the final in the file:
disable.android.first.run=true
Now run Android Studio again.
Opening in Offline Mode
Close Android Studio Turn off Internet connection and be sure of it.
Start Android Studio. You will see a popup box with Cancel option in it.
Then Click cancel.
Reinstalling JAVA, PYTHON
Downloading new package of ANDRIOD STUDIO and installing it again after deleting all the previous files
Adding bin directory to the enviornment variables
JAVA PYTHON JRE-AndriodStudio
Deleting the user plugins that we have in Andriod Studio. [But as its my first time of installation, I am not having them]
Even tried restarting my system
Closing all other instances running via java, to ensure it not disturbing that particular port number
But no programmes were running in the process that took the use of java
Windows Credits:- https://ittone.ma/ittone/start-failed-fresh-installation-android-studio/

IntelliJ Terminal - updated and no longer able to run scripts from terminal

I am pretty new to coding & working with IDEs. Intellij prompted me for an update, which I allowed. Now I cannot run my scripts from the Intellij terminal.
The error message I receive is
"Error: Could not find or load main class src.MatrixHomework.java"
My pathway hasn't changed... it's still
C:\Users\General_Sherman\IdeaProjects\Assignment3\src\MatrixHomework.java
I updated to IntelliJ IDEA 2019.2.1
Build: IC-192.6262.58
I'm using jdk-11.0.2
This is most likely due to the selected directory configuration. IntelliJ uses the configuration under Tools/Terminal in your settings to select what directory to start in. You haven't provided any screenshots, but if this doesn't work, type pwd into the terminal and share it here, we might be able to see the problem.
Regardless, you shouldn't be running your programs through the integrated terminal, and instead via the "Run" tab in the top right. Remember to edit the configurations and add C:\Users\General_Sherman\IdeaProjects\Assignment3\ as a part of the Working Directory argument. This is what a configuration would look like.

Kotlin Koans with EduTools plugin: "Failed to launch checking"

I'm trying to follow the Kotlin Koans tutorial in Android Studio by installing the EduTools plugin and choosing Kotlin Koans course.
Everything works fine, but when I try "Check Task" in the Task Description panel, I get this error:
Failed to launch checking
I also tried the plugin with Intellij IDEA and got the same error.
Using:
Android Studio 3.2 with EduTools 2.0-2018.1-443
Intellij IDEA 2018.2.3 with EduTools 2.0-2018.2-906
Maybe could try IntelliJ Idea Edu which comes already bundled with EduTools.
I found the problem in IDE logs as #NullReference suggested.
INFO - ecker.gradle.GradleCommandLine - Failed to launch checking
Cannot run program "./gradlew" (...) No such file or directory
I had configured the project (Settings / Build, Execution, Deployment / Build Tools / Gradle) to use a local Gradle distribution and it seems that EduTools plugin always looks for the Gradle Wrapper, so I just had to generate a Wrapper for project and configure it to use my local Gradle distribution:
gradle wrapper --gradle-distribution-url file:///path/to/local/gradle-4.6-all.zip
In my case I had a problem related to JDK 11 and I had JDK 8 installed.
This is how I fixed the problem:
Go to Settings / Build, Execution, Deployment / Build Tools / Gradle.
At Gradle JVM select JDK 11 path.
It worked for me.
I also got this issue. Finally, I 've resolved it by configuring my gradle bin to PATH.
Here are series of commands to configure Gradle into you Path.
# cd ~
# touch .bash_profile
# open -e .bash_profile
//to edit your bash_profile ,you need to input your local path to bash_profile,like this:
export GRADLE_HOME=/Users/PCNAME/.gradle/wrapper/dists/gradle-4.5-bin/bgd6nrwgxy3inh8yed6gmsvbx/gradle-4.5/ --- use your own grade path to replace them.
export PATH=${PATH}:${GRADLE_HOME}/bin
# source .bash_profile
# gradle -v // you will see your gradle version if your configure successfully.
Restart Android Studio, try to run your EDUTOOLS.
I received the same error. I closed Android Studio and created a new Koans project thinking I must have done something wrong. This time I received a new build time error when trying to "Check". None of this made sense so I just shut down Android Studio, reopened the Koans project I just created and clicked "Check". Everything seemed to work now.
Had the same problem. Just Sharing how I fixed this problem.
I opened build.gradle of my Kotlin Koans Project and scrolled down to where wrapper was defined.
Pressed play icon right next to it.
Was greeted with an error
Error:Failed to open zip file.
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
Re-download dependencies and sync project (requires network)
Followed Answer by Hamid
To resolve this issue close Android Studio and delete the following
directory's content, necessary files will be downloaded on IDE's next
launch.
macOS: ~/.gradle/wrapper/dists
Linux: ~/.gradle/wrapper/dists
Windows: C:\Users\your-username.gradle\wrapper\dists
Restarted Android Studio and it worked like a charm.

Unable to start Gradle deamon in fresh install of Android Studio 0.8.1

I wanted to start some Android app development with my friend recently. I've installed the latest Android Studio 0.8.1 and cloned github repo. Then, when I try to build the project using Gradle, it is failing with the message:
Caused by: org.gradle.api.GradleException: Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.12/userguide/gradle_daemon.html
I am using Windows 8.1 64bit, JDK jdk1.7.0_60 64bit and gradle 1.12
I tried to:
- disable firewall and antivirus - didn't help
- download gradle manually, unzip and copy to .gradle in my home directory - didn't help
- when I open a blank new app I have same problem
- I moved the app to different directory as my user name contains 'ł' - same issue
Can anyone look at the log and try to help? This is the most annoying kind of issues developer can face - env is refusing to work and you can't code :(
<<< link to log >>>
Finally, after quite long fight last night, I have managed to run Android studio and build project with Gradle... and I hope it will stay so.
So, as #Eugen pointed out, this could be related to the fact that first installation of Android Studio was done for "only current user". Even I have uninstalled it and installed again it was still failing. Last night, I decided to uninstall it and also, manually, remove all remains of android stuff by simply deleting every directory with android, gradle etc. in its name ;)
I have also updated java to 7.65. and installed stand alone Gradle 2.0 and add it to PATH and check it is working.
After that, I done a clean install of android studio and open simple new MyApp project... and it works! Then I opened my other project - also working! I removed Gradle from PATH - still working.
I have no idea what was wrong... probably first installation of Android Studio was not completely correct. And unistalling it, didn't removed everything.
So, I have no clear answer for my issues, but I thought it could be helpful to describe the story. :)

Eclipse plugin not working properly

I developed an Eclipse plugin that compiles and runs java code in German. The technique I am using is that I translate the code to English and pass it to Java Compiler and get the results back and print it in the console.
The problem is that the plugin works when I run the plugin from Inside Eclipse but when I install the plugin in Eclipse so that when I open Eclipse it already exists there and start to test if a real user uses my plugin and creates a new Java project and try to the compile button in my plugin it says [The chosen operation is not currently available] ![Here is the the way I run and it opens a new Eclipse application with the installed plugin ]
Any help please
the way you installed your plugin sounds a little weird to me. So at first please try to export your plugin via the Export Wizard.
(Select Export -> Deployable plugins and features from your projects context menu)
Export your project as jar file and copy it to the 'plugin' folder of your eclipse instance.
After that it might be helpful to debug your plugin on OSGI-Level as there might be a problem loading your plugin (at least the error description you have posted indicates that).
Run eclipse with -console -noExit -consoleLog flags to open an OSGI console for debugging. After that try running ss <your-plugin-name> to see what the state of your plugin is.
The output gives you the ID of your plugin and the state it currently has. If the state of your plugin is not ACTIVE try running start <your-plugin-id> to see whether it starts correctly. If there is a problem starting your plugin you should get a respective log message. Feel free to post it here in case you need further help.
Otherwise there are plenty of options what might cause your problems, so maybe its better to try the steps I have described above before getting into details.
If you want to run eclipse plug-in withput using Eclipse Application , then you need to make a Feature project.
Now if your algorithm has something to do with system Path , you must
check Unpack plug-in and you should read the resource accordingly.
Like PLatformUI.getWorkBC() etc..
No other eclipse plug-in (jar) should be inside plugins directory of eclipse of same name of your plug-in. Ensure for this.

Categories