Adding google-play-service source to my android application - android

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.

Related

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.

Eclipse failed to include google play services

I am trying out android gcm in eclipse. I have successfully completed the http server implementation but then i get an error in the manifest file around #integer/ play.
I have tried importing the jar manually but it doesn't work.
Any help?
Follow the instructions carefully.
Make sure that both the project library and the application project that depends on it are in your workspace. If one of the projects is missing, import it into your workspace.
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.
Basically, you have to import the Google Play Services project, then add it as a library in the project.

Cannot create new project - There must not already be a project at this location

I am trying to start using the just released Android Studio, I have already established the location for the Android SDK, and the Studio opens correctly.
Now, I want to create a new application project, but I cannot figure out what to select as project location.
Steps followed:
Launch Android Studio
Select New Project
Enter Application Name, Module Name, Package Name.
Click on the '...' button to select a project location
Select the appropriate folder I created for the project, which is empty. See Screenshot here of the dialog at this point.
Clicked Ok on the dialog, and now I am prompted with a second dialog, that is now labeled 'Select Path', where previous dialog was labeled 'Please choose a Project Location'. No matter what folder I select, the option for 'Ok' is grayed out and cannot be selected. Image here.
I read a similar question, and I am making sure, as you can tell by the steps I followed, that I am entering the path at the very end, and it still won't work for me.
I really think there must be a silly thing I am missing here, not sure what it may be though.
Any ideas?
So, apparently what caused the main problem is that the first time I launched Android Studio I didn't create a new project, I imported one, and that seemed to screw the whole workflow of it.
As per someone's answer, who was apparently removed, here are the steps.
Go to C:\Users\Username\ and erase the folder named: .AndroidStudioPreview.
Launch Android Studio again, it will ask if you want to import any settings, select the option that doesn't import anything.
Optionally Configure, Project Defaults, Project Structure, Platform Settings, and make sure that both the JDK and Android SDK are configured, for instance, I had to point Android Studio to a folder where the SDK had already been downloaded.
Create new project, and leave the default workspace that will now show, it should be C:\Users\Username\AndroidStudioProjects
That's it, just go through the setup wizard, and you're done.
This is a really simple issue. Android Studio likes to create the folder for the project on its own. That means you can't just select a pre-made folder. For example if you select C:/Android Projects with Android Projects being a folder, you must append a folder name to the location for Android Studio to create, for example C:/Android Projects/NEW PROJECT
No work-arounds needed.
I have found a workaround.Here's what I did :
Click on check out from version control.
Select git(I have a bitbucket account,but might work with github).
Put in repo-url
Select the parent directory(this directory will also become the parent directory of your android projects)
Then click clone
Select YES when asked if you want to create Android studio project from existing sources.
Select Create Project from existing sources
Don't change anything,select Next and then Finish.
Now it will create a new project at your selected location
Close android studio,go back to your parent directory and delete the project folder.
And now start your new project wizard,you should be able to see your parent directory listed in project location.Start typing details about your project and the directory will be updated accordingly.
I had the same issue this morning when trying to create a new project and found a simple way to get around it.
Choosing the path to the project folder was impossible as I kept getting the same error message 'There must not already be a project at this location'. What I then did was type out the path manually, but not all at once. To begin with I thought I'd just try to set a folder at the root of my drive eg. C:\AndroidStudioProjects. It seemed to be ok with this, which led me to try to add the rest of the path manually as well. So the final path would be something like C:\Development\Android\AndroidStudioProjects
This worked, no errors showed up and it let me go through the rest of the set up.
Hope this works for others out there who are facing the same issue.

Cannot get ActionBarShirlock library to link to my project

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!

can i provide a project contents as jar files to another projects?

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 )

Categories

Resources