how to import android licensed project in eclipse? - android

Can anyone help me to know how to import licensed project, while trying... the following classes cannot be imported.
import com.android.vending.licensing.LicenseChecker;
import com.android.vending.licensing.LicenseCheckerCallback;
import com.android.vending.licensing.ServerManagedPolicy;
import com.android.vending.licensing.AESObfuscator;
Any help will really be appreciated. Thanks

The latest version of the LVL seems to require
import com.google.android.vending.licensing.LicenseChecker;
import com.google.android.vending.licensing.LicenseCheckerCallback;
import com.google.android.vending.licensing.ServerManagedPolicy;
import com.google.android.vending.licensing.AESObfuscator;
instead of
import com.android.vending.licensing.LicenseChecker;
...
(as the current document tells me to do)
It took me a half day to figure this out.. haha

LVL library can be downloaded using the SDK Manager
Link
The License Verification Library (LVL) is a collection of helper classes that greatly simplify the work that you need to do to add licensing to your application. In all cases, we recommend that you download the LVL and use it as the basis for the licensing implementation in your application.
The LVL is available as a downloadable component of the Android SDK. The component includes:
The LVL sources, stored inside an Android library project.
An example application called "sample" that depends on the LVL library project. The example illustrates how an application uses the library helper classes to check and enforce licensing.
To download the LVL component into your development environment, use the Android SDK and AVD Manager. Launch the Android SDK and AVD Manager and then select the "Market Licensing" component, as shown in the figure below. Accept the terms and click Install Selected to begin the download.

Related

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:

com.google.android.gms.games.GamesClient cannot be resolved

I´m trying to develop a real-time multiplayer game using google play game services and I download the sample(ButtonClicker2000), but Eclipse ADK keeps complaining that com.google.android.gms.games.GamesClient cannot be resolved.
All of the other imports work fine:
import com.google.android.gms.games.Games;
import com.google.android.gms.games.GamesActivityResultCodes;
import com.google.android.gms.games.multiplayer.Invitation;
import com.google.android.gms.games.multiplayer.OnInvitationReceivedListener;
import com.google.android.gms.games.multiplayer.Participant;
import com.google.android.gms.games.multiplayer.realtime.RealTimeMessage;
import com.google.android.gms.games.multiplayer.realtime.RealTimeMessageReceivedListener;
import com.google.android.gms.games.multiplayer.realtime.Room;
import com.google.android.gms.games.multiplayer.realtime.RoomConfig;
import com.google.android.gms.games.multiplayer.realtime.RoomStatusUpdateListener;
import com.google.android.gms.games.multiplayer.realtime.RoomUpdateListener;
import com.google.example.games.basegameutils.BaseGameActivity;
Does anyone know how to fix this?
GamesClient was a part of the Google Play Services library - google-play-services.jar.
In older versions, you could locate the class if you explore the library. In Eclipse it's probably under 'Android Private Libraries' in your package list. Go down the packages and search for com.google.android.gms.games.GamesClient
Since the Google Play services update to version 4.3, GamesClient is no longer available. You should switch to GoogleApiClient instead.
So if you update your packages from the Android SDK Manager, Google Play Services will be updated to revision 16, released on 17 March 2014. Since GamesClient has been deprecated, it will be missing form the package after you restart Eclipse and refresh the workspace.
This is the official statement:
The previous Games client is deprecated as of February 7th, 2014.
Existing and new developers are strongly encouraged to use
GoogleApiClient instead of the deprecated GamesClient.:
So you either need to replace GamesClient with GoogleApiClient (better), or downgrade your google-play-service lib to the older version (not recommended).
In order to replace GamesClient, you will need to refactor the code. Here is the official announcement and introduction to the new API. Here is one example of an updated sample.
It's likely that the playgameservices samples will be updated, you can issue a ticket the github page of the project for that.

Android LVL won't Import into Eclipse

I'm trying to get the Android LVL (App Licensing) setup to work with my software... and I cannot get it to import into Eclipse at all. The documentation says, "add the library folder to your workspace"... but it won't let me. I have rev. 2 downloaded... but when I try to import the project (from /android-sdk-macosx/extras/google/play_licensing/library) it shows up greyed-out in the projects list and won't import. Can someone please help me out here?
Just drag the sources into your project. The intention of the LVL is that you build your own sources and make changes (to try to thwart people that modify your binary by looking for LVL-specific bits).

Cannot import com.android.internal.app in Eclipse

I cannot import com.android.internal.app in Eclipse. I created Android Project, but those apps are invisible. Should I change something in projet properties?
I want to import:
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
Thanks for any suggestions!
com.android.internal.* classes are internal classes of the Android Framework that are not intended to be public and thus they are not visible in the Android SDK. Those classes are subject to change from the Android Team without notice to developer. It is not recommend to use them for developing application as it is very likely that you app will be broken in the next Android release.

Google APIs: downloading and reading the sources

My goal is to understand every single bit of the following example:
http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager
I can run the example successfully, but now I want to understand every single
line of code in the example. For as far as the standard android APIs I can look
up their function by googling them up and looking at developer.android.com, but
for the other lines that come from the Google APIs I cannot find the up-to-date
1.6 sources on the web for clsses such as the following:
import com.google.api.client.extensions.android2.AndroidHttp;
import com.google.api.client.googleapis.auth.clientlogin.ClientLogin;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.HttpResponseException;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.InputStreamContent;
import com.google.api.client.util.DateTime;
import com.google.api.services.picasa.PicasaClient;
import com.google.api.services.picasa.PicasaUrl;
import com.google.api.services.picasa.model.AlbumEntry;
import com.google.api.services.picasa.model.UserFeed;
I cannot see any JavaDoc in eclipse, so the only alternative I have to learn about
these is to look at the code. How can I use mercurial to sign out up to date copies
of the Google APIs including those classes that can be used on android?
I think, since I cannot find what I want on the web is to grab the sources
as that seems to be the only way to learn what I need, but I don't know how
to use hg to do this, because I don't know how to use hg nor the site where
I can get the sources from.
Thank you for your help,
John Goche
If you are using Eclipse the following post might be useful:
Attaching Android platform source in Eclipse
I had the same problem before and read through the previous answer on how to setup the build environment for Android. Unfortunately, the build environment so far does not support Windows Box. So a quick way is to download the source for a particular android version (e.g. 2.2) and extract to a local directory. In your Eclipse project, right click on android.jar to open the properties dialog. click on Java Source Attachment and enter the root directory of your source. Then refresh your project. You're set to debug through the source on Windows.

Categories

Resources