Version gradle for different modules - java

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?

Related

Play framework and gradle

I would like to build the play framework with Gradle in a multiproject build.
The play application would be one of my gradle subprojects. The controllers in play, will call methods in my other gradle projects.
Gradle uses sbt by default. Should I just use sbt command line calls in the gradle build file? And if I do that, would I be able to package it as an application (e.g. a jar file)?
Native support for play is currently in the works for Gradle. This is still in development, but you can take a look at some sample projects in the samples/play directory of the 'all' distribution of Gradle 2.3.

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

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.

Checking a JAR for android compatibility in maven

Some of our jar libraries should run on android, as well as normal JDKs. The jar is build by maven. Specifically I want to know:
Is it possible to build against another runtime library or to check the API compatibility?
Is there some maven plugin that runs the JUnit tests on an android platform?
What other verification steps should be taken to ensure that your library project will run on android?

What are the options of joining the external library in Android using Gradle?

For example: there is a project on GitHub https://github.com/chrisbanes/ActionBar-PullToRefresh, it uses Gradle, so you can add to a project using:
compile 'com.github.chrisbanes.actionbarpulltorefresh: library: +'
And there is a project https://github.com/ahorn/android-rss, where Gradle is not used.
What are the ways to connect using Gradle this library to my project?
This need not to store external libraries in my git repository.
If you have a project that is not a simple Java project and is not made for gradle Im afraid you have to download the source convert an eclipse adt project manually/automatically to gradle:
You cann import it as a module through Android Studio (New-> Module -> Import Existing Project) see http://developer.android.com/sdk/installing/migrate.html
You could also just write the build files yourself teaching you a little gradle on the way, just look at the examples and docs how to do it
This project doesn't use gradle but uses maven so dependency to this project can also be handled. You just need to find repository with public access where this project is deployed and add appropriate address in repositories section in build.gradle file. If there's no such repository You can download the project and install it in the local repository - the downside is that no other developer that works with your project can download this dependency until You make Your repo public.
Furthermore the fact that some project doesn't use gradle or maven doesn't mean that dependency to this project can't be handled with gradle. If this project has fixed versioning scheme and is accessible over the net gradle can be configured to use such dependency. Gradle can deal with multiple types of repositories (e.g. flat files).

Can't run imported gradle android project in Eclipse

First, im new in gradle so please bear with me.
I successfully build and imported this project with gradle & eclipse on ubuntu 13.10. This is what i did :
run gradle build in terminal (success)
add apply plugin: 'eclipse' in the build.gradle
run gradle eclipse in terminal (success)
import it as existing project on eclipse
The problem is, when i tried to run the project, eclipse read it as "normal" java program, not the android one. This is the SS :
The main project in my workspace is not in eclipse format.
And this is its properties :
Notice there's no android tab in it's properties. And i cant run it as android application.
Am i missing something? Please kindly help me.
Thanks for your help.
Usually to develop Android in Eclipse you need to install ADT into Eclipse or start with ADT-Bundle (Android IDE) from Google. (You have not as Preferences missing Android group)
However ADT does not have gradle support. And Android Studio is still not even yet beta (preview or alpha, bleeding edge, need to update with almost every build).
There is Nodeclipse/Enide Gradle for Eclipse
(marketplace), that lets launch gradle build even on general project.
For the latest build.gradle template for classic Android project check
gh.c/N/n-1/b/m/o.n.e.e.g/docs/android/build.gradle.
This lets create new Android project in Eclipse with ADT and use ADT tools for most of things,
but additionally have newer build with gradle
and execute defined gradle tasks
But for Android project with several modules (as in this case) you would need to DIY do it yourself:
try to configure Eclipse .classpath to correct values, as gradle eclipse task won't yet do it all for you.
Eclipse plugin in Gradle that you have used does not support Android projects - they are significantly different from regular Java projects. Some things can work but there will be a lot of things missing including Android nature for generated projects.
And the ADT plugin provided by Google does not support Gradle projects yet as the team focuses on Android Studio first. http://tools.android.com/tech-docs/new-build-system can give you some ideas about the current state.

Categories

Resources