Why does gradle have 1:1 mapping with android studio versions - android-studio

Recently I upgraded Android Studio 3.0 Beta 7 to Android Studio 3.0 RC 1. The dependancies in build.gradle also got changed from classpath 'com.android.tools.build:gradle:3.0.0-beta7' to classpath 'com.android.tools.build:gradle:3.0.0-rc1'
Gradle is a build tool managed by entirely separate organization, separate community. Then how come gradle make their releases with android studio?

In fact, gradle does not have 1:1 mapping with android studio versions. There is no relationship between gradle and android studio versions.
com.android.tools.build:gradle is a gradle plugin for Android developed by Google team.From here, you can see the plugin requires gradle version.For example, if the plugin version is 2.3.0+, you should use gradle whose version is 3.3+.In addition, you can check gradle version in rootProject/gradle/wrapper/gradle-wrapper.properties
In your case, you can also downgrade 'com.android.tools.build:gradle:3.0.0-beta7' to 'com.android.tools.build:gradle:3.0.0-rc1' and it can works. However different plugin version, different performance.

Related

Upgrading Android Studio

So, its been awhile since I worked in Android studio, but decided to work an a old project.
I installed the latest version of Android Studio, copied the project from my old computer and imported it into Android Studio. When I tried to run it, I ran into a never ending sequence of problems, like SDK version, gradle plugin, kotlin version etc. being incompatible with this new version of Android Studio. So, my question is, is there a procedure to import an old project into a newer version of Android Studio to circumvent all this, or is one just stuck starting from scratch?

How to configure an iOS Application for Kotlin Multiplatform in Android Studio?

I want to add a Run/Debug Configuration for an iOS Application for a Kotlin Multiplatform Mobile application in Android Studio 4.1.2. However, there seems to be a problem with the configuration for iOS.
In the screenshot below you can see the problem. In the dialog "Run/Debug Configuration" Android Studio complains about
Error: Please specify Xcode project location in xcodeproj property of gradle.properties
Using the "Fix" button does not solve the problem. Android Studio just adds an additional xcodeproj to gradle.properties and the complains about a duplicate parameter.
I also tried different paths (relative and absolute) for xcodeproj. No luck.
If I remember correctly, it used to work out of the box. A new Kotlin Multiplatform Mobile project was automatically configured for Android and iOS. I'm not sure what changed. Probably something was updated.
Is this a bug with the KMM plugin? Or is there something I can do on my system to fix this?
don't do that with Android Studio.
Just open Xcode, click on 'open another project...', locate to the iosApp folder that named it when creating your project on Android Studio.
after that, just click run and have fun.
If the project doesn't run right away even on opening it from Xcode and shows the shared framework is missing, Then try generating the shared framework for iOS platform using terminal. Navigate to the project folder and execute
Command: ./gradlew packForXcode
Now the shared framework should have a xcode-frameworks product and you should be able to build and run the project through Xcode.
I fixed it by downgrading the Kotlin version from 1.4.30 to 1.4.21. You can check this thread here. To downgrade, download the version you want from the plugin store and choose the install plugin from disk as in the picture below
Upgrading Android Studio version to 4.2.1, KMM plugin version to 0.2.6, creating new KMM project with KMM plugin, the problem can be fixed automatically.
If you don't wanna use Xcode:
Look like there is some IDE issues in this versions, one option would be to downgrade the Kotlin version.
What worked for me was to download the latest Canary Android Studio and setup my KMM project there.
Hopefully soon this will be stable for the next versions
Same as here: https://stackoverflow.com/a/66941077/3117650
Look like there is some IDE issues in this versions, one option would be to downgrade the Kotlin version.
What worked for me was to download the latest Canary Android Studio and setup my KMM project there.
Hopefully soon this will be stable for the next versions

How to get Android Studio to automatically update the Android Gradle Plugin & Gradle to the current version

Question:
Is there any way to have Android Studio automatically update Gradle Plugin & Gradle to the latest versions && then immediately sync the project with the gradle files?
Background:
I've been working with native Android for over 18 months, and I frequently reference old projects. When I open older projects in the IDE, Android Studio frequently gives me an Alert "To take advantage of all the latest features...we strongly recommend that you update the Android Gradle plugin to version x.x.x and Gradle to version x.x" (see screenshot below).
Once I click Update, I must sync the project with Gradle Files (which takes forever for me). I open 15 - 20 old projects on an average day, and the message gets tedious.

Gradle output is missing in Android Studio 2.2 (latest version)

I updated my Android Studio to latest version 2.2. Then i can't able to see any gradle task output logs.
Below picture is i'm trying to get SHA-1 finger print key from gradle task singingReport .
Note : Previous Android Studio 2.1 is working fine.
Is this Android studio related issue ? Has anyone got similar problem like this ?
I found out there has some changes on gradle version 2.14 (Android studio release note).
Improves build performance by adopting a new default packaging
pipeline which handles zipping, signing, and zipaligning in one task.
You can revert to using the older packaging tools by adding
android.useOldPackaging=true to your gradle.properties file.
Here is complete detail LINK
So now i can able to get the output data by enabling old packing style android.useOldPackaging=true in gradle.properties.

Android Studio 1.3 Preview NDK support

Yesterday Google announced that native code debugging is now possible with this version of Android Studio.
https://plus.google.com/+AndroidDevelopers/posts/2Gk6yrZKV4X
I've updated to the newest build version "AI-141.1962279" and can't see any possibility of debugging native code.
I've switched to build-tools 23.0-rc1, used gradle plugin 1.3.0-beta1 but cannot set breakpoints in native code or step into JNI calls.
Is it really working?
July 10th update Android Studio Preview with NDK support is available : https://sites.google.com/a/android.com/tools/tech-docs/android-ndk-preview
Android Studio 1.3.0-Preview is indeed available through the Android Studio "Check for updates" menu.
Unfortunately, all C++ features aren't available yet in this preview. They will be available in about 2 weeks.
Source : Google IO dev tools keynote at 35:38
Android Studio 1.3 Beta Available
posted Jun 19, 2015, 11:37 AM by Tor Norbye
Android Studio 1.3 Beta is now available in the beta channel! Sorry, this build does not yet contain the C/C++ support; we are still ironing out a couple of critical issues, but we hope to be ready in the next week or two. Similarly, the vector rasterization support is also still not enabled due to various bugs.
UPDATE:
the 9th of July update contains c++ debug
http://tools.android.com/recent
Even on the Canary Channel, the latest currenlty available build is 1.2.1.1. We will simply have to wait a bit longer for 1.3. The "About Box" in Android Studio also displays the version number; check that to be sure.
"As announced at Google I/O, Android Studio 1.3 will include C/C++ support as well, but that is not included in the first couple of preview builds."
Source:
https://sites.google.com/a/android.com/tools/recent/androidstudio13preview1available
FYI:
NDK support is included from Android Studio 1.3 RC1 on. This includes editing running and debugging C and C++ code. See Android NDK Preview and experimental Gradle plugin guide.
with Android Studio 1.4 release you could debug native JNI code. Your project need to use gradle plugin com.android.model.application though.
After you create a project with JNI code in it, this Android Studio version will create a debug Configuration (mine is called app-native)
once you select this configuration, you could set breakpoint in JNI code
then run your app with android studio [it will download and start app on device]
When JNI code is launched, Android Studio will break right away. You could set more breakpoint at this moment too
Then let debugger "go" [to continue ]
Your breakpoints will get hit
The gradle model plugin examples could be found from googlesamples/android-ndk on github. There is a youtube clip called HelloJniWithAndroidStudio shows how to create a hello-jni with android studio 1.3, most steps still work for 1.4 -- it might help for build.gradle creation.
Different version of gradle mode plugin requires different gradle version:
Gradle-Model-Plugin-version 0.2.0 works with Gradle Version 2.5
Gradle-Model-Plugin-version 0.3.0-alpha3 works with Gradle version 2.6
you could find out what versions are available from the jcenter links mentioned earlier.

Resources