I have a QtApp on android which builds using ant. This is working fine.
BUT ----> To regularly update my app on google Playstore I need to increment the version number of the app. I found that gradle has a nice way to increment the version number. But I see that gradle pulls in a lot of other complexities. I want to keep this simple with ant as it is working.
Isn`t there a simple way to increment the version number using ant without indulging gradle ?
Should I really consider switching from ant to gradle ? Are there many strong reasons of using gradle on android ?
You can set versionCode & versionName in manifest directly. By
the way gradle does same thing, it just merges your manifest with
generation of additional fields according to build.gradle file
You should definetely use gradle, it has a lot of features in comparison with ant. Android Studio supports gradle fully, it is more customizable, more flexible, than ant. You could easily transfer project across your team, but with ant this could lead to a lot of headache with dependencies conflicts. So loading dependencies on a fly it's a gradle feature and it helps a lot. I haven't written more, because you can check all gradle features yourself. I've just given you a council
Related
I want to automatically increase the version and build number in my kotlin projects. For my iOS applications, fastlane solves my problem with the plugin it offers. but I don't know how to do this in my android projects. maybe there is a gradle plugin? can you help me
I like ReactiveCircus/app-versioning. It reads Git tags to set Android's versionCode and versionName. The default behavior works great and you may create custom rules if needed.
I want to remove gradle completely from my app, and start using Maven. I know that Gradle is the official and default way, but due to some restrictions, I need Maven. I have investigated but did not come up with a solution. Is is possible? How?
In case that it is possible, how can you set the different parameters? e.g. multiDexEnable, compileSdkVersion, buildTypes...
You can use the Android Maven Plugin
The Android Maven Plugin is used to build applications for the Android operating system as well as build libraries to be used in these efforts in AAR and the legacy APKLIB format using Apache Maven.
It seems quite updated and there's also a GitHub page. Beside, some examples will help you setup your project.
Given the recent updates I'm a little lost on what I should be using now.
I have been using gradle-experimental successfully but it still misses some of the build options default gradle has.
The gradle-experimental documentation has not been updated so it gives the impression that it is still necessary for ndk projects, but given how google do documentation it could just be out of date.
Any light cast on this would be very welcome and let me rest easy.
Thanks
My ultimate goal is to be able to write Clojure apps for Android, using Android Studio and Cursive. I started with leiningen but found out that it is a build system that is independent of what Andoid Studio uses ie Gradle. So I tried leiningen with Intellij, but couldn't get Android deploys to work except from the command line. Since I wanted to integrate with Android Studio, I decided to try Graclj: https://github.com/graclj/graclj which is a Gradle plugin for Clojure.
I can get the Graclj tutorial running in Android Studio, as per this guide:
https://github.com/graclj/learning-graclj/tree/learning-0.1.0
However:
Graclj expects the Clojure src and built classes and jars to be in the root project
Android Studio expects src and classes to be in the app subproject
After the tutorial I end up with separate Gradle build tasks for Graclj and Android Studio but I don't know how to integrate them
So, can anyone suggest a way that I can hook into Andoid Studio's build process?
Do I need to change some settings to the Graclj plugin to do this? If so, how?
Do I need to change some Android Studio plugin settings?
Do I need to add/change something in the Gradle build scripts?
Am I heading down a dead end? ;-)
I have looked at the Android Studio build process: http://developer.android.com/tools/building/configuring-gradle.html
but I don't know enough about Gradle to know what I'm supposed to be doing here.
If I need to supply any more info, just ask.
Any help appreciated!
Unfortuantely, I don't have any Android (let alone Android Studio) experience. However, I'll do my best to answer based on Gradle/Graclj knowledge.
Graclj does not require you to use the root project. You can apply the plugin(s) in any of the projects that you have in your build. However, I don't know how well a model-based plugin like Graclj will work with the "traditional" Android plugin. You could try the "experimental" one that's using the model approach, though there's a decent chance that it won't be compatible unless there's one that works with Gradle 2.12.
Alternatively, you might be able to add a dependency to the Android app project on the JAR produced by Graclj (which you may still want to put in a project besides the root). Not sure if there's a very good way to do this (haven't tried myself).
dependencies {
// my-other-proj being whichever one you use Graclj in
compile project(':my-other-proj')
}
Or maybe you would need to add it to a configuration first in the my-other-proj to interop with traditional plugins:
artifacts {
archives createMainJar
}
It is possible that you're at a dead end (for now). Graclj is very new, so this stuff should all be possible eventually.
I'm not too familiar with the Android build process, so I'm sorry if this comes off as a really stupid question.
Anyway, I'm writing testing code utilizing ActivityInstrumentationTestCase2 and Robotium for an Android application by the company I work for.
The company is rather large, so the transition to Gradle is going very slow. I would like to use Gradle for my testing project for ease and future maintainability, but right now the application I'm testing is built using a combination of ANT scripts and manual intervention with all dependencies checked in as jars in the repository. I'm not at all involved in that process, but I know it's pretty hacked together.
From what I understand, Gradle cannot simply depend on and trigger the building of another existing Android project unless that project also utilizes Gradle. So unless I want to really get my hands dirty with the build process of our application (we have people who are literally hired to only deal with that), I'm out of luck.
What I do have access to, however, are debug builds of our application.
So my question is, is there some way that I can have Gradle use the compiled debug APK as a local file dependency, or can APKs not work like that?
APKs don't work like that; you can't depend on them, for a variety of reasons. The most important reason is that the code and resources are processed and compressed and much of the original information needed to build them is lost at that point.
You'll have a tough time getting it to work properly. If things that you depend on are pure Java libraries, then if you could get them in JAR format you could depend on them from a Gradle project pretty easily. But if they're Android projects containing resources and manifest entries and such, then there isn't a compiled file format you could obtain those libraries in that would be compatible with Gradle. Gradle supports the AAR format for Android libraries, but that format is generated by Gradle and nothing else.