Unresolved Reference Kotlinx in IntellijIdea. Even after adding the library - kotlin

I just wanted to taste Kotlin coroutines. Unfortunately, I haven't been able to use the library kotlinx in IntelliJ. I have downloaded the library through Maven.
Tried invalidating caches.
Rebuilt project.
Tried using it in a fresh project.
Even IntelliJ is suggesting kotlinx in auto-completion.
Still it says unresolved reference
I have tried most of the solutions on the web. But nothing worked.
Here are the steps that I am exactly doing.
Made a new project.
kotlinx is underlined since the library has not been added.
In project structure > modules > dependencies > add > library > maven Searched for the kotlinx library.
Downloaded the library.
Applied the settings.
kotlinx library is now visible in the External Libraries section.
Even the auto-completion is now suggesting kotlinx.
Still, nothing changes. The result is the same.

I have found the answer in the Kotlin slack channel. And to solve this particular issue add org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0 instead of org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0.
However, it is generally a good idea to learn a build system like Gradleor Maven and using those in the project. It makes life a lot easier.

Related

How to update kotlin compiler embedable?

I have common library with own libraries and build tools for gradle. Like SDK. I updated kotlin to 1.2.71. All ok. I also updated kotlin dsl to newest RC release(no effect).
Then I have projects, which are using this mine SDK. Problem ocurred, when I switched to version 1.2.71 on those projects, because "BuildUtilKt.makeModuleFile" was removed.
Unable to find method 'org.jetbrains.kotlin.incremental.BuildUtilKt.makeModuleFile(Ljava/lang/String;ZLjava/io/File;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/io/File;'.
or
Unable to find method 'org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments.setCommonSources([Ljava/lang/String;)V'.
I know how to remove dependencies, when I have it in compile, but I don't know where from I am getting "kotlin-compiler-embeddable:1.2.41"
Tried:
- compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.2.71") in buildSrc
- runtime "org.jetbrains.kotlin:kotlin-compiler-embeddable:1.2.71"
it doesn't work.
Here are printed dependencies: gist

IntelliJ IDEA shows decompiled .class instead of documentation

I am using same version of IntelliJ IDEA (2016.3.5) on Windows and Linux. The problem is that on Linux IntelliJ IDEA doesn't show java documentation after clicking "Ctrl" + left mouse button , but it shows decompiled .class file. It's not big problem but it's annoying. What may be wrong? I tried to restore default settings but it didn't help.
You're not showing docs, you're drilling down into the implementation of a library method. You haven't attached the sources for the library, so the ide has no choice but to decompile the code in order to let you see the method you're trying to reach. If you're using maven you can download the sources and then when you drill down you'll see real code. Restoring default settings won't help, because this is how its meant to work.
Further; when IntelliJ shows documentation (ctrl-q on my machine) it tries to build the javadocs directly from the source, not from the published javadocs which it ignores. This is another reason to download the sources along with your libs.
BTW: When you 'release' your own libs to your corporate repo you should be building and releasing sources too, so that the users of your libs get the ability to drill down into the implementation, and so that they get access to your api's javadocs.

Why does IntelliJ IDEA 13 require both lib project and lib itself (google-play-service) to be added as a dependency?

Reading Google instructions, I found that I have to import and reference the Play Service library into the project.
So I created a project, copied google-play-service_lib project, imported it as a library project, went to the main project and added this library as a Module dependency. However, I still have an error that IntelliJ IDEA does not recognize package com.amazon.device.ads.*.
So I had to add a library dependency as well, although this library already exists in the /lib directory of Play Service library project.
Am I doing something wrong or we're actually requested to add both dependencies in IntelliJ IDEA? If yes, is this maybe a bug in IntelliJ IDEA 13? I can't remember of having to do the same in earlier versions of IntelliJ IDEA (I have been using it for three years).
This is how it looks in the end and it works only this way! Check the last two dependencies.

Libraries, projects, modules and packages in Intellij Idea

I'm a beginner programmer and I'm learning how to work with Intellij IDEA. A project in IntelliJ IDEA has some different structures like libraries, modules and packages.
Can someone explain what the difference is between those structures and when to use a particular structure? e.g. I can't choose my package name (of a class) arbitrarily when it's already part of a module. What is the connection between those? I'm primarily having difficulties understanding the difference between a package and a module. (characters)
A project in intellij consists of modules. Modules can be java modules, or android modules or whatever. Modules contain your java code and all that stuff. A Module can reference a library which can be a project library or a global library. Global libraries have to be defined only once. Project library in every project you need them.
Packages are a java concept and are IDE independent.
Lets say I wanna do a little game. I would create a intellij Project called "mySuperGame". Then I would create two java modules from intellij, called "logic" and "ui". In the module settings of "ui" I would specify a project library to use opengl and a dep. to "logic". The package name of my logic classes would be "com.mysupergame.logic.XXX".
See http://confluence.jetbrains.com/display/IDEADEV/Structure+of+IntelliJ+IDEA+Project for more information.
IntelliJ IDEA supports everything eclipse has. But vise versa might not be true. Please check this table for the differences. IntelliJ support intelligent perspective and has many windows.
Read the documentation from IntelliJ idea.
Below comparison between Visual Studio (.NET) and IntelliJ (Java), which might be helpful for .NET developers migrating to Java:

Working with IntelliJ + Spring Data + AspectJ

I am attempting to work with a Spring Data Graph project in IntelliJ 11.1.4 Ultimate edition. The project builds fine but the editor says that the persist() method on my classes annotated with #NodeEntity can't be found. Additionally, none if the aspect enhanced methods, like persist, show up for auto-complete suggestions.
I am using the AspectJ Support plugin and I have the compiler set to AJC. Both IntelliJ and Maven can build and run the project, it appears that the editor is the only piece that has the problem.
Am I missing something obvious? Is this a limitation of IntelliJ? I thought 11.1.4 addressed this but I might be mistaken.
Unfortunately AspectJ support isn't fully implemented yet - though resolve and completion should work. Could you please file a ticket in the tracker with a small demo project attached?