Android library project can not be launched - android

I downloaded one project from web. It includes two folders. One is project and another is library. When I first time imported both and set proper path for library, it runs properly. But now after deleting that project, and importing again, it shows error that it is library project. I repeated the same procedure that I done first time. What to do.

I think you run your project as library,
1. Right click on your project
2. Go to the property
3. Select Android from left section
4. The **is_library** check-box should be Unselected
5. Click on apply button
6. Click on OK button
And at last run your project.
It's working for me. Try it.

Related

How to remove redundant casts in Android Studio?

I was targeting SDK version 21 or 22 in one or my old projects.But now I have updated to the latest SDK version. Now I can see a lot of redundant casts of views (As view casts are redundant now). Is there any alternate to remove all those redundant casts at once Via any short cut way rather going through each and every file and remove? I am using Android Studio version 3.2 now.
Pressing ctrl+shft+A will open action dialog. In it type clean in and from suggestion list select Code Cleanup. This will open a separate dialog from which you can select your relative scope. Select which option suits your need and press OK.
Right click on directory which you want clean up.
Select Analyze > Code Cleanup
Click OK.
Here you go!
Select Your Project folder or app (according to your project explorer view)
Select Analyze from menubar
choose option Code cleanup or silent code cleanup .
Where Code cleanup prompt you dialog with options like Project or module and silent code cleanup cleanup without displaying the Code Cleanup dialog. from currently selected project or module.

How to avoid multiple compatibility projects appcompat_v7

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.

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 do I import a library I find on Github into my existing project?

I would like to use the SwipeListView as a View for a calendar app.
I'm trying to figure out how to put this onto my Activity.
I'm new to android and can't seem to figure out how to import the library into my current project in Eclipse so that I can use it.
What files do I need? Where do they go? They make it seem plug and play, but I can't seem to figure this one out.
Please take time to read through development docs, most times questions like these get closed for 'lack of research'.
http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
Thanks to the first-floor, let me offer your the straight direction:
To add a reference to a library project, follow these steps:
Make sure that both the project library and the application project that depends on it are in your workspace. If one of the projects is missing, import it into your workspace.
In the Package Explorer, right-click the dependent project and select Properties.
In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
Click Add to open the Project Selection dialog.
From the list of available library projects, select a project and click OK.
When the dialog closes, click Apply in the Properties window.
Click OK to close the Properties window.

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.

Categories

Resources