Question

I've created library project in IDEA with common helpers, which I use in my android applications.

Then I've created android application and included in it my library project like this tutorial said.

Everything seemed okay, code autocomplete worked fine, IDEA recognize that library and all classes and methods in it.

But then I compiled application and saw error "'org.my.helperlibrary' does not exist". However as I said IDEA acts like everything okay before making/launching project.

Here is similar question, but answer is trivial, of course my library has checked "Is Library Project" option but I still can not launch my application which use my library.

Updated:

I've just saw an error: "UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Lorg/my/helperlibrary/Helper;" when I removed all usages of library in my android application. So it's just included in my app and not used.

Was it helpful?

Solution

It turned out that I should not add dependency manually in that window

enter image description here

I rather should add new module in my Project window at the left

enter image description here enter image description here enter image description here

Then I should choose iml file in the root folder of android library project I want to use

enter image description here

Then I pressed finish and from that point I had two modules in my project

enter image description here

After that when using classes I can press Alt+Enter on any class from SampleLibrary and tell IDEA to add module dependency

enter image description here

Then I could see that IDEA made all I need without me. I can now use SampleLibrary from SampleApplication!

enter image description here

OTHER TIPS

Try to select library project, then click Build -> Compile <your library project name>. Then back to you project which use this library and click Build -> Rebuild Project. After that try to run project again.

Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top