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.
It turned out that I should not add dependency manually in that window
I rather should add new module in my Project window at the left
Then I should choose iml file in the root folder of android library project I want to use
Then I pressed finish and from that point I had two modules in my project
After that when using classes I can press Alt+Enter on any class from SampleLibrary and tell IDEA to add module dependency
Then I could see that IDEA made all I need without me. I can now use SampleLibrary from SampleApplication!
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.