I am a newbie to Android programming. I am using Android Studio 1.1.0
I have following query regarding building an app using gradle.
What is the purpose of specifying buildscript dependencies 'com.android.tools.build:gradle:1.1.0' in build.gradle
What does this build statement actually do.
I have searched the forum but could not find anything specific on this.
However from some of the google search it seems to suggest that this statement might be required for the gradle script to download Android Plugin for gradle.
I find it surprising that though I am using Android Studio I still need to download Android Plugin for gradle. Should it not be coming in-built.
Appreciate your time and help
As the name suggest, "Android Build Tools" is a command line tools for building your Java source code (along with all the related assets) into executable APK file. It's located at your Android SDK directory (usually at $ANDROID_HOME) and can be updated using Android SDK manager (accessible via Android Studio IDE).
What is the purpose of specifying buildscript dependencies com.android.tools.build:gradle:1.1.0 in build.gradle
Android is using Gradle build system. That build script dependency is Gradle plugin to interact (compile, test, etc) with the Android Build Tools. That line declares that your project require Android's Gradle plugin version 1.1.0.
I find it surprising that though I am using Android Studio I still need to download Android Plugin for gradle. Should it not be coming in-built.
Android Studio (AS) is just an IDE, you can actually use any IDE that support Gradle build system. Android Build Tools and its Gradle plugin (it's not AS plugin) is constantly updated by the devs separated from Android Studio project (although it's pretty closely related). Moreover, different projects can requires different version of build tools and its Gradle plugins. So it's just make sense that Android Studio requires them to be downloaded independently from the IDE.
Related
I am basically a .NET Developer but from the last few days, I was working with Ionic. I was able to build and generate APK files from my system where I had installed Android tools from Visual Studio & other dependencies. Below is a list of dependencies that I had installed on my system.
- Java (JDK8)
- Gradle
- Android SDK & Emulator
By using these dependencies, I was able to build my Ionic App and generate APK files.
My Question is that - Now I am moving my code to a new system. What are the minimum dependencies I need to install so that I can keep the show running as before? I know, below dependencies are required.
- Java (JDK8)
- Gradle
Now confusion comes when I think about Android dependencies.
Q1. Installing the Android SDK will be enough for building an app and generating APK files?
Q2. If Android SDK is the only requirement left then from where can I
download it for the latest API Level & what is the size of Android SDK? How much space it would take on my hard disc?
Q3. Will I be required to install other dependencies from SDK Manager after installing the SDK to build the app?
My sole objective is to know the minimum dependencies and their setup to build the Ionic Android App & it's APK generation.
You need Java, Gradle, Android SDK to generate an apk(Android) in Ionic.
So in your case just install the android SDK.
Do not forget to add the path variables for Gradle, Java.
I know that Android Studio is now the official IDE for developing Android apps, but my computer is really slow and I find it difficult to use Android Studio on it.
I'm using Netbeans for Android apps development and fortunately it works fine.
The problem I am having now is using the Android support libraries in netbeans. I found out that Android now uses the Gradle system for apps development in which the dependencies are declared, but the apps that that Netbeans creates don't have a Gradle file and I won't be able to add the dependencies.
My question is:
How do I create Gradle files in Netbeans?
Or how can I add the support libraries directly into my Netbeans projects without the need for Gradle?
I have downloaded the support libraries and I have also installed Gradle on my computer.
When I attempt to open the Android SDK samples for v19, for example connectivity/BasicNetworking, I get the following error in Android Studio:
The project is using an unsupported version of the Android Gradle plug-in (0.12.2).
The recommended version is 1.1.0
Not only can I not build the project - I can't even open it and browse the source code.
I understand I can alter build.gradle to use v1.1.0 of the plugin but I don't feel that should be my job. Google is providing both the samples and the IDE. Why can't I open their samples in their IDE?
Is there any setting in Android Studio I can set so that it automatially sets the latest gradle plugin version in the build.gradle file when opening old projects?
The "Import an Android code sample" on the Android Studio startup screen, or "File > Import sample" actually takes care of this (although a side effect is that it copies the project to a new folder).
I am trying to open a Android Project in Android Studio 1.0.2 which uses
classpath 'com.android.tools.build:gradle:0.12.+'
as its dependency. On opening the project with above dependency I get the following error message.
The project is using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 1.0.0.
Is there a way to run such projects in Android Studio 1.0.+ without upgrading the Gradle plug-in version
Note:
I can upgrade the gradle version and plugin to get it to work OR simply use older version of Android Studio to open the project.
First approach is not desirable since this being a community project I will prefer to leave majority of files unchanged and changing gradle version will also hinder me from testing the build with 0.12.
To successfully build Android project using Android Studion and Gradle you need to use the AS, Gradle and Android Gradle Plugin with versions which are compatible with each other. Check out this page, it's said here, that you can use Android Gradle Plugin 0.12 with Android Studio 0.8.0 - 0.8.11 and there is no way to use it under Android Studio 1.0.
I suggest you convince other people to switch to the newest version of Android Gradle Plugin because 1.0.0 is the stable one and doesn't contain some bugs which were out there in the 0.12.+.
Is it possible to use IntelliJ 12 (12.1.6 Ultimate) and Gradle to build Android projects? I can't find any information on doing so outside of Android Studio.
I can get my APK to build just fine, but IntelliJ doesn't seem to pick up the dependencies downloaded by Gradle. I know they're downloaded as I can see them in my cache folder.
Switching from the android plugin to the java plugin works just fine.
I don't think it's possible, as Android Studio is based on IntelliJ 13 (EAP).