How can I bring Google play services into my libGDX Gradle project? - java

After adding Google Play Services to integrate Google ads into my libGDX project in Eclipse, I can no longer use Gradle to build my Android project.
I know that's because I need to tell Gradle about the new Google Play project dependency so I added compile com.google.android.gms:play-services:5.0.89 to the dependencies section of the :android project however it complains that it could not find com.android.support:support-v4:19.1.0.
I guess that means I need to somehow tell Gradle this new dependency depends on another dependency?
Everything works fine in Eclipse so the dependency of my Google Play project in Eclipse is for sure golden, I just need to make Gradle the same way. Do I need to declare the Google play project as another Gradle project and make a build.gradle file for it? I don't think I should be touching the Google Play project contents at all.

If you have downloaded the tools and google reprositories using the Android SDK Manager (1st thing to check), check if your build.gradle files do not need to be updated (what libGDX version are you currently using?).
I had the same problem and solved it by replacing my Android's module build.gradle file by a brand new.
To do so, use the last ligdx setup ui (https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle) to create a fresh project then compare/replace gradle files.

Under your android module there's a build.gradle file. Add the following:
dependencies {
compile 'com.google.android.gms:play-services:6.1.11'
}
Check for the latest version of Google Play Services and update your version number accordingly.

Related

Version gradle for different modules

I am really confused about how gradle works with android subproject and simple server-java subproject tied to Project.
Android is using not the latest version of gradle, but my server app can use it.
Should I use the minimum version that supports all modules, or can I somehow edit the build file for each module?

How to add Google vision dependencies to my .aar?

I am creating an android library (.aar) that is using the Google android vision Gradle dependencies for OCRing. But I am unable to figure out how should I can add the Gradle dependency to the .aar File.
I don't want to add Google dependency separately while using my .aar because my library project already contains the same.
I have tried one solution by pushing the .aar file to local maven then using the same in the application but in that case I was still unable to find the Google Vision classes to use.
Thanks.
#user3572586, same issue faced, when you build aar file only project source added in aar not dependency lib. so you need to add externally.
Or
You need to publish your aar in maven repository (local or remote) and including it using compile (...#aar) transitive dependencies are turned off.
For more info see link below's,
Link1
Link2

How do I incorporate a java SDK in android application development?

I am trying to learn more about DWOLLA, using their sandbox. I am mainly interested in using their access API with an android APPLICATION. The Dwolla API Docs says, "Download and build the JARs to use this library. Maven is required to manage this project's dependencies." The following are the links:
git clone https://github.com/Dwolla/dwolla-swagger-java
cd dwolla-swagger-java
mvn install package
How do I integrate the above in an android application/project. My assumption is that I would have to do it in gradle but I am not certain.
Android apps' dependencies are managed with Gradle.
The default repository is JCenter.
The Dwolla SDK is found here.
All you have to do is, on that page, click on 'gradle' and you get the line that you have to your app's build.gradle file.
Here it is compile 'com.dwolla:dwolla-java-sdk:2.0.9'.
Add that to your app module's build.gradle under dependencies, refresh the project and you should be fine.

How to add git module in Android Stdio

I already said Bye Bye to eclipse and configured Android Studio 2.1.1 in my machine and trying https://github.com/gorbin/ASNETutorial this social network integration project.
I have downloaded a file ANSE-master.jar from github and dont understand how to use it in my own project,that can have the ability to integrate with social sites.
Can anyone guide me how to use these .jar in my project.If it sounds stupid please let it go as i'm the beginner in Android studio.
Go to File>New>Import Module then look for the module source directory enter and you are done but don't forget compile project(':Volley') in build.gradle (module app) then sync the project.
Update: This won't work
First set your Project to Android in Project view window.It would look like this
Then you need to open build.gradle file (Module app)
There you should add these lines in dependencies
compile 'com.github.asne:asne-facebook:0.3.1'
compile 'com.github.asne:asne-linkedin:0.3.1'
compile 'com.github.asne:asne-twitter:0.3.1'
now click on sync now. wait for for some time gradle will build project for you. Once it done you will have all these sdk inside your project.
Hope this will help

BaseGameUtils cannot resolve symbol android in: "com.google.android.gms.games.Games"

I'm trying to make an app with G+ and Google play services.
But I can't from the beginning.
I try to import the project BaseGameUtils, and build the app (sync with Gradle) and run it.
Surprisingly it runs! and works, but when I go into the code, my imports are not found.(cannot resolve symbol)
This leads me to think that my Gradle is well configured but I am missing something (library, dependency, module) in the app, because Android Studio complains about it.
I have the latest Android Studio 0.8.9, and my SDK is updated with all the needed installs.
Can someone put a "how to" import the BaseGameUtils project/library step by step for latest Android Studio and what else is needed?
Also, my Gradle is configured so the app builds with app support v4, but as before, it cannot be resolved.
How do I add it? I already have it in Project Structure > Modules > app > Dependencies > support-v4 as library dependency.
I had the same problem. Solved it almost. It's very important to put your to the latest version (build.gradle --> compileSdkVersion 21). The same with the dependencies ( compile project(':libraries:BaseGameUtils'), compile 'com.android.support:appcompat-v7:21.0.+' compile 'com.android.support:support-v4:21.0.+' and the latest version of Google PLay Services compile 'com.google.android.gms:play-services:+'. Of course you should update your SDK files first (install API21+Tools)
I had the same problem. It's a bug when importing a project with BaseGameUtils dependency from eclipse to Android Studio. This can be solved by commenting out this import as it is no longer required:
//import com.google.android.gms.drive.internal.r;

Categories

Resources