Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
245 views
in Technique[技术] by (71.8m points)

class - classes from android project library not resolved in android project

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...