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).
Related
I am learning the android tab with swipe functionality using material theme. I have a sample tutorials from here and it is build from Android studio.
I am currently using eclipse for my project.
I am following the tutorial and i can't import the TabLayout from com.android.support:design
Below is the code,
import android.support.design.widget.TabLayout;
Showing the error, The import android.support.design cannot be resolved
I downloaded support:design:23.0.1 from here and imported to eclipse, even then the error appears.
Can any one tell me where to download and import the com.android.support:design:23.0.1 in eclipse.
Thanks
Install Android SDK 23.0.1
Import design library from sdk\extras\android\support\design into eclipse workspace
To mark the design project as Library, open properties -> Select Android ->Check Library
Now import this design Library to your Project from project properties.
This worked for me in Tab material design.
If the design folder is not found in the said location, try to locate it in sdk\extras\android\m2repository\com\android\support\design instead, especially for the later version.
I have also face same problem then find solution like this.
It work for me hope same for You.
First Step:- find .aar file for design-23.0.1.aar
E:\new sdk\sdk\android-sdk-windows\extras\android\m2repository\com\android\support\design\23.0.1
Second Step:- copy that file and rename it like design-23.0.1.jar to be extract this.
After unzip it you find classes.jar, res, AndroidManifest etc.
Third Step:- Create Library project in eclipse Named design and copy
classes.jar in libs folder
all res in res/
replace AndroidManifest.xml
and last add lib appcompat-v7 by right click on lib project -> properties-> Android -> add -> appcompat-v7
Most important do not forgot clean project and can be restart eclipse for refreshing eclipse.
And more deep details follow steps Guided by commonsware's blog
Create an empty directory that will be the home for the Android
library project. For the rest of these steps, I will refer to this as
“the output directory”.
Copy the AndroidManifest.xml, res/, and assets/ directories from the
AAR into the output directory.
Create a libs/ directory in the output directory. Copy into libs/ the
classes.jar from the root of the unZIPped AAR, plus anything in libs/
in the AAR (e.g., mediarouter-v7 has its own JAR of proprietary
bits).
Decide what build SDK you want to try to use. You might just choose
the highest SDK version you have installed. Or, you can use the
android:minSdkVersion and the -vNN resource set qualifiers to get
clues as to what a good build SDK might be. If desired, create a
project.properties file with a target=android-NNN line, where NNN is
your chosen build SDK. Or, you can address this in Eclipse later on.
Import the resulting project into Eclipse, and if needed adjust the
build SDK (Project > Properties > Android). Also, you will need to
attach to this library project any library projects it depends upon
(e.g., mediarouter-v7 depends upon appcompat-v7).
Good Luck!
And Special thanks to commonsware !!
A great fix to that problem is that you copy the sdk\extras\android\support\design\libs\android-support-design.jar file to "libs" folder of your project
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.
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.
I´m new to Android World but I really like it, I programmed some apps and now I would like to try the ActionBarSherlock specially for the tabs menu.
I have Eclipse Juno version 4.2, I use jdk-7u5 and the latest version of SDK (v.20)
I want to install ActionBarSherlock version 4.1
As in Eclipse Juno there is no "Select Create project from existing source" option I imported Sherlock library as a existing project on Eclipse and a red cross appears in almost all packages in src.
Then, I added it as library on my own project. Now a red exclamation mark appears on my Android Aplication Project.
I´m using android:minSdkVersion="7" android:targetSdkVersion="14"
I read a lot about different problems with the library ActionBarSherlock and I tried everything they say in the forum, even install Eclipse Helios to use
the option "Select Create project from existing source", but I had an Installation Problem with ADT.
Thank you in advance everybody.
I found this tutorial wich solve the problem I had with ActionBarSherlock.
Here it is http://androiddevelopmenttutorial.co/actionbarsherlock-getting-started/
From this web http://www.grokkingandroid.com/adding-actionbarsherlock-to-your-project/
Getting ActionBarSherlock and adding it to Eclipse
The first thing you have to do, is to download the library from actionbarsherlock.com. After this unzip/untar it. The download contains three folders: library, samples and website. The samples folder contains four sample projects to showcase what you can do and to show you how to do it. You should have a look at them. The website folder contains the code of the project website. The library folder finally contains ActionBarSherlock’s source code.
Now go to Eclipse and add the ABS-library as an Android project. Do not use Eclipse’s import tool to import the ActionBarSherlock library – it would not work immediately and you would have to fix some settings. Instead use the project creation wizard of the Android Developer Tools.
Open File -> New -> Project -> Android Project From Existing Code.
Creating an Android project from existing source
In the next screen select the folder, which Eclipse then uses to search for projects. If you select the ActionBarSherlock root folder, Eclipse suggests a list of projects to create. Leave the “library” project checked and uncheck all others:
Select the library project
Click “Finish” to create the project.
Eclipse will now create a new project named “library”. I prefer a more useful name, so select the project called “library” and hit F2 to rename the project. I have renamed the project in Eclipse to “ActionBarSherlock”, so all following screens will refer to this name.
Adding the library to your project
Now that ABS is a library project you have to tell your own project to use it. I will use the project of my last post for this. Go to FragmentStarter’s project settings and switch to the Android tab.
If necessary scroll down until you see the Library panel. Click “Add”:
Adding libraries to an Android project
In the next window all available library projects will be listed. Select ActionBarSherlock and click “Ok”.
Select ActionBarSherlock from the list of libraries
When the window disappears the library should be listed in the library panel of the Android properties tab:
Check if the library has been added succesfully
Then appears an error: Jar mismatch! fix your dependencies, to solve it there is to copy the file android-support-v4.jar from your_project/libs and paste it on library/libs.
Before you can use ActionBarSherlock you have to extends your Activity like this: public class MainActivity extends SherlockActivity and change the theme in Manifest: android:theme="#style/Theme.Sherlock.Light.DarkActionBar"
This is the way to add ABS to your project. Hope it works for all
I want to make some ActionBar for my application using this library: https://github.com/johannilsson/android-actionbar but I don't know how to import it in my android project. There is no jar file. How can I do?
Flo
First, make sure you're using the latest version of the Android SDK, things have improved dramatically within the last few months.
Install the android-actionbar source code, either downloading it and unpacking it, or (preferably) using git to clone the repository on your system.
(I strongly recommend using the mimic-native-api branch as it is the most up to date.)
Import the android-actionbar project into Eclipse. Note that the library's .project file is located in android-actionbar/actionbar. There is a small sample project in android-actionbar/actionbarexample as well.
The project's library setting should already be set, but you can confirm this by right-clicking on the android-actionbar project in Eclipse, choosing Properties, and confirming that "Is Library" is enabled in the Android settings category.
In Eclipse, right-click on the project that you want to use the action bar library in, and choose Properties. Select the "Android" category in the list on the left. In the "Library" settings on the right, click the "Add..." button and select the android-actionbar library project.
Tip: I've found Eclipse can get a bit squirrely when you edit library code, if you run into errors that don't want to go away, use Project > Clean... to remove the R.java files, etc. ...then refresh your package explorer and rebuild.
You'll want to look at http://developer.android.com/guide/developing/projects/projects-eclipse.html#SettingUpLibraryProject and http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject. The first link explains how to create a Library project: you probably just need to take the github zip file, expand it and then add it to Eclipse. You can then import it into your own project in Eclipse.
Just copy the source into your project folder and add each file as a new class