Game Services classes Cannot be resolved - android

I want to implement Google Play Game Services. But in GameHelper class the following classes could not be found at compilation.
import com.google.android.gms.games.Games;
import com.google.android.gms.appstate.AppStateManager;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.plus.Plus;
Error:
The import com.google.android.gms.appstate.AppStateManager cannot be resolved GameHelper.java
I already read the google docs about Game Services and made all like that. In App Billings works great. So I have integrated the library project of Google Play Services in the right way.
Does anyone know something about this problem?

I got the same issue in Helper class like below
import com.google.android.gms.games.Games;
import com.google.android.gms.appstate.AppStateManager;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.plus.Plus;
My solution was updating google play services. Now I dont get any error

In the git repository look for classes in: EndlessTunnel\BaseGameUtils\src\com\google\example\games\basegameutils\
This may not be the perfect solution, but the git repository contains 3 directories containing the GameHelper.java (and in the same folder, its related BaseGameActivity.java).
After many hours I've finally managed to get rid of all the errors, but I have yet to test if this will cause any limitations.

Related

Mutiple dependency declarations to missing classes in 'SQLiteDatabase' class

I imported the 'SQLiteDatabase' class present in 'android.database.sqlite' package, into my project.I went into the class declaration to find the opendatabase function, but i noticed that the class was full of errors and was importing certain undefined/undeclared classes, like:
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.database.sqlite.SQLiteDebug.DbStats;
import android.os.SystemProperties;
These classes are used throughout the 'SQLiteDatabase' class.
I tried to invalidate caches and restart the AS IDE, but the error still persisted.
I went into the sdk manager and downloaded all the required core android packages, but still nothing changed.
Finally, I checked out the documentation to see if something was wrong with my sdk. The documentation too did'nt recognize these import calls. like, android.annotation package does'nt even declare a IntDef or IntRangeclass, which has been imported in SQLiteDatabase. It gives the same, could resolve symbol error.
After doing research for a while, I found an answer to my own question. I'm answering just in case it might help others stuck in this error/problem. The classes that were imported are hidden classes, tagged with annotation #hide.
Refer to this article for more.
Hidden classes (even if they are public in the Java sense) are removed from android.jar file containing specific platform API dependencies, like API level 27. Hence you get the error when you try to import something like Nonnull, service manager, etc . Hidden classes are those that Google does not want to be part of the documented public API.

Importing google client dependencies

I'm trying to add some YouTube OAuth2.0 authorization for an Android project I'm working on using Android Studio. I got some sample code from here http://bit.ly/1SI805S. I'm pretty sure I linked to it from a Google developers site. I'm trying to add some libraries to take care of the dependencies but it isn't recognizing them. Here are the dependencies:
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.store.DataStoreFactory;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.oauth2.Oauth2;
import com.google.api.services.oauth2.model.Tokeninfo;
import com.google.api.services.oauth2.model.Userinfoplus;
I downloaded a .jar for the com.google.api.services dependencies and that is working fine. I found the file on the Google developers site and it's google-api-services-oauth2-v2-rev103-1.21.0.jar. However, all of the api.client jars I've found are not working. I put them in the libs folder and add compile files to the build.gradle but it won't recognize the imports.
The jars I've used thus far are
google-api-client-util-1.2.3-alpha.jar
google-api-client-extensions-1.6.0-beta.jar
google-api-client-auth-1.2.3-alpha.jar
Is there anything I'm missing? I've found these files in different parts of the net. I've looked through maven repositories and I just found a site, http://www.java2s.com/Code/Jar/g/Downloadgoogleapiclientutil121alphajar.htm, but I don't know that it's helpful. There's some api.client stuff I downloaded from the Google Developers site but that doesn't look like anything I need and it doesn't resolve the dependencies.
Please follow the third apprach in my link, since your library is available online (remotely) as you see in the picture below. Android studio will recognize your dependencies if you add them in their standard ways. In general, there are three standard ways. Please read this link https://stackoverflow.com/a/35369267/5475941. In this post I explained how to import your JAR files in Android studio and I explained all possible ways step by step with screenshots. I hope it helps.
Also, check your build.gradle (Moducle: app) and make sure your remote libraries are compatible with your current SDK. For example my SDK is 23.1.0:
Google HTTP Client Library for Java. Functionality that works on all supported Java platforms, including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
https://github.com/google/google-http-java-client
Project metadata download:http://repo1.maven.org/maven2/com/google/http-client/google-http-client/1.16.0-rc/google-http-client-1.16.0-rc.pom
Binary download:http://repo1.maven.org/maven2/com/google/http-client/google-http-client/1.16.0-rc/google-http-client-1.16.0-rc.jar
Source download: http://repo1.maven.org/maven2/com/google/http-client/google-http-client/1.16.0-rc/google-http-client-1.16.0-rc-sources.jar
The classes that you are searching for are here:

Spotify Android SDK - Cant import player library

I am trying to integrate spotify with my android application. I am using their Android SDK with Android Studio. I followed the tutorial on their official developer guide. I can import and use the authentication api (import com.spotify.sdk.android.authentication;) but cant import the player api (import com.spotify.sdk.android.player;)
Anybody faced this problem or any leads?
EDIT:
I added these dependencies in build.gradle file:
// This library handles authentication and authorization
compile 'com.spotify.sdk:spotify-auth:1.0.0-beta10#aar'
// This library handles music playback
compile 'com.spotify.sdk:spotify-player:1.0.0-beta10#aar'
Now I tried to try out the demo code mentioned in the link above. But I am getting error in these imports.
import com.spotify.sdk.android.player.Spotify;
import com.spotify.sdk.android.player.ConnectionStateCallback;
import com.spotify.sdk.android.player.Player;
import com.spotify.sdk.android.player.PlayerNotificationCallback;
import com.spotify.sdk.android.player.PlayerState;
However I can import the authentication related imports.
import com.spotify.sdk.android.authentication.*;
Either the player library is not getting imported properly or the import definitions have changed in 'com.spotify.sdk:spotify-player:1.0.0-beta10#aar' version, since the demo code that has been given is for 'com.spotify.sdk:spotify-player:1.0.0-beta9#aar' version.

How can I import com.android.internal.telephony?

I downloaded an Android Project and got some errors.
How can I use this imports in Android?
import com.android.internal.telephony.IccSmsInterfaceManager;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.SMSDispatcher;
When I import this, I got errors like these:
The import com.android.internal.telephony cannot be resolved
The import com.android.internal.telephony cannot be resolved
The import com.android.internal.telephony cannot be resolved
The import com.android.internal.telephony cannot be resolved
Later in the code there are:
Phone phone = PhoneFactory.getDefaultPhone();
With the error:
Multiple markers at this line
- Phone cannot be resolved to a type
- PhoneFactory cannot be resolved
And so on...
I tried to fix it with the https://stackoverflow.com/a/16377968/3203914
but I did not work for me.
Can please someone tell me how to fix it?
Thanks!
How can I use this imports in Android?
Those are not part of the Android SDK. If you are editing the Android source code, the build process for it should resolve those imports. If you are trying to write an Android app, you cannot directly reference them. In fact, com.android suggests they are part of a separate app, not yours and not the Android framework.
CommonsWare is correct, its not in the SDK so you cannot directly reference them. You will either have to
Import all of the android source code, which will resolve these issues
Import the specific project containing this code, then set up your code as a dependency
Stop using those packages

Calendar Syncronization in Android Application

I am working on project a in which i have to sync my program with google Calendar using Android application.
for that i am using eclipse and i got some code online but i dont know wht .jar file i need to add for support below importss..
import com.google.Android.gdata.client.AndroidXmlParserFactory;
import com.google.Android.gdata.client.JakartaGDataClient;
import com.google.wireless.gdata.calendar.client.CalendarClient;
import com.google.wireless.gdata.calendar.data.EventEntry;
import com.google.wireless.gdata.calendar.data.When;
import com.google.wireless.gdata.calendar.parser.xml.XmlCalendarGDataParserFactory;
import com.google.wireless.gdata.client.QueryParams;
import com.google.wireless.gdata.data.Feed;
import com.google.wireless.gdata.parser.GDataParser;
please can anybody help me regarding this ..
or any other clue for my project because i got a deadline on next week ..
thank you very much in advance..
i'll really appreciate.
com.google.android.gdata and com.google.wireless are not part of the public SDK so you won't be able to use them.
I haven't tried to use the gdata-java-client library on android yet, but you should see if you can download it and include it in your project and see if you can compile and run it on android.
http://code.google.com/p/gdata-java-client/

Categories

Resources