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.
Related
Every time i create a new project with compatibility under API14, a new project with name appcompat_v7_* is created.
Is it possible to avoid the multiple creations of this appcompat_v7_* and use a single project appcompat_v7 in other projects ?
*-> Number that increments with each new android project.
This is a duplicate-
I have answered this here Remove v7 appcompat folder but will include it here as well
This is part of the ADT/SDK update and it is not a bad thing to happen. It ensures that your app has full support of the ActionBarActivity that was implemented in API 14+. It will get created each time by default, but with a little work you can keep your files down. I simply have a single appcompat_v7, whenever I create a project, let's call it SampleApplication, appcompat_v7_2 is created.
- How to re-reference your library -
Right click on "SampleApplication"
Go to "Properties"
Click "Android"
Scroll to the bottom's "Library" section
Click "..\appcompat_v7"
Click "Remove"
Click "Add"
Click on "appcompat_v7"
Click "Apply"
Now you have referenced your preexisting library. You now need to delete your old "extra" duplicate appcompat_v7_2 library. I do this as follows:
- Deleting duplicated copy -
Right click on "appcompat_v7_2" in the Package Explorer of your workspace
Click "Delete"
Go to your physical workspace (In Windows, something like C:\...\...\workspace)
Find "appcompat_v7_2"
Right click on "appcompat_v7_2" in your physical workspace
Click "Delete"
Restart Eclipse
It is not ideal as it requires a bit of setup for each application. But it works. You can also uncheck "Create Activity" when you are creating your application project and it won't add the library (but also, obviously, won't include your main activity).
As another note, apparently for some people it doesn't include the library if your minimum sdk version for your application is 11+. For me, however, it always includes it, so this is my way around it.
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
I am working on an android group project in college and this is the first big project many of us have worked on.
We worked on implementing several pieces of the project as completely separate projects and now are having trouble putting all of them in one application with a main page.
On the main page of the application we would have a bunch of buttons that would then go to the implemented project that we've completed (example, I click on BMI calculator on the app homepage and it goes the the bmi calculator screen).
Any efficient way of going about this that can be explained in an easy to follow manner? I'm still a newbie programmer :)
Just to clarify, I don't want it so that it just launches a BMI calculator app from the main app, the entire code base is supposed to exist under one app.
Thanks
You can have a main project and several other projects declared as library projects.
In build time, library projects are pulled into the main project and only one apk will exist as the output.
The library projects are almost the same as an usual android project. You can have java packages, res folder, lib folder, etc.
Check here for the official description.
Check here for a tutorial.
Look into making the other applications as Android Library-projects, and listing all necessary components on your AndroidManifest.xml on your parent project.
Another way would just give the option for the user to install these applications as separate and have a logice (PackageManager) check if specific application exists or is installed and then enabling navigation buttons or disabling components and invoke them via Intents.
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.
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).