Cannot get ActionBarShirlock library to link to my project - android

I think I have successfully created a library project ActionBarShirlock (4.3.1). Then when I attempt to add it to my app by clicking properties > android then clicking on the "Add" button, I see a box saying "Please select a library project" and I select "actionbarshirlock". actionbarshirlock then appears in my list of libraries accompanied by a large green tick to the left of it. I click "ok". But then If I immediately go back to the properties dialog, I see a large red cross where the green tick used to be.
What happened?
EDIT: I noticed that in the latest release (4.3.1) of ActionBarShirlock, the directory structure within the zip file you download from actionbarsherlock.com is different from how it used to be in earlier versions, and so some tutorials of how to install it are no longer valid. So I had better explain how I created the library in the first place...
Step 1. I downloaded the zip file and expanded it into c:\android stuff\JakeWharton-ActionBarSherlock-071a61c
Step 2. From eclipse I clicked file > new > other > android > android project from existing code. Then next.
Step 3. From the "Iport projects" dialog, I clicked browse, then navigated to "C:\android stuff\JakeWharton-ActionBarSherlock-071a61c\actionbarsherlock" and clicked "ok".
Step 4. I now see "actionbarshirlock" in the "new project name" list, the tick box to the left is already ticked. ("copy projects into workspace" is not selected). I click "Finish"
Step 5. In package explorer I now see actionbarshirlock in my list of projects. I then to clean all projects and build all. There are no errors or warnings in my "Problems" tab.
Thats' it.

Try to follow the beginning of this two guides: link1 link2
The only thing different for the current version is that you have to import the main folder, where pom.xml is. After that if you get an error remember to delete android-support-v4 from your linked library

Shutting down eclipse and running it again made the problem disappear!

Related

The container 'Android Dependencies' references non existing library appcompat_v7.jar'

I know this question has been asked many times but unfortunately could'nt find any solution. So here it is
The container 'Android Dependencies' references non existing library 'C:\Users\Zain-ul-abdeen\Android\appcompat_v7\bin\appcompat_v7.jar' OnClick Build path Build Path Problem
Clean and built my project many times
You have to do the next thing: go to File>Import>Android>Excisting Android code into workspace click on next. Then you have to chose browse and go to the place where your sdk folder is located. Next you have to select the folders extras>android>support>v7 then you wil see a folder named appcompat you have to select this folder and click ok and after that finish.
When this folder is imported right click on your current project folder in Eclipse select properties. Next click on android and you will see an add button. When you click on that you will see a library named android-support-v7-appcompat select that and hit ok. This will do the job. Hope it will help you out.
Copy the appcompact_v7.jar to missing folder
C:\Users\Zain-ul-abdeen\Android\appcompat_v7\bin\appcompat_v7.jar
1.if you don't have appcompat_v7.jar download at
Download appcompat_v7.jar
2.And Copy the appcompat_v7.jar to Missing Folder
3.Clean or Refresh your project
4.And there will show you error and hover on error
and Then Fix your Project Set up

Can't get application to find android.support.v7, won't find appcompat_v7 project

I'm trying to create an Android application in Eclipse (on Windows Vista), and I can't get it to find the android.support.v7 library stuff that I need. I think I'm setting things up correctly, and what I'm doing works on one computer but is not working at all on another, and I need help figuring out where things are going wrong.
In Eclipse, I followed the steps to create a new "Android Application Project", and selected API 11 as the minimum SDK, and went through all the other steps. (For "Create Project in Workspace", I unchecked it and asked for the files to be created in a location on a network drive, in case that matters.) This created another project, appcompat_v7, which I understand is how things work now. I built that project. But then when I tried to build my application, I couldn't get past The import android.support.v7 could not be resolved errors.
Here's the symptom that concerns me: I right-clicked on the application project and selected Properties -> Android. The bottom part, "Library", has "C:\users\me\workspace\appcompat_v7" in the left (Reference) column, and a question mark in the right (Project) column. [This is the workspace directory, not the network-drive directory where I'm keeping the files.] Also there's a red X next to the pathname. I tried selecting Add, which brought up a list including the appcompat_v7 project that got automatically added. I selected that, and it got added to the list with a green check mark. Then I selected the other one and Remove'd it. Now the list had just one appcompat_v7 project, with a green check mark, and the correct name in the right column, so everything looked OK. I clicked OK (also tried Apply then OK). But when I went to Properties -> Android again, now the red X was back and the project name was ? again. So it seems that something it was able to find just a few seconds ago could no longer be found (?). Rerunning Eclipse hasn't helped. The workspace\appcompat_v7 directory and its contents seem to show up normally in a dir command, although if there's something missing I wouldn't know what to look for.
Any suggestions about what to try, or what to check for?
EDIT: By experimenting, I've found more information. Apparently unchecking "Create Project in Workspace", and then selecting a network drive, is what causes the problem. If I start with a clean workspace, and uncheck "Create Project in Workspace" and select a directory on the C: drive, everything works fine. If I do the exact same thing but select a directory on a different drive, such as a network drive or USB flash drive, the problems show up.
After more research, I've concluded that this is a symptom of Android Issue 16472, in which things fail if you have a project on one drive and a library on another drive. The new mechanism, in which the ADT plugin creates appcompat_v7 automatically when you set up a new project, exacerbates the problem. If the workspace is on the C: drive but you want the project files to be on some other drive, by unchecking "Create project in workspace", the plugin will put the project files on your other drive but create appcompat_v7 on the C: drive, which automatically causes the problems reported for #16472.
It's probably best to set up the workspace on the same drive where you put the project files (but I haven't tested this; and in any case, having them on different drives hasn't caused a problem for me, for non-Android Java projects). However, I've found a way to work around this, by copying appcompat_v7 to the other drive:
Use the Android Application Project wizard to create a new application, and let it create your project and a new appcompat_v7 project on different drives.
Using Windows Explorer or some other method, copy the newly created appcompat_v7 from C: to someplace on the other drive.
In Eclipse, delete the appcompat_v7 project.
Import -> Android -> Existing Android Code into Workspace. Browse to the location where you've made a copy of appcompat_v7, select it, and do the import. I found that it called the new project android-support-v7-appcompat, but this is OK. I waited for "Building Workspace" to complete (if you're set up not to build projects automatically, you may have to use Build Project on the new project).
Right-click on your application project, "Properties", "Android". The "Library" section will probably have a path name (the path of appcompat_v7 on the C: drive) with a red X by it. Click on Add; a window with android-support-v7-appcompat should show up; click on that. It should be added to the library list with a green check mark. Now select the path name on the C: drive, and click Remove and then OK. I'd double-check by clicking on "Properties" again, to make sure the library shows up and still has a green check mark.
After you do this, if your workspace is set up to build automatically, this should build your application successfully. (Otherwise build it manually.)
If you later add another application to the same workspace, you don't need to repeat steps 2, 3, or 4. After the wizard creates your project and another new appcompat_v7 or appcompat_v7_2 or something, use Step 5 to add the android-support-v7-appcompat you've already imported and remove the old library reference, then delete the duplicate appcompat_v7 that it just created. (See also Remove v7 appcompat folder.)
Add the library to your application project:
In the Project Explorer, right-click your project and select Properties.
In the category panel on the left side of the dialog, select Android.
In the Library pane, click the Add button.
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.
If you open Java Build Path dialog for the android-support-v7-appcompat project it should look like the one on the picture below.
I know this is a bit old but if anyone had the same issue I fixed like this:
From gradle leave just the last V7 (mine is compile 'com.android.support:appcompat-v7:23.1.1'
and I deleted compile 'com.android.support:appcompat-v7:22.2.0'
) after that go in your class and delete the import v7...after sync again and you will see that Android Studio will ask automatically you if you want import the new Dialog.
I hope this simple case will help someone.

Adding google-play-service source to my android application

I want to add Google-map to my android application and I followed this tutorial: https://developers.google.com/maps/documentation/android/start#overview
but it shows me an error. which is: error: Error: No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version').
when I searched in Google trying to solve the problem, I found that I have to do these steps:
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.
But when I Click Add to open the Project Selection dialog which is step number 3, I could not choose any library project. i.e the list is empty.
I don't know if I should add #integer.xml file? If so, how to do that? I am sorry but I am really new to eclipse.
So, could anyone help me please:(
Thanks..
First, make sure you have the Play Services project in your workspace, as explained here: http://developer.android.com/google/play-services/setup.html
Now make sure that it is a Library Project. Right-click the play-services project -> Properties -> Android and make sure you check Is Library after the list of build targets.
After that, redo the steps you listed. In Step 4 Play Services will be in the list.

how to deploy Pull-To-Refresh ListView by johannilsson

I have checked out johannilsson/android-pulltorefresh on github https://github.com/johannilsson/android-pulltorefresh .
There are 2 projects in it, pulltorefresh and pulltorefreshexample.
The example references com.markupartist.android.widget.PullToRefreshListView which is in the pulltorefresh, I do not know how to link the pulltorefresh for use.
Now I have problem making use of the library.
Copying file by file sure works, but it is far from convenient.
I have also checked the README.md, but it does not cover this.
There are similar library projects on github and they have the same
structure, but help files in them do not cover deploying, either.
I am using eclipse.
In eclipse do File->New->other (don't use File->new->Android application project) and select "Android Project from existing code".
Click next, then browse to the directory with the pulltorefresh library - if you want the files copied to your workspace then select the checkbox under the Projects list box. then click the Finish button.
Repeat what you just did, but this time select the pulltorefreshexample directory.
Make sure both these projects are open and then select pulltorefreshexample in the package explorer, right click it and select properties. In the window that appears select Android on the left, then at the very bottom there's a 'Library' section. Click Add and you should see a list with all open library projects. Select the pulltorefresh one.
Clean and build the library then clean and build the example.
That should do the trick for you.

Eclipse Android project, how to reference library within workspace?

I followed some steps I found here (can't find the URL right now, sorry) to convert my Android project in Eclipse to a layout where 99.9% of my code is in a library project, and then I have 2 other shell projects under the same workspace that are mostly just the AndroidManifest.xml files, and a few resource files. This was done so I can support 2 builds of the same project, with just some minor text/icon changes between the 2. The application name is also different so I can publish both on the Android Market at the same time.
Ever since I did this, about every 10 times I compile, maybe once every day or two, I get "dalvik error 1" and something about "Access already exists" (Access being the name of the first Java unit in my library project).
To "work around" the issue I go in to the Java Build path for my stub-project that I am trying to build, and remove the JAR file from my main library from the libraries tab. Then I can build without the error.
Then a while later (maybe 1 or 2 days) I'll get an error about missing classes when I compile my stub-project (not my library). So I'll go back to the Java Build path and put the reference to the JAR file back in, and all is good again for 1 or 2 days, then I'm back to the same error as before.
Is this just a known issue and something I need to do, or can I resolve by a restructure of my projects/workspaces? Currently I have:
Lib Project - only has 2 libs on build path: Android 2.1 and com.android.ide.eclipse.adt.LIBRARIES
First stub project that uses above lib - has the same 2 libs as above project, plus sometimes I use "Add JAR" to include the JAR from the above project's bin\ folder.
2nd stub project - same libs as first stub project
Should I reference the JAR from my "lib project" using one of the other tabs under build path options? Maybe the "Project" tab instead, or the "Source" tab? I don't currently have it under any of those other areas.
When I get in to the weird state, doing a "Clean project" also doesn't help, I've tried that several times and open/close the IDE between cleaning, to no resolve.
At this point we are in the final testing stages, so my normal daily task is:
Make a minor update (bug fix) in the LIB project
Use the publish wizard to export both projects and update Android Market and other places we keep the APK files
So I'd like those steps to stay simple, without having to open/close multiple workspaces or go through a lot of build steps if possible.
The classical Eclipse/Java way
Add a (workspace) library
Right click the project you want to insert in.
Click Properties.
Select Java Build Path.
Select the Libraries tab.
Now, it depends how you compile your library.
So either do an Add JARs... or an Add Class Folder.
Choose the external variant to use an external source.
That's it.
Add a workspace project
Right click the project you want to insert in.
Click Properties.
Select Java Build Path.
Select the Projects tab.
Click Add... on the right side and you are done.
The additional Android way
Two steps are necessary:
Mark the project you want to use as library project
Reference the marked project
Mark the library project
Right click your project and select Properties.
Select Android on the left and tick the checkbox IsLibrary. Done.
Reference the marked project
Right click your project and select Properties.
Select Android on the left and Add... your marked project. It will be added to the list and is ready to use. Now you are able to access all classes and ressources (e.g. drawables, strings) from the referenced, marked project. Awesome, eh? :)

Categories

Resources