Now I am totally confused by this error message: Android library projects cannot be launched.
I carefully checked the build path and library, everything seems "OK", and there is no error on Problems view, however, when I tried to run my application as an Android project, it failed and showed that message.
Any explanation for why it's happening is appreciated!
From Android's Developer Documentation on Managing Projects from Eclipse with ADT:
Setting up a Library Project
Next, set the project's Properties to indicate that it is a library project:
In the Package Explorer, right-click the library project and select Properties.
In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
Select the "is Library" checkbox and click Apply.
Click OK to close the Properties window.
So, open your project properties, un-select the "Is Library" checkbox, and click Apply to make your project a normal Android project (not a library project).
Through the this steps you can .
In Eclipse , Right Click on Project from Package Explorer.
Select Properties,.
Select Android from Properties pop up window,
See "Is Library" check box,
If it is checked then Unchecked "Is Library" check box.
Click Apply and than OK.
With Me I had the library ticked under Eclipse>Project Properties>Android what I just did was uncheck the ticked library.
It says “Android library projects cannot be launched” because Android library projects cannot be launched. That simple. You cannot run a library. If you want to test a library, create an Android project that uses the library, and execute it.
In Eclipse Project -> Clean
Modify project.properties like this :
target=android-10
android.library.reference.1=F:/svn/WiEngine_library
Through the following steps you can do it .
In Eclipse window , Right Click on your Project from Package Explorer.
1. Select Properties,
2. Select Android from Properties,
3. Check "Is Library" check box,
4. If it is checked then Unchecked "Is Library" check box.
5. Click Apply and than OK.
right-click in your project and select Properties. In the Properties window -> "Android" -> uncheck the option "is Library" and apply -> Click "ok" to close the properties window.
This is the best answer to solve the problem
Related
I'm trying to install the Pager Sliding Tab Strip library and demo app into eclipse, but I get errors on installation and compile errors.
the library is here: https://github.com/astuetz/PagerSlidingTabStrip
What I have done is:
downloaded the zip file from github,
unzipped it into a folder on my windows PC,
in Eclipse selected File|Import, Existing Android Code into Workspace, Next, browsed to the root directory \PageSlidingTabStrip-master
Copy projects into workspace
finish
This leads to an error:
Android SDK: Resolving error markers' has encountered a problem.
Marker id 3158 not found.
However, a node in my package explorer tree is created for each of the library and the demo project, but the have compile errors.
What does the reported error mean? Am I doing something wrong? What is the correct way to use this library in Eclipse?
Do the following:
File->New->Other
Select Android Project
Select "Create Project from existing source"
Click "Browse..." and navigate to "PagerSlidingTabStrip-master" folder which you have downloaded from https://github.com/astuetz/PagerSlidingTabStrip
Check "library"! (Uncheck "sample"). Make sure "Copy to Workspace" is checked as well.
Click Finish. Now "library" is added to your workspace as a project. There are some errors detected but ignore them. You can right click on "library", go to "Refactor", and change it to "Lip_PagerSlidingTabStrip" (optional).
Right-click on your project -> Properties
In Android -> Library section, click "Add"
Select recently added "library" project, click Ok and you're all set. Make sure "Is library" in this window is unchecked.
EDIT
If you have faced an error subject to "Project cannot be build until the build path is correct", try to Quick Fix it by this option: "Add android.v4.supprt to Lib_PagerSlidingTabStrip."
I'm working on an Android 4.1.2 project, where I'm trying to add a reference to this github project
Following this guide, I've imported the project into the same workspace, and I'm able to select and add the library and get a green checkmark. When I press "Apply" or "OK" the dialog closes, and nothing happens (no rebuild). Then, when I again try to see if it's added, it's not there - not even with a red cross.
I've tried running the project anyway, but it gives me java.lang.ClassNotFoundException: com.handmark.pulltorefresh.library.PullToRefreshGridView
First I choose the library, get the green checkmark
Then I press "Apply" and "OK", and dialog just closes and don't build. When trying to see if library was added, it's not there:
Any suggestions about what's wrong?
Did you or did you not check the "Is Library" option?
You need to reference that library in your android project. Assuming you have imported the library project to eclipse, right click on your project, goto properties, choose android , click add, browse and add the library project.
Clean and build and run. Check if you need to add support library for running on lower versions
Import the library and your project in the same work space. then clean the project and try to add library by the same process you are doing(Properties --> Android --->Add).
Also try restart eclipse.
I'm trying to make use of Actionbar Sherlock 4, targeting sdk 15 and min sdk 8. After following the directions provided on the Usage website and the great videos posted here: http://www.youtube.com/watch?v=avcp6eD_X2k
I'm still encountering a problem. When I try to add android:theme="#style/Theme.Sherlock" to my manifest file , I get the error:
No resource found that matches the given name (at 'theme' with value
'#style/Theme.Sherlock').
I have included the actionbar Sherlock library project into my project, and the import statements are there and not coming up with any errors and I've
extends SherlockActivity implements ActionBar.TabListener
just like in the Demo code and documentation Yet still, eclipse gives me this error. Any ideas out there?
The pitfall I encountered was this: The reference to the ActionBarSherlock project needs to be in the Android->Libraries section of the project properties, while I had been adding it to the Build Path->Libraries.
I encountered a strange anomaly that might help!
Have built android project that uses ABS, running it on Gingerbread works fine, in ICS it crashes, the crash under ICS occurs due to this, check your AndroidManifest.xml (have trimmed out bits for brevity...
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" android:theme="#style/Theme.Sherlock">
It was the android:theme part that caused the crash under ICS, it worked fine under Gingerbread and older versions!. Solution was to remove it completely! Then from your Activity, do this:
#Override
public void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH){
this.setTheme(com.actionbarsherlock.R.style.Theme_Sherlock);
}
super.onCreate(savedInstanceState);
... // MORE CODE ....
}
This fixed up the crash under ICS, the theme style is not liked by ICS, but it works fine for both versions less than 2.3 and 4.0 upwards.. weird error but that I discovered by fluke!
Remember to apply the theme before calling the base class's own onCreate!
My standard procedure for including a library project on Eclipse goes like this:
Import library project
Right click on library project Properties -> Android -> Set Project Build Target (insure library and primary project are the same)
Right click on library project Android Tools -> Fix Project Properties
Select the library project then Project -> Clean...
Select primary project then Project -> Clean...
That should fix whatever ails you.
I finally find the solution:
IMPORTANT! Copy the same android-support-v4.jar in both projects: in library and your project (this is the principal problem).
Import "library" project TO YOUR WORKSPACE
Right click on library project Properties -> Android -> Check "Target Name" 4.x (any, API level 14,15 or 16). Bottom check "Is library".
In properties, go to "Java Build Path", tab "Libraries" And find "android-support-v4.jar" normally in "Android Dependencies". Ok and Close Properties.
Right click on library project Android Tools -> Fix Project Properties
in Menu Project -> Clean... and select to clean the "Library" Project.
In this place, your project "library" must to be done (without errors)
Create or import your own project. Example "MyProject"
In properties, go to "Java Build Path", tab "Libraries" And find "android-support-v4.jar" normally in "Android Dependencies".
Now go to "Projects" Tab. Add... and select "library" project.
Now in properties go to Android -> Check "Target Name" 4.x (any, API level 14,15 or 16). IMPORTANT: Must to be the same of "library" project. Bottom "Is Library" must to be UNCHECKED and in this place press Add... And select "library" project. Ok and Close properties.
Right click on "MyProject" project Android Tools -> Fix Project Properties
in Menu Project -> Clean... and select to clean the "MyProject" Project.
Already, your project must to be done. If the error persist, restart Eclipse.
I resolved this issue by the follwoing 2 steps on my projects:
Remove the "library" from "project properties"/build path and add library in "project properties"/Android/Library
Right Click on project "Android Tools" -> "Add support library"
after importing both projects i.e. library and settingActivity,first clean and build them.
Then right click on settingActivity project->properties->select second option from left menu (i.e android).
on right hand side their is library section just click on add library. prper path will automatically comes in that frame.
Thats solve my problem,i got no errors.
Hi i have the project developed in eclipse environment is working fine, and i want to use that project as resource or add as jar file to another project.if possible can please let me know how to do this one. will help lot for me.
You can do it via Android Library project.
Refer this LINK.
Describes how to set up a project as a library project. Quoted from its content
================= quoted =================== Next, set the project's Properties to indicate that it is a library project:
1) In the Package Explorer, right-click the library project and select Properties.
2) In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
3) Select the "is Library" checkbox and click Apply.
4) Click OK to close the Properties window.
=============== unquoted =============================
So, you open your project properties and "unselect" "is Library" checkbox and click Apply to make your project a normal Android project (not a library project).
In theory you can as #Agarwal described.
however the adt-tools are not ready to do it yet
My last failed try was adt-tools version R17 documented at how-to-consume-reusable-gui-element-widget-with-resources-in-android
According to user #CommonsWare R18 and R19 still cannot do it (see comment in replace-android-library-project-by-jar-library )
I have created a new android project. I want to have a action bar at the top so I downloaded the Action Bar for Android Library because I want to support devices from android 2.1.
The description says
The action bar component is an Library Project. This means that there's no need to
copy-paste resources into your own project, simply
add the action bar component as a reference to any project.
I am new to android so what does this mean? How can I add the library to my existing project?
Import the library into your eclipse workspace:
File->Import->General->Existing Projects into Workspace, Next
Select root directory: /path/to/project
Projects->Select All
At this point it fails because there is nothing to select and the next button is deactivated.
Any ideas?
File->New->Other
Select Android Project
Select "Create Project from existing source"
Click "Browse..." button and navigate to johannilsson-android-actionbar\actionbar
Finish (Now action bar project in your workspace)
Right-click on your project -> Properties
In Android->Library section click Add
select recently added project -> Ok
that's it!
Now you can use it
Checkout this documentation on how to reference a library project in eclipse.
From the link above:
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.
Plus to the "best answer", at step 8, if you don't see the project, go to the project what you would like to add as a library and
open 'project.properties'
add 'android.library=true'
and you can again follow the instruction and you should see the desirable project.