im'triyng to implement the Google Licensing Verification in a Android Studio made app.
By following this lines: http://developer.android.com/google/play/licensing/setting-up.html seems tath:
As an alternative to adding the LVL as a library project, you can copy the library sources directly into your application. To do so, copy (or import) the LVL's library/src/com directory into your application's src/ directory.
I've done this but the import of:
import com.google.android.vending.licensing.LicenseChecker;
import com.google.android.vending.licensing.LicenseCheckerCallback;
fail..
Searching on google i've been noticed that i need to modify the build.grade file on my project, but i can't find a specific solution.
How can I reference the LVL in my android studio project?
There is some tutorial or example?
Thanks
Lorenzo
In Android Studio, Tools-Android-SDK Manager
In SDK Manager, in the extras section choose Google Play Licensing Library
Go back to Android Studio, and choose File-New-Import Module
ADK Manager will have put the downloaded files under your SDK directory, in my case Desktop/android-sdk-macosx/extras/google/play_licensing/library
Choose to import this directory as a module, and give it a name. I used 'lvl'
Optionally change targetSdkVersion in the lvl module's build.gradle to match your project targetSdkVersion.
Then in your projects build.gradle, add the line compile project(':lvl') inside the {dependencies{ section.
Re-sync Gradle and everything should compile correctly.
Finally I've got the solution!
You have to put the library/src/com directories in the youroject/scr/main/java/com and then click on the "Sync project with Gradle files" button.
step 6 is placed in
inside the project(":android"){dependencies { section.
Copying the LVL sources to your application.
As an alternative to adding the LVL as a library project, you can copy the library sources directly into your application. To do so, copy (or import) the LVL's library/src/com directory into your application's src/ directory.
Visit:http://developer.android.com/google/play/licensing/setting-up.html
Related
I am learning the android tab with swipe functionality using material theme. I have a sample tutorials from here and it is build from Android studio.
I am currently using eclipse for my project.
I am following the tutorial and i can't import the TabLayout from com.android.support:design
Below is the code,
import android.support.design.widget.TabLayout;
Showing the error, The import android.support.design cannot be resolved
I downloaded support:design:23.0.1 from here and imported to eclipse, even then the error appears.
Can any one tell me where to download and import the com.android.support:design:23.0.1 in eclipse.
Thanks
Install Android SDK 23.0.1
Import design library from sdk\extras\android\support\design into eclipse workspace
To mark the design project as Library, open properties -> Select Android ->Check Library
Now import this design Library to your Project from project properties.
This worked for me in Tab material design.
If the design folder is not found in the said location, try to locate it in sdk\extras\android\m2repository\com\android\support\design instead, especially for the later version.
I have also face same problem then find solution like this.
It work for me hope same for You.
First Step:- find .aar file for design-23.0.1.aar
E:\new sdk\sdk\android-sdk-windows\extras\android\m2repository\com\android\support\design\23.0.1
Second Step:- copy that file and rename it like design-23.0.1.jar to be extract this.
After unzip it you find classes.jar, res, AndroidManifest etc.
Third Step:- Create Library project in eclipse Named design and copy
classes.jar in libs folder
all res in res/
replace AndroidManifest.xml
and last add lib appcompat-v7 by right click on lib project -> properties-> Android -> add -> appcompat-v7
Most important do not forgot clean project and can be restart eclipse for refreshing eclipse.
And more deep details follow steps Guided by commonsware's blog
Create an empty directory that will be the home for the Android
library project. For the rest of these steps, I will refer to this as
“the output directory”.
Copy the AndroidManifest.xml, res/, and assets/ directories from the
AAR into the output directory.
Create a libs/ directory in the output directory. Copy into libs/ the
classes.jar from the root of the unZIPped AAR, plus anything in libs/
in the AAR (e.g., mediarouter-v7 has its own JAR of proprietary
bits).
Decide what build SDK you want to try to use. You might just choose
the highest SDK version you have installed. Or, you can use the
android:minSdkVersion and the -vNN resource set qualifiers to get
clues as to what a good build SDK might be. If desired, create a
project.properties file with a target=android-NNN line, where NNN is
your chosen build SDK. Or, you can address this in Eclipse later on.
Import the resulting project into Eclipse, and if needed adjust the
build SDK (Project > Properties > Android). Also, you will need to
attach to this library project any library projects it depends upon
(e.g., mediarouter-v7 depends upon appcompat-v7).
Good Luck!
And Special thanks to commonsware !!
A great fix to that problem is that you copy the sdk\extras\android\support\design\libs\android-support-design.jar file to "libs" folder of your project
hello i am quite new to Android development and i want to learn how to use the google Maps API v2. After trying numerous tutorials, i always seem to have a problem with the google play services library. Somehow, Eclipse can't import it properly. I tried this tutorial https://github.com/thecodepath/android_guides/wiki/Google-Maps-Fragment-Guide and when i try to include Google Play Services project as a library, first it all goes nice and smooth, i get a green tick in the Project Properties - Android - Library window, but when i close it i still get lots of "can't be resolved to a type" errors. I return to the window where i add the library and i see a red "X" and a question mark under "project" instead of the green tick. I tried several other tutorials and i always have a problem with this library. I like this tutorial and i would really like to make it work. I also tried to manually copy the library folder in the workspace but that didn't work either. I googled like crazy trying to find an answer but i always find something that i tried before (like manually copying the library in the workspace or something similar). I am quite desperate, i really have no idea why it can't just see the library please help. Also this is my first post to StackOverflow so be gentle :)
later Edit (solved):
when i imported the downloaded project, i kept it on the desktop and thats why it didn't work, after i copied it in the workspace everything worked. Thank you all very much for helping a beginner :)
The important thing in adding a library in eclipse is to remember that your project and the library project need to be in the same workspace.
To solve this follow below ways,
You can copy the google-play-services library project to the same workspace where your main project is there.
else
While importing the library to eclipse remember to check copy projects into workspace which will add a copy of the library to your workspace.
I see a red "X" and a question mark under "project" instead of the
green tick.
The problem is -
The path to your google play services library is not same as the path to your project. It is outside of your project. And so is not recognized by simple import.
Solution - Put the library in the project's libs folder.
NOTE: Just putting the library to the libs folder is not enough.
After you added your library follow these steps -
1) Go to Project -> Properties -> Java Build Path -> Libraries -> Add JARs..
2) Now add your recently added jar to the build path from JAR selection process.
3) Go to Project -> Properties -> Java Build Path -> Order and Export.
4) Put a tick mark in the check box against this library name and press OK.
5) Do Project -> Clean.
if your giving google-Play-Service-lib as a references to your project , try to keep your project and the Google-play services lib should be in same drive.
if your project is on C: drive means place Google-play-services-lib in C:
While making the copy of the entire folder libproject containing google-play-services_lib from eclipse import project by selecting the copied libproject folder in your working place.
For the rest follow the steps in Setting Up Google Play Services
Eclipse
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.
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.
After you've added the Google Play services library as a dependency for your app project, open your app's manifest file and add the following tag as a child of the <application> element:
< meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Android Studio
Open the build.gradle file inside your application module directory.
Add a new build rule under dependencies for the latest version of play-services
eg
...
dependencies {
compile 'com.google.android.gms:play-services:9.2.0'
}
apply plugin: 'com.android.application'
Source developers.google.com
I have an application that I have to look at as a training exercise. It has used few external libraries such as SlidingMenu, ImageViewZoom and ActionbarSherlock.
I have downloaded and extracted those libraries but I have no idea how to add them to my existing project.
For those that are distributed as a simple JAR, do what Emil Adz indicates, and copy that JAR into your project's libs/ directory.
For those, like ActionBarSherlock, that are distribute as Android library projects, you will need to do a bit more work. In the case of Eclipse, you will need to import the library project into your workspace, then go into Project > Properties > Android for your application project and click the [Add] button to add the library project to the application project. For a command-line build, use android update lib-project to link the application and library project together.
You can read more about referencing an Android library project from Eclipse or the command line in the documentation.
You need to import those libraries as Android Project from existing source and mark them as "Is Library" by going into their properties.
Once you marked it as "Is Library" add it to your
project by going into Properties->Android->Library->Add (it will show the list of library you imported).
The Right Way:
What you need to do is to copy the external library (JAR file) to the /libs folder of your project.
That way those libraries will compile with your project and could be use on real device when you deploy your application.
Some times you will need to add a project to your workspace ( For example the Google Map library)
and then add the library reference using the properites -> Android window at the bottom.
You can get an idea of how it's done by reading the first 3 step of this Google Map API V2 guide I wrote. there I reference the android library project:
Google Map API V2 Guide
The Wrong Way:
any other way, like for example adding the files using the properties - > Java build path screen may result in a missing library when you run the project on a real device.
if they are jars the make a libs folder then paste the jar in it and then go to your project buildpath->configure build path->Add Jars-> ok and if it is a library project then go to your project Property->Android->Add(Your Lib Project)->Ok->Apply
Platform: MonoDroid v4.2.4
IDE: Visual Studio 2012
Minimum SDK version: API 12
I'm having runtime issues when trying to utilize the LocalBroadcastManager class included in the Android.Support.v4.Content namespace. In my IDE, I've explicitly added the reference and can scope the namespace/class fine, and, after writing some code, compiles as expected. However, upon application deployment and launch, I'm prompted with the error: "NoClassDefFoundError: android/support/v4/content/LocalBroadcastManager"
Here's the code that prompts the runtime error (DSC_Discconected_From_Device is a class that inherits from BroadcastReceiver). It stops execution at the last line.
IntentFilter filter = new IntentFilter(UsbManager.ActionUsbDeviceDetached);
DSC_Disconnected_From_Device Receiver = new DSC_Disconnected_From_Device();
LocalBroadcastManager.GetInstance(this).RegisterReceiver(Receiver, filter);
Under the SDK manager, all the API packages are installed, as well as the "Support Library" package under extras.
Where is it looking for the definition of the class? I've presumably copied the source, LocalBroadcastManager.java, to paths in the android-sdk framework where it "might" be looking. For example: ..\android-sdk\extras\android\support\v4\src\honeycomb\android\support\v4\content\LocalBroadcastManager.java
Ideas?
Edit: Forgot to mention that my project already references the support library, android-support-v4, in the folder "libs", located in the root of my project. I had to create the directory and add it through Visual Studio.
This problem was hounding me for almost six months now and no solution was helping me but today I have managed to find the correct solution on my own.
When you select your project target version to be greater than or equal to Android 4.0, Android SDK includes "android-support-v4.jar" file in your projects "libs" folder. This jar contains all the classes and methods related Android 4.0 or later.
Android is trying to find the class definition which is in "android-support-v4.jar" so that means you have not configured the build path to the "android-support-v4.jar" file. To do this, follow these steps:
Open your project properties
Select "Java Build Path" from left side menu
Select "Libraries" tab
Press "Add External Jar"
(Most important step) Select "android-support-v4" jar file of "libs" folder from your CURRENT PROJECT LOCATION (path should be on your project folder and not the android sdk).
Select "Order and Export" tab and "TICK" the checkbox of "android-support-v4.jar"
That's it, you're done!
I had this error with android facebook integration.The reason was I had android-support-v4.jar library added to my project. Facebook sdk has already support library. So delete support library both from libs and from java build path If you are using a library already has support library in it.
in Android Studio 0.8.2
Press the green "+" in tab Dependencies of Project-Structure, then the keyboard key "1" (for libs) and choose the v4+ lib
If you have proguard enabled, try adding
# Local Broadcast Manager
-keep public class android.support.v4.content.LocalBroadcastManager
This fixed it for me.
You need to add the support library .jar file to the /libs directory in your IDE if it is Eclipse so that when the apk is made the Android packager will include that in your apk.
The problem seems to be related to the "properties" of the android-support-v4.jar library.
By default, the "Build Action" listed in the Advanced Properties in Visual Studio had a value of Content. I switched the value to AndroidJavaLibrary and the runtime error has disappeared.
However, the BroadcastReceiver isn't receiving the USB disconnect intent, hmm... Will update this answer accordingly.
Edit: I could never get a LocalBroadcastReceiver to work, so I had to use a regular one.
Just replace the android-support-v4.jar of your project that is in>libs folder with android-support-v4.jar present in FacebookSDK>libs folder
Are there any cons of build the facebook SDK library project into a JAR file(as ADT 16 does with library projects) and adding it to your project? I am not changing anything in the facebook SDK so don't need to have it added as a library project. So far it has been working fine for me and I am wondering whether this is a common practice used by developers using the facebook SDK? It speeds up the build process quite a bit because Eclipse doesn't have to resolve all of the resources in the library projects.
Yes! I just figured it out myself.
You need two jar files:
facebooksdk.jar
android-support-v4.jar
Option 1
The first can be found in the bin folder, the latter in the Android Dependencies folder. (Of the FacebookSDK project)
After adding them both as libraries to my project (Project --> properties --> Java Build Path --> Libraries) it actually worked.
Option 2
Another way is to copy paste the facebooksdk.jar and get the android-support-v4.jar via Right-click on project --> Android Tools --> Add Support Library.
Good luck =)
Kasgoku,
The code is provided as a project for easy viewing of the classes. Adding it as an included jar or just moving the source into your project also works. When I created an FB connected android app, I moved the files I needed into a package in my app.
It looks like maven has them cached.
http://search.maven.org/remotecontent?filepath=com/facebook/android/facebook-android-sdk/4.4.0/facebook-android-sdk-4.4.0-sources.jar
You can create a jar file :
Download Facebook Android SDK from github.
Extract it. (at any location).
In Eclipse create new project using create project from existing source option
Enter the project name as "com_facebook_android".
Set Location to "facebook" folder in extracted location.
Click Finish.
Select the "com_facebook_android" project in project explorer and right click
select export option.
In the export wizard select JAR file in Java folder.
Click next then browse the location for jar file and give the name as yor wish like "facebook-android.jar"
Click finish........ JAR file will be created in that location
Well guys you dont need to manually make a .jar file out of facebook-android-sdk. You can use easyfacebook.jar. It currently supports:
Oauth 2.0 authentication support
Use the access token
Pictures upload support
Supports all the features of Graph API
It can run any query FQL
Contains BEAN of all facebook objects
It's free. LGPL GNU license
Progress dialog
Logout function
Server/Request Error Management
Key hash/Geo Tagging
Login without facebook app