Reputation: 127
I have hard time in including an Android Project Library in my Android Project. Basically, my library has yet only a simple class file, but the app project can't resolved the said class. I therefore can't compile and so can't find any error message.
I did as stated by official doc: Create a project, convert it in a library by checking "isLibrary" in project Properties->Android; went in the app project and in Properties->Android, add the said library.
Tried a lot of things: Clean/rebuild projects; Restart Eclipse; Reboot computer (more then once, to say my level of despair!) Delete / re-import my Library; Put App and Library in the same root folder I put in my manifest: (changed true for false, did nothing)
The thing is supposed to be so straightforward that I have no clue what to do when it doesn't work and no error message is thrown. I'll take any advice, from ultra-specific to meta-general!
Thanks in advance.
Upvotes: 0
Views: 1344
Reputation: 127
Figured out the answer to my problem. Sorry if it triggers 'Duh'-reactions in your heads...
When I created my project to be a library, I saw that my package was not com.mycompany.mypackagelib, but instead it was written "(default package)" in Eclipse. I tried to correct it, I actually renamed my package, but Eclipse was refusing, saying that com.mycompany.mypackagelib was already the name (as stated in the manifest for example). So I forced it in the .java file, writing "package com.mycompany.mypackagelib", but then getting an error saying that it should be package "". I went in the quick fix sub menu where it suggested me to move it to com.mycompany.mypackagelib. Then Bingo. Hope this helps somebody anyway.
Upvotes: 2
Reputation: 1491
Recently, Google updated its tools and it introduced some strange behaviour when using library projects. I'm not sure you're dealing with the same problem, but try this:
make sure "Android private libraries" and "Android dependencies" are checked. Do the same for your application project.
After these steps, clean both projects and maybe your problem is fixed ;-)
good luck!
Upvotes: 1