Can't import module in Idea - intellij-idea

I try to import module from existing sources, but got "The project is already registered" error message. I have another 2 sources what I could import in the same way. Only that one causes this problem. Technically there are no differences among these 3 modules.
The main problem could be that once I imported this source as a project instead of module. I suppose that the issue is relating to this failure.
I can't force Idea to forget this cached setting. Following some tip found on internet I tried a lot of things to do so...
From Idea side:
Closed the project
Clear recent projects
Gradle refresh / clean etc.
From file system side:
I removed .idea folder from the folder of that source
I cleaned up the wrong project name from every human readable file in .IdeaIC2017.1 folder
Uninstall Idea with cache cleanup, then download/install the recent version 2017.2. Even after this step the problem remained!!!!
I don't have so much experience with Idea, but this doesn't help getting love it...
I stucked. Please help!

Related

Installing dependencys with Gradle Kotlin DSL does not work

Hi everyone I am new to IntelliJ in general and especially to Gradle and I feel like a total noob. :D
Im not sure if this is a Kotlin DSL thing or if I just do it the wrong way and it wouldn't work in Groovey either.
After hours of trial and error and reading other SO posts I'm still not able to install a simple dependency... it can't be that hard...
Currently I am playing around with Jetpack Compose for Desktop even though it's still in alpha and it works but for the love of god I am not able to add a dependency.
So here is my Problem:
I try to install the dependency like they say I should in
https://developer.android.com/jetpack/compose/navigation#kts
and yes I know it's an android package so it may not compile or it may crash during runtime but shouldn't it at least find and download the dependency???
So... if I add
implementation("androidx.navigation:navigation-compose:2.4.0-alpha10")
to my build.gradle.kts
And try to compile it I get an exception during the build process:
What I tried so far:
I checked if the repository maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
who is configured in my build.gradle.kts repositories-section and in my settings.gradle.kts pluginManagement-section contains the package that I want.
The site https://mvnrepository.com/artifact/androidx.navigation/navigation-compose?repo=space-public-compose-dev tells me, that the repository contains the package that I need.
I checked the error log itself.
But I don't relly know what it tries to say.
I use Java SDK16, since I expect downward compatibility and the fact that the dependency is still in alpha I assume it should be compatible.
I use Kotlin 1.5....
that's it.
Thanks for reading all that :) I really appreciate your time... If I forgot some crucial information let me know and I will add it as soon as I can.
the problem which I feel is, is you are basically opening the wrong file. (I don't use jetpack compose so the answer might differ)
on the top left corner in the image, where there is project dropdown, open it and select android.
now there will be a different set of files in the Gradle folder, in fact, there will be 2 different files in that folder.
build.gradle (project: <project_name>)
build.gradle (Module: <project_name>.app)
open the second file and there will be dependencies copy + paste implementation code there.
the file which you have opened is actually the first file.
Well... here I am back again answering my own question.
After I switched to the terminal in IntelliJ Idea (which to be honest I could have thought of that prior to posting my question) there was highlighted text that gave me the necessary insight, why it wasn't working.
And after some searching the web in order to find out what an "aar" file is and why I didn't get a jar file like I expected it turns out that android has it's own little file format for android applications and that those cannot be used in regular java/kotlin projects.
I read somewhere, that 'aar' files contain a jar file and some other stuff and extracting the jar file from the aar file may be a way to get it working, but it didn't fix anything, maybe because the dependencies of the navigation package are aar files as well and therefor I'd need those packages as well and extract the jar file from those as well and it all seems like this isn't the right way...
So I guess I have to wait until Jetpack Compose for desktop somehow is able to use aar files or until the repositories deliver the packages in a regular jar file.

Could not create parent directory for lock file C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.4\

I'm relatively new to IntelliJ. I'm using IntelliJ IDEA 2019.2.4.
When I try to do an Import From Existing Source - I get the following error:
Could not create parent directory for lock file C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.4\jbr\bin\proxy\wrapper\dists\gradle-5.3-all\b2xqo51qjs5t4spu8wb5tlf15\gradle-5.3-all.zip.lck
That's new - I didn't used to get that.
Any suggestions?
Thanks much
This issue has been discussed by another already (in Android Studio) but I will quickly summarize the issue as it should be quite similar using IntelliJ. Thanks to Mike Hill this will remedy your problem. Here is his answer Could not create parent directory for lock file
The issue you discussed appears to have been caused by using the "Use gradle 'wrapper' task configuration" option in IntelliJ..this option causes IntelliJ to override the Gradle wrapper task (which is sort of expected).
The solution that Mike Hill suggests is to select "Use default gradle wrapper (recommended)" instead. Seems that this caused a conflict with the customized GRADLE_USER_HOME environment variable in IntelliJ for the directory where the final wrapper files actually get stored.
He then provides an absolute path example which may be what is throwing the error for you as well.
Gradle was trying (and failing) to create C:\ProgramData\chocolatey\lib\gradle\tools\gradle-4.5.1\wrapper\dists\gradle-4.5.1-all\87kuriyahurjjkki3zii366f2\gradle-4.5.1-all.zip.lck when run through IntelliJ, although his system uses the file C:\work.gradle\wrapper\dists\gradle-4.5.1-all\87kuriyahurjjkki3zii366f2\gradle-4.5.1-all.zip.lck when working correctly.
Switching and then running the Gradle refresh through IntelliJ seems to have fixed it for Mike. It also succeeds when switching back to "Use gradle 'wrapper' task configuration", now. Hopefully this helps you out Tim!
I did hours of research and I discovered that the localhost:8080 on my program had never fully detached last time I stopped running the program. The program refused to start because really it never stopped from last time. Detach you localhost. If you don't know how just restart the computer--it will detach everything
Encountered on Mac.
Seems like a bug in IntelliJ IDEA.
Changing Gradle user home from ~/.gradle
to an absolute path /Users/username/.gradle has actually helped

Using the import statement. Which files is it importing from?

I'm trying to migrate my eclipse install from one workstation to another. I primarily work with Selenium, so I've copied my workspaces, imported the projects and imported the appropriate jars. However, I am still getting a lot of errors including some stating the import statements are failing to find certain packages.
Half of the errors cleared when I finished importing the last of the jars, but it seems like it's missing something. Basically guessing at this point, I right clicked my project and hit "build project", which cleared the import errors, but the rest of my code has errors indicating things are not imported correctly. I have a feeling the build path is still not configured correctly. Is there a way I can look at my old PC and see what files the import statement is looking for?
When you copied the files to another machine, and imported the project, some jars were not properly added to the classpath. So the compiler complained about not being able to find a class/package in an import statement. You can definitely have a look at the old work station, and look at the project imported jars. You can find those by:
Right click on the project in "Project Explorer", and select "Build Path > Configure Build Path".
This will give you an idea about what you are missing.
Alternatively, (if the libraries you are missing are third party), you can google the missing import statement, and get a clue in which jar (library) contains the jar, then download and add it to the classpath of the project.

Intellij can not locate some classes - Play SBT. Intellij bug?

I have a few import statements in my project that are displayed in RED. Intellij shows 'Cannot resolve symbol' errors, and I am not able to autocomplete these classes or their methods. However, when I run my project it runs perfectly fine. This is strange so much so, that lets say I have an import statement
import org.apache.velocity.app.Velocity
It cannot resolve the 'Velocity' class, even though when I do a ctrl+b selecting the 'app' package, it clearly shows the Velocity class:
I am lost in this and I am struggling to code like this. Any help will be appreciated.
Best Regards.
EDIT: In my project, some of the dependencies are also not resolved, although I refreshed my project multiple times. The exact same dependencies are resolved in my colleague's system, who is using the same code-branch and environment as me.
I can see that the unresolved dependencies lie inside the play.sbt package, but are still not resolved. Is there a compatibility issue between Intellij("15.0.2") and SBT("0.13.8" mentioned in build.properties of my app)?
Reimport project using option 'Import project from external model' and choose 'sbt'. In next window choose options like 'use auto-import' and download 'sources for SBT and plugins'.

Intellij Idea's Project view doesn't show all project files

a colleague of mine checked out a git repository from github which is an assignment for college. But he can't see all relevant files and folders in the project view. Any ideas for solving this issue would be highly appreciated...
Screenshot:
Thank you and best regards
Philipp
Most likely the project was imported into IDEA, but it's not a pure Java project.
Note that non-Java projects cannot be imported from the existing sources using the Import option.
You should create a new project, select the appropriate module type and then point to the existing directory with the code when creating the module.
Other options are to import from Maven/Eclipse/Gradle.
There is a known issue logged.
If it's not the case, please share a sample project (zipped) that will reproduce the problem.
In my case, project .iml file was not found. So I imported project to idea, and it imported project and created .iml file. All files and folders are visible now.