Android library projects cannot be launched - android

i've been trying to run a project but there's a pop up window that says "Android library projects cannot be launched."
Now, my project needs API 7 and i've already installed it in Android SDK Manager.
In Properties -> Android -> Target build, i choose Android 4.1.2. I also added these lines to the Android Manifest:
<uses-sdk android:minSdkVersion="7"
android:targetSdkVersion="7"
android:maxSdkVersion="16"/>
yet, when i run my project, the same pop up message shows.
Anyone, please help me. Thanks!

Your project surely is configured as "library" thats why you get the message : "Android library projects cannot be launched."
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.

the naive and somewhat literal interpretation of the message would be that your project IS a library project; and indeed, they cannot be launched, only embedded in some main project.
Did you double check that your project is NOT a library project? There used to be a checkbox in the "create new android project" wizard...

Related

Yet Another 'The project was not built since its build path is incomplete'

I have an Android project that I've been happily building for weeks in Eclipse Indigo. I have not changed any settings, libraries, or workspace components, or added or removed any files. A few hours ago I was doing a "Run as" to run my app on a phone and Eclipse did a hard hang. I couldn't even kill it in Task Manager so I rebooted my PC.
Now when I try to build my app I get
"The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project"
I deleted gen and did a clean and build with the same result. In the project Properties for the build path, in the Libraries tab it shows
Android Dependencies
Android Private Libraries
Unable to get system library for the project.
Any idea what's going on? This Eclipse "build path is incomplete" error is very common but when I search Stack Overflow and Google, most of the cases seem to be related to importing new projects, moving workspaces, changing libraries or other things I didn't do.
Thanks in advance!
I fixed my problem.
I did a File>Switch Workspace and switched to another workspace that had a different project in it. Then I switched back to my original workspace and everything was fine.
So we can add this to the very long list of folk-remedies, nostrums, old-wives-tales, superstitions and other bits of software lore that accompany the various weird bugs that afflict Eclipse. I sure hope Android Studio turns out to be better than this!
This worked for me:
Open project properties > Java Build Path > Libraries.
Select "Unable to get system library..." > Remove > OK.
Open Libraries again > Add Library > "Android Classpath Container" > Next > Finish > OK.
The following worked for me, so I thought I would share.
Restarted Eclipse and ran into the same problem.
Did the following to get my project to build again.
Right click on project inside Package Explorer and Select properties.
Go to Java Build Path.
Click on Libraries TAB
Remove the line that says "Unable to get system library for the project"
select ok.
Then right click on project, and select "Android Tools" -> "Fix Project Properties."
Hope this helps.... eclipse can be a real PITA sometimes.
BTW I "watched" for any changes after the delete and fix, and it looks like
Is removed from .classpath, and then the "Fix Project Properties" adds the line right back.
Clean + Build works after that.
The resolution was to force a resave of the selected projects (and their .classpath files):
Open the project properties
Select Java Build Path > Libraries
Add a new, arbitrary library (to be deleted later) > OK
Wait for the workspace to refresh (or force a refresh of the project)
The error(s) will go away
Remove the dummy library
Try Project-->Clean. Also make sure "Build Automatically" is checked

Android actionbar how to add supporting library v7 appcompat for Eclipse

I followed every steps in Android - ActionBar to add action bar.
I extend the activity from ActionBarActivity:
public class MainActivity extends ActionBarActivity
I need to add appcompat v7 support library as in here: In "Adding libraries with resources", eclipse section. The last steps:
"Add the library to your application project:
In the Project Explorer, right-click your project and select Properties.
In the Library pane, click Add.
Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-appcompat.
In the properties window, click OK. "
Step 2 is where I can't find the Library pane. How can I add the library to my project?
A picture is worth a thousand words:
Following are the steps:
Paste the android-support-v7-appcompat.jar that you have downloaded in libs folder of your project.
Right click on your project, select Build Path -> Configure build path.
Select Library Tab then Add Jar option and browse your recently added v7 jar and click OK
that's it :)
This is what worked for me:
Eclipse -> Import -> Existing Android Code into workspace.
Add ~/android/adt-bundle-mac-x86_64/sdk/extras/android/support/v7/appcompat to your Eclipse workspace.
Right click on the project in Eclipse and select properties.
Select Android -> Library -> Add.
Select appcompatv7 project and Save.
Use import android.support.v7.app.ActionBar to import Action bar in activities and fragments.
The library pane shows up if you select android first in the left hand list. It should then be at the bottom of the right hand section of the properties window, underneath the Project Build Target section.
This is the the solution I've used to solve that problem.
Make sure that you've installed already the following libraries Android Support Library, Android Support Repository and Google Repository by checking in the Extra folder by openning the Android SDK Manager in eclipse.
Create an Android Sample Project then choose the appcompact_v7 library.
Close the project you've just created, restart Eclipse and create now a new Android Application project.
Hope that it will help you.
In may case this works:
In "android-support-v7-appcompat" project:
-Delete “android-support-v7-appcompat” from Package explorer.
-Import again and check “Copy into workspace”
-In Properties -> Android -> in Project build target, uncheck Android 2.2 and check Android 4.1.2
-In Java build path, uncheck if you have any .jar library, and uncheck the Dependence
In other hand, the project that uses “android-support-v7-appcompat”
in Properties -> Android add the library, but uncheck "IsLibrary”.
-In Android -> Project build target check Android 4.0.
-In "Java Build Path" -> Order and Export -> Unchecked the .jar library
-Finally do a “Project -> Clean” both projects
following the latest(2014/5/19) document, the second step is:
In the category panel on the left side of the dialog, select Android.
then, you will see the library pane on the right side of the dialog.
Try this
Open SDK Manager
Install Android support Repository
Go to F:--\Android Setup\android-sdk-21 version\extras\android\support\v7\appcompat\libs
Copy android-support-v7-appcompat.jar
Paste this .jar in Your's Project Lib Folder
Set and change AndroidManifest.xml
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="23" />

Cannot Resolve #style/Theme.Sherlock

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.

error when importing android projects into eclipse

currently i have difficulties trying to import the lynda.com android app development with java essential training exercise files into eclipse. I keep getting some java errors like this.Can someone help me out with this problem?
Currently im using
Android SDK r12
ADT 12 plugin for eclipse
JDK 7x64
JRE 7x64
LEclipse IDE for Java Developers 3.7 indigo
here's the error:
The project was not built since its build path is incomplete. Cannot
find the class file for java.lang.Object. Fix the build path, then try
building this project.
The type java.lang.Object cannot be resolved. It is indirectly
referenced from required .class files
(original screenshot below)
A little late on this, however after struggling with the issue myself I found a solution to the problem.
Right Click on the project --> Build Path --> Configure Build Path...
In the 'Source' tab, Select the project eg. 'myProject/src' --> Click OK.
Right Click on the project --> Android Tools --> Fix Project Properties
That should do it!
Have you tried changing your compiler to Java 5 instead of Java 7?
Also make sure that in the project settings that you're using Java 5.
Ryan,
I had the same problem and it was corrected by going to the project preferences(right click project -->preferences). Then go to "java build path" and click on the libraries tab. Look for your JRE lib in the list. In my case the system was unable to find it, but the entry was still there. Delete this and add a new one by clicking "add library" and select JRE System library. Then select the default system lib. Close out of the preferences window and then Right click on your project and go to android tools-->Fix project Properties. Clean your project and try building again.
This works
Project > Properties > Android > change the Build Target

"Android library projects cannot be launched"?

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

Categories

Resources