How to control the RELATIVE path of a reference Library Project? - android

I am trying to add the LVL library project to my application's project. It should be simple and straightforward, but it isn't:
When I click the Add... button, I receive the Library Project Selection dialog as expected:
I select it and it is being accepted with the green checkmark next to it.
However, when I re-open that Properties > Android box again, it gets a red X next to it, making it unusable:
There is an excellent answer documenting the "delicate behavior" of referencing a library project, but despite implementing the tips there (same root directory), I am still having this problem.
How do I solve (or workaround) this problem?
Is there a way to make Eclipse/ADT use fewer..\..s to represent the path of the referenced library project? (all is needed to reference that library correctly is ..\..\thisisinsane\library, there really is no need for all that ..\..\..\..\..\..)

I solved the problem by following the excellent steps in this answer.
In essence, The Eclipse+ADT duo doesn't "like" projects that aren't in the workspace, regardless whether these are application projects or library projects (even if Google created them).

Related

How to make a phonegap project as library in android?

I have already created an phonegap android project and it is working fine, now i would like to create same kind of project againg. Might it would be more than 5 apps, so i thought making it as library.
I have make the project as library and created a new project with different package name. Change the launcher activities name to the libraries launcher activity name. But now the issue is application error is happening, cannot load the index.html file.
So i think the way worked on is not the proper one, can anyone please help me to solve this problem.
you have to assign your initial android project as a library. right click the project, pick properties, then go to android, tick the "is library" box and apply
For your new projects, you need to "add" the project before as your library as the image above

How to display the documentation for the support libraries inside Android Studio?

When I use the command 'Quick Documentation' in Android Studio in a class that comes from one of the support libraries (e.g. ActionBarActivity), the IDE does not show the documentation for the class. If I use it on one of the classes from, say, the Android API 19 (e.g. Activity), the IDE displays the complete documentation as is shown in the reference page on https://developer.android.com/reference/packages.html.
Is there any way to add the documentation for the support libraries to Android Studio so that they can be accessed through 'Quick Documentation' as well?
When Android Studio has opened the decompiled jar class, click on "Download..." blue link at top right, this will download jar with javadoc and save it in :
/.ideaLibSources
rebuild project if necessary, now doc is available.
Tested on android studio 2.0 preview 4.
If you are not using Gradle, this will be easier for you.
Go to File -> Project Structure. From there, on the left-hand side, select Libraries. Select the library you want to add source/java-docs to, then click the plus at the bottom and add the source and/or java-doc jars. There's a chance AS will automatically know what's what.
If you're using Gradle, more than likely in Project Structure, you won't see the Libraries tab, and I'm sorry but I don't know how to help from that point. If you use Gradle, AS detects that and takes away "unnecessary" options. Sorry to send you searching again, but I know there's something called a .properties file for jars that tell the source and java-docs, but I haven't implemented it. If I can find the page that told me that information, I'll update this.
EDIT: The answer is here. This should help you out.

Efficient Way to Integrate Project as a Package?

I have two independently developed Android projects (with own activities etc.), tested and working independently.
One project is now supposed to be launching (via Intent) the second project.
I could have kept it that way, but when distributing it via the Android Market, it will necessitate 2 APKs, 2 icons, etc. which could be very confusing to the end user.
So I would like to integrate the second project into the first one, while keeping it as a separate package.
A straightforward approach for doing this is to manually create an empty package, then copy over all files, one by one, from the second project. Tedious.
Is there a built-in shortcut in Eclipse (or ADT) to do this, similar to the File > Import > Existing Projects into Workspace ?
I think you can make your second project as a Library Project by right clicking on it and in the Android tab check isLibrary. And then in your first project, you link the one that you made a library by right clicking again and under the Android tab, Libraries, click Add and point to your Library Project. You could also have a look at Managing Projects from Eclipse.
If this does not work (but I really should), you can simply just right click on your packages, then select Copy and go to your first project, and just right click -> Paste. This also worked for me.

Using third party libraries in android project

I am just starting off with android and have been googling high and low to find any tutorials/resources that could answer my beginners questions.
How can import a third party resource into my project and start using it?
For example, i wanted to use scrollableTabActivity, a widget that's available at https://github.com/honcheng/ScrollableTabHost-for-Android. I have downloaded and it looks like it is a project by itself. How can import into into my project and start using it?
This is the case of even projects like droid fu, for the life of me i could not figure out how to add them and start using in my project.
I did successfully added asynchttp into my project cause there was .jar download available. But for projects like droid-fu or scrollableTabActivity, how can i use the source files to add the functionality into my project?
Any help is highly appreciated
Thanks
Add the projectyou downloaded to you workspace.
Right click on it, properties, Android and be sure the Is Library checkbox is checked.
Then in your project, right click, properties, Android and click on add on the bottom right to add the previous project.
The project you refer to actually contains a lot of demonstration code which shows you how to use the ScrollTabHost control in your app. Rather than trying to include this stuff which will just bloat your app, simply copy the ScrollTabHost.java file in to your project, along with any resources upon which it depends.
I agree with Mark Allison's answer. But generally speaking to import a whole project in Eclipse, check the box next to that third party project name on the Project References tab in your project Properties.

Library based application installs 2 APK files, not one - Why?

I am trying to restructure an existing app so that, except for a few override-able methods in a derived activity, all code will reside in a library. This still doesn't work for some reason, but in the process of attempting to troubleshoot this, I discovered much to my dismay that there are two .apk files installed, not one (when I run a debug session from eclipse):
The first (and larger file) is
having the original library name.
The second (only 20KB in size) is
having the derived application name.
Why is that and where can I learn more about this?
Could that explain the ClassNotFoundException problem I am having?
I found the answer myself. It turns out that I had 2 critical settings in the Properties of both projects not set correctly:
In the library project, "Is Library"
was not checked for some reason. I
could swear that I checked it, but
knowing how whimsical the Android
development environment under
Eclipse can be, I suspect that it
was unchecked by Eclipse (or the ADT
plugin) as a result of some glitch.
In the application project, I
neglected to add my library project
as a reference via the Add...
button. (how dumb could I be?)
Hoping this can be useful for other newbies to come.

Categories

Resources