Google Player Game Service Error: Can't build the sample game - android

I can't build the sample game TypeANumberChallenge provided by Google (see GitHub). Got the following error message:
The project was not built since its build path is incomplete. Cannot find the class file for com.google.android.gms.games.GamesClient. Fix the build path then try building this project
The type com.google.android.gms.games.GamesClient cannot be resolved. It is indirectly referenced from required .class files MainActivity.java /TypeANumber/src/com/kerrywei/games/tanc
I did include the project library BaseGameUtils and google-play-services-lib as described by readme and Google Play Services Guides, but still got the error, and can't just compile...
Update:
I tried to remove TypeANumberChallenge and redo the whole process and got a new error when trying to add BaseGameUtils as library:
An internal error occurred during: "Android Library Update".
Path must include project and resource name: /BaseGameUtils

Problem solved by reading Google Play Services Guides
Make a copy of the Google Play services library project. Copy the library project at
<android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/
to the location where you maintain your Android app projects. If you
are using Eclipse, import the library project into your workspace.
Click File > Import, select Android > Existing Android Code into
Workspace, and browse to the copy of the library project to import it.
You CANNOT use the lib project in SDK folder DIRECTLY...
What a joke..

Related

R.java file cannot be resolved after importing Google Play Services

I have created an Android app in that when I imports Google Play Services library it removes R.java file.
I had clean and build the project and also restarts the eclipse but can't get the R.java file.
How to solve this problem?
Thanks.
As mentioned here : https://developer.android.com/google/play-services/setup.html#Setup
Here's different steps to proceed for setting up Google Play Services :
Copy the library project at /extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects.
Import the library project into your Eclipse workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
In your app project, reference Google Play services library project. See Referencing a Library Project for Eclipse for more information on how to do this.
Note: Don't forget to copy the library to your development workspace :
check your resource file error.
after solving your resource xml file error remove import android.R; from your java file and import com.your.package.name.R; in your java
Finally I got the solution myself.
I just changed the android:minSdkVersion="8" to android:minSdkVersion="14" in AndroidManifest.xml file and problem solved.
Thanks.

google play services lib... cannot import com.google.android.gms.map (using eclipse)

i'm having some problem with the google play services library (using eclipse). Thus, I tried to do the following example https://developers.google.com/maps/documentation/android/intro
But I still have multiple error for all the import below com.google.android.gms.maps for instance.
I have the google-play-services_lib imported within my eclipse workspace
In my project>properties>android>Library the google-play-services_lib is actually referenced
its also referenced in java build path > libraries
Try importing yourAdtBundlePath/sdk/extras/google/google_play_services/libproject/google-play-services_lib as a project in Eclipse (I assume you use Eclipse) and then adding it as a library in Properties for YourProject/Android/Library/Add...

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.

Paypal Mobile Express Checkout Library sample app gives me NoClassDefFoundError Exception

I'm testing the sample app for Mobile Express Checkout Library with Android.
I'm getting java.lang.NoClassDefFoundError: com.paypal.android.pizza.ResultDelegate
The error is on this Pizza.java line: PayPal.fetchDeviceReferenceTokenWithAppID(this, appID, server, new ResultDelegate());
I'm confused, i didnt find any info about that error on google, and also on the faq on paypal and x.com, so i don't know how to solve it.
I simply opened the sample code project and executed it.
This is the link to the project and the library: https://www.x.com/sites/default/files/PayPal_MECL_1.0_Android-Developer-Package_0.zip
There are only three reasons you will ever get this error:
The class genuinely doesn't exist. If you are using code from an official example and getting this, make sure you have the latest build of the library
You have not added the jar to your build path. To fix this, right click on the jar in Eclipse, and do Build Path ► Add to Build Path.
Your jar is not in the /libs folder. This happens when you have added the jar to the build path, but newer versions of ADT need it to be in /libs. Put it there and it will automatically be added to the build path. If it isn't, try doing a Clean build via ant clean or Project ► Clean in eclipse.
Mostly, such errors occur because newer versions of the ADT require all external jars to be in the libs folder.
By looking at the project you linked to, I can see the paypal jar in the project root. Instead, try moving it into a /libs folder. This should solve your problem.
I think you have not exported library jar from the configure build path section of eclipse.
create libs directory in project's directory and add move PayPal_MECL.jar to /libs. goto project properties and remove existing PayPal_MECL entry from libraries

Cannot Reference LVL Android Library in my App Project

I'm following the instructions found at http://developer.android.com/guide/publishing/licensing.html
I made a copy of the <sdk>/market_licensing directory, then using the New Project Wizard in Eclipse I created a new Android project from Existing source and pointed it at the library subdirectory in my copy of market_licensing.
I've checked the "is Library" box in the market_licensing project android properties.
I've added that project as a library project in my app project. It shows up in the list with a green checkmark.
When I save the project settings and rebuild, the compiler can't find the classes in the LVL project and when I go back into my app's project settings the entry in the libraries list now has a red X instead of the green checkmark.
I don't understand what I'm doing wrong which is preventing me from referencing the LVL project. Any help?
EDIT: I've tried adding the licensing project to my build path for my app project and then I'm able to build, but when I try to run the app crashes because it can't find any of the library code. So clearly the "library" status of the licensing project is not set up correctly and/or its not being automatically injected into my app project on build.
I was posting up a similar question and as I did so realised what the problem was - see here In eclipse, unable to reference an android library project in another android project

Categories

Resources