difference between android gradle plugin and gradle - android

Android Studio 3.2 Canary 5
Build #AI-173.4630681, built on March 3, 2018
JRE: 1.8.0_152-release-1136-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.4-300.fc27.x86_64
I have just started a new project and when I sync'd I got this dialog box.
I am just wondering what is the difference between the Android Gradle Project and Gradle.
How would I upgrade to Gradle to version 4.5?
What is the purpose of both of these?
Many thanks in advance

Gradle is the build system.
You can use it with a lot of plugins. One of these is the Android Gradle plugin.
It is used to provide processes and configurable settings that are specific to building and testing Android applications.

Even if you have written the same java source code for a java project and android project, the way they are built and executed completely differs from each other.
Java project sources compiles to byte codes (.class files) and runs on JVM (java virtual machine).
Android project sources compiles to Dalvik byte codes (.dex files) and runs on DVM (Dalvik Virtual Machine). And both of these virtual machine have different ways of executing commands.
Android projects have many platform specific steps when building application that standard Java applications does not have. (like packaging as apk, automatic signing, project flavors management, minimum API level) With the addition of Android Gradle plugin these differences can be applied more easily and in a more refined way. (So building Android apps becomes easier for everyone).

The Android Studio build system is based on Gradle, and the Android plugin for Gradle adds several features that are specific to building Android apps. Although the Android plugin is typically updated in lock-step with Android Studio, the plugin (and the rest of the Gradle system) can run independent of Android Studio and be updated separately.
From the Docs
https://developer.android.com/studio/releases/gradle-plugin.html

Related

Unity crash on Android on startup: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/startup/R$string

We have a plugin for Unity to be used by games on Android. The plugin is built on macOS with gradle 7.1.1, multidex enabled, fat-aar, and grease 0.3.0
Building with Unity 2021.3.3f1 on macOS Monterey, deploying to device running Android 11.
Targeting Android SDK 32. Multidex is enabled, minify/jetifier/R8 all turned off in Unity's gradle build scripts. AndroidManifest.xml is set up properly to use multidex. I've checked spelling and class names, and since it's targeting SDK 32, we don't need to use the android.support package.
We're building a Unity project that only includes our plugin and some code that calls into it, so the project is already as barebones as it can get while still using the plugin. The Unity app was building and running just fine until we introduced fat-aar and grease. Also, Unity builds with a pretty old version of gradle, 4.6.
Our plugin also builds a test app APK, and that test app APK contains R$string.class as well as other R$* classes generated by multidex (found via dex2jar). Our plugin AAR contains R.txt that references androidx_startup.
It seems like a dependency isn't having it's string resources propagated forward to the final app, but I'm not even sure that's the problem.

Kotlin multiplatform mobile - fail to run iOS project - missing one or more architectures required by this target

I create KMM(Kotlin multiplatform mobile) project using Android studio 4.1 RC3 and try to run the iOS App (with default code) but stuck with following error:
error : The linked and embedded framework 'shared.framework' is
missing one or more architectures required by this target: arm64. (in
target 'iosApp' from project 'iosApp')
But when I just hit 'build', it get built successfully. Only happening only when hit 'run' from Android studio. Mean while I used Xcode to run the same project and face no issues getting it deployed into the simulator successfully.
By the way I was following this official KMM guide
https://kotlinlang.org/docs/mobile/create-first-app.html
Using Xcode 14 ( I tried simulators with iOS14,13.5,12.1) using Mac OS Catalina 10.15.6
This problem is most probably caused by Xcode 12 adding new simulator architectures. As a workaround, one can try adding arm64 to the Disable Architectures list in Build Settings. See the related issue here

purpose of com.android.tools.build

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.

IntelliJ 12 Android and Gradle

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).

Android runs on what JAVA SDK version

I always get confused about this, what SDK version of Java does Android run on?
For example Android 2.3 and Android 4.0. What JAVA SDK they run (1.4,1.5..etc?
Please let me know unless I am missing the concept completely
I always get confused about this, what SDK version of Java does Android run on?
Technically, it runs on no "SDK version of Java". Android devices have the Dalvik VM for executing Dalvik bytecode, not a Java VM for executing Java bytecode.
The Android development tools will cross-compile Java bytecode into Dalvik bytecode when you build your Android app. Those tools support Java bytecode from Java 1.5 or 1.6. It definitely does not support older than 1.5, and I am not certain what all happens if you try Java 7.
Currently, java 1.6 is the version used for all Android versions. Keep in mind there are some things not present, and some extras added, so really, it's more like its own branch.

Categories

Resources