Android support v7 app cannot be resolved error - android

I am running eclipse juno on a 64 bit windows 8.1 machine, I have imported a project into eclipse, but the error i am facing is
On reading about it, I came across the solution that I am supposed to configure the build path manually,
but I am unable to do so since,
Please help

In your screen shot I can see app-compact project imported; This should cause your problem. In better word: when you are using app.support.v7 libraries you must import app-compact project in your workspace and add it as your project dependency.
follow below link of developers:
https://developer.android.com/tools/support-library/setup.html
Especially this part will help you:
1- Make sure you have downloaded the Android Support Library using the SDK Manager.
2- Create a library project and ensure the required JAR files are included in the project's build path:
2- Select File > Import.
3- Select Existing Android Code Into Workspace and click Next.
4- Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the appcompat project, browse to /extras/android/support/v7/appcompat/.
5- Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat.
6- In the new library project, expand the libs/ folder, right-click each .jar file and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both the android-support-v4.jar and android-support-v7-appcompat.jar files to the build path.
7- Right-click the library project folder and select Build Path > Configure Build Path.
In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
Uncheck Android Dependencies.
Click OK to complete the changes.
You now have a library project for your selected Support Library that you can use with one or more application projects.
Add the library to your application project:
1- In the Project Explorer, right-click your project and select Properties.
2- In the category panel on the left side of the dialog, select Android.
3- In the Library pane, click the Add button.
4- Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-appcompat.
5- In the properties window, click OK.
Update
Also you can import and copy the 'appCompact' library directly to your workspace and then add it as you project dependency. Please follow steps in this guide in order to adding the 'appCompact' by this way:
https://yassirh.com/2014/01/getting-the-android-navigation-drawer-to-work-on-old-versions-of-android/
(The above link is in order to using navigation drawer in older version but same objects are using appCompact and using it have same solution for both)

First of all
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.
if it is already installed then add them to Eclipse
Eclipse -> Import -> Existing Android Code into workspace.
Add /android/adt-bundle/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.

Related

Android support v7 ActionBarActivity

I am trying to import the Support v7 library to get ActionBarActivity however it is not working. I am unable to extend ActionBarActivity.
I followed the tutorials of adding the support library in from these links
https://developer.android.com/tools/support-library/setup.html
http://hmkcode.com/add-actionbar-to-android-2-3-x/
I followed these line by line however i cannot import android.support.v7.app.ActionBarActivity; it seems to not exist. All i can import is android.support.v7.app.appcompat.R;
I am using Eclipse
Can someone help me out please. Many Thanks!.
This is the summary of what I have done which is working now
Went to SDK manager. Checked that I have the latest Android Support Library ( I have Rev 20). I did not install Support Repository as this is for android studio
Imported existing code into workspace. Selected sdk/extras/android/support/v7/appcompat/. I did NOT check copy to workspace.
right-click each .jar file and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both the android-support-v4.jar and android-support-v7-appcompat.jar files to the build path.
Right-click the library project folder and select Build Path > Configure Build Path.
In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
Uncheck Android Dependencies.
what I did differently was Create a new Android project rather than using an existing. By default it seemed to extend ActionBarActivity automatically since I put min SDK to API 8.
What it also did was actually do all the steps above for me! I see new project in my work space appcompat-v7
The only problem I see is on console it said something like unable to write Java cache. I lost the message but I will post it
You can create a new Project(if possible) with the viewpager activity and select actionbar in the settings. This will automatically import it into your NEW project. If you can copy your old files that'd be great.
You basically have to:
Import the android-support-v7-appcompat to your Eclipse as described on these links you read.
Link your own project with 'android-support-v7-appcompat' by going to Project Properties / Android/ Add the 'android-support-v7-appcompat' under the 'Library' section (there's a 'Add' button).

Android install external library

I want to use this library https://github.com/koush/ion in my project.But I don't understand how can I install it.I am using Windows 8 and Eclipse.How can I install ?
Download that project and put it in workspace of eclipse and import it from work space to eclipse and make it as library project and add it to your project.
Steps to import:
Right Click on package explorer
Import
Existing Project into Workspace
And then browse to the location where the project downloaded
Import it
Steps to add it as library to your project:
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
You must perform the following steps:
Download ion project code.
Import it in your workspace using eclipse.
Right click in your current project and select Properties. The project properties windows must be opened.
Select Android option.
Go to the bottom of this tab and you can view the Library section.
Add the library dependency using the Add button.
I hope that helps!
You are probably better off downloading the jars vs the source.
https://github.com/koush/ion#get-ion
Download those two and place them in the "libs" directory of your project. If that directory does not exist, create it. From with your Eclipse project preferences, you can add those jars as dependencies.

How do you ensure resources (e.g. styles) of a support library project (e.g. android-support-v7-appcompat), are added to your project?

I am trying to implement the actionbarcompat support library project in my android application and I have followed the guidelines here from the android website on how to implement these but the resources of the support library still are not available to my project.
Note: I am able to use methods defined from the compiled classes of the library project, I just don't know how to reference from the styles.
I am using eclipse IDE.
Anybody with an idea how or what I am doing wrong please assist me.
I happen to have found my own mistake! Most certainly I know a few others might go the same path.
These are the steps in adding a support library with resources.
Select File > Import.
Select Existing Android Code Into Workspace and click Next.
Browse to the SDK installation directory and then to the Support Library folder /extras/android/support/v7/appcompat/.
Click Finish to import the project. You should now see a new project titled android-support-v7-appcompat.
In the new library project, expand the libs/ folder, right-click each .jar file and select Build Path > add both the
android-support-v4.jar and android-support-v7-appcompat.jar files to
the build path.
6.Right-click the project and select Build Path > Configure Build Path.
7.In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on
this library project. The appcompat project requires you to export
both the android-support-v4.jar and android-support-v7-appcompat.jar
files. Uncheck Android Dependencies.
8.Click OK to complete the changes.
Now You add the library project to your application:
In the Project Explorer, right-click your project and select Properties.
In the Library pane, click Add.
here is where I went wrong. Check if you've done it the right way too (As shown)
Select the library project and click OK. The appcompat project should be listed as android-support-v7-appcompat.
In the properties window, click OK.
Look at the "Adding libraries with resources" section of this document
http://developer.android.com/tools/support-library/setup.html
Basically, you import the resources in a library project called "android-support-v7-appcompat" that you reference in your app project.

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 Add Library to Android Project in Eclipse

I am trying to add a Library to an existing project inside eclipse. I am keeping the Project Folder itself and the Library Folder in a folder marked "ANDROID" on my desktop. When I try to Import > Existing Code into Workspace > Select "ANDROID".. the only project that gets added is the App itself and NOT the library. I even try to add the library on its own and it will show up on the import list but will not have a "ticked box" with the option of "Finish".
I even right clicked my App - Properties > Android > and noticed that the library is there with a red "X" and does not allow me to search for a new library. What am I doing wrong?
This Identical App and library is working with the same version of eclipse for a friend and not me.
Make sure that the libraries and the project are at the same place, i.e.
Copy the libraries in the same folder as your project
Import the libraries (file > Import > Existing Project in workspace)
Open properties of library > Android and select Is Library
Open project properties > Android > Add (library)
Select the library
save the properties
If this does not work for you copy the jar files from its lib folder and paste it in the projects lib. This should only be done if the above method doesn't work
Import Library project in eclipse . Then right click on project and go to properties->Android (Menu on left side) --> At the bottom(below project build target) you will see a check box named is Library Check that box. Now you've made your project a library .
Then in your orignal project where you want to add library go again to to properties->Android (Menu on left side) --> At the bottom(below project build target) Click add button and you will find that library project visible.
This happens when you import the project from some location. If we import some project then it doesn't refer to the supporting library of that workspace. So always check the check box( copy projects to workspace)
Go to file>import project>browse>select a project>Check the copy project into workspace.
Hope it solve the issue.
A late answer, although I thought of giving an in-depth answer to this question.
First switch your folder structure from Android to Project.
Now search for the libs folder inside app - build folder.
Once you have pasted the .jar file inside libs folder. Right click on the jar file and at end click on Add as library. This will take care of adding compile files('libs/library_name.jar') in build.gradle
Now you can start using the library in your project.

Categories

Resources