Eclipse failed to include google play services - android

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.

Related

Project import giving Google Play Service error

I am working on Open Data Kit. I have cloned the ODK Collect repo on my system.
Now whenever i try to import the Android Project in my Android Studio,
i get the following error
* Project ODK Collect:D:\Development\opendatakit.collect\project.properties:
Library reference ..\playservices could not be found
Path is D:\Development\opendatakit.collect\..\playservices which resolves to D:\Development\playservices
I have put the Google-Play-Services JAR file in the project folder.
Please guide with detailed steps.
I SEARCHED FOR SIMILAR QUESTIONS, AND NONE OF THE SOLUTIONS WORK
Thanks a lot.
To prevent Unrecoverable error
First open eclipse and open project remove all errors make project runnable.
If you don't have ecclipse installed then delete (keep backup) project.properties file from the project
Now try to import your project in Android Studio you will not get Unrecoverable error
Now to add dependency
Right click on the project folder click Open Module Setting
Goto dependency tab (last one)
Select + button on the right side , Select Library dependency.
Scroll to Google play service and select it.
Now you will be able to import and work with Google play service.

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.

How to import a new project in android app properly?

I am making an android app which uses google maps api v2. I want to use the clustering features so I am following the tutorial here
http://karnshah8890.blogspot.ca/2013/04/clustering-on-google-map-v2.html
and using the android maps extension plugin
http://code.google.com/p/android-maps-extensions/
The problem is how do I import this project in my app. I tried doing file > import, then browse for the folder called android-maps-extensions then right click my project folder then click properties then add the reference to the android-maps-extensions. Right after that, I get tons of errors in my project about needing to import R. If I try that, I get other errors.
Does anyone know how to fix this?
Thanks.
I had the same problem and I've found a solution:
right-click on android-maps-extensions
select "Android Tools / Add Support Library..."
right click on your project
in the Android section, remove the google-play-service library and keep only the android-maps-extensions
do a clean up, and it should work
try:
New->other->android->Android Project from Existing Code
point to the root dir(android-maps-extensions-1.3.1)
then select android-maps-extensions
[finish]
this is a library project
then you need to add this library to your project:
right click on your project->properties-Android-> scroll to the bottom to the Library section then hit add and select android-maps-extensions.

How to add google-play-services.jar project dependency so my project will run and present map

I have following problem:
I try to use SupportMapFragment from com.google.android.gms.maps.SupportMapFragment which is part of Google Maps Android API v2.
My first approach was to add project to Eclipse from android-sdk\extras\google\google_play_services\libproject\google-play-services_lib location and set it as referenced project in Properties -> Project References menu of MyApp. I also added project to Java Build Path / Projects. Error indicators disappeared from Eclipse but when I tried to run my app I got NoClassDefFoundError exception.
So my second approach was to copy jar file from google-play-services_lib/libs to my project's libs directory. MyApp succesfully started but in LogCat I can see dead code ... something message so I guess that jar file has to be referenced in another way.
And now I am confused and tired..
Maybe someone more experienced in Android can tell me what should I do ?
The quick start guide that keyboardsurfer references will work if you need to get your project to build properly, but it leaves you with a dummy google-play-services project in your Eclipse workspace, and it doesn't properly link Eclipse to the Google Play Services Javadocs.
Here's what I did instead:
Install the Google Play Services SDK using the instructions in the Android Maps V2 Quick Start referenced above, or the instructions to Setup Google Play Services SDK, but do not follow the instructions to add Google Play Services into your project.
Right click on the project in the Package Explorer, select Properties to open the properties for your project.
(Only if you already followed the instructions in the quick start guide!) Remove the dependency on the google-play-services project:
Click on the Android category and remove the reference to the google-play-services project.
Click on the Java Build Path category, then the Projects tab and remove the reference to the google-play-services project.
Click on the Java Build Path category, then the Libraries tab.
Click Add External JARs... and select the google-play-services.jar file. This should be in [Your ADT directory]\sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs.
Click on the arrow next to the new google-play-services.jar entry, and select the Javadoc Location item.
Click Edit... and select the folder containing the Google Play Services Javadocs. This should be in [Your ADT directory]\sdk\extras\google\google_play_services\docs\reference.
Still in the Java Build Path category, click on the Order and Export tab. Check the box next to the google-play-services.jar entry.
Click OK to save your project properties.
Your project should now have access to the Google Play Services library, and the Javadocs should display properly in Eclipse.
What i have done is that import a new project into eclipse workspace, and that path of that was be
android-sdk-macosx/extras/google/google_play_services/libproject/google-play-services_lib
and add as library in your project.. that it .. simple!!
you might require to add support library in your project.
Be Careful, Follow these steps and save your time
Right Click on your Project Explorer.
Select New-> Project -> Android Application Project from Existing Code
Browse upto this path only - "C:\Users**your path**\Local\Android\android-sdk\extras\google\google_play_services"
Be careful brose only upto - google_play_services and not upto google_play_services_lib
And this way you are able to import the google play service lib.
Let me know if you have any queries regarding the same.
Thanks
Some of the solutions described here did not work for me. Others did, however they produced warnings on runtime and javadoc was still not linked. After some experimenting, I managed to solve this. The steps are:
Install the Google Play Services as recommended on Android Developers.
Set up your project as recommended on Android Developers.
If you followed 1. and 2., you should see two projects in your workspace: your project and google-play-services_lib project. Copy the docs folder which contains the javadoc from <android-sdk>/extras/google/google_play_services/ to libs folder of your project.
Copy google-play-services.jar from <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/libs to 'libs' folder of your project.
In google-play-services_lib project, edit libs/google-play-services.jar.properties . The <path> in doc=<path> should point to the subfolder reference of the folder docs, which you created in step 3.
In Eclipse, do Project > Clean. Done, javadoc is now linked.

How android apps use library made by user?

I was reading one of the articles on internet and he was saying that he'll make library so that all the apps can use it. How is this possible? Any ideas?
To add libraries to your project, in eclipse package manager right click on your project select 'Properties' on the left select 'Java Build Path' then click on the libraries tab toward the top. Click the 'Add External Jars' button navigate to the jarfile and select it. Then you are ready to import and use whatever was inside of it in your project. I recommend you add a libs folder to your project and keep all of the jar files used in that project inside there so that if you distribute your project source to someone else they will have all of the needed libraries to compile it.

Categories

Resources