Gradle new version and Build version - android

I have updated SDK and I am using Android studio 2.0(preview). So I think all things are enough updated. For me and for my newly created projects all things work fine. But When Ever I download the code from github I always gets error of gradle versions.
So It is kind of annoying. Well I admire a lot of things are already fixed by gradle while importing that github project . But once the gradle version error occur its some times gets hard to know the exact reason. And honestly I know things about gradle quite enough , but I always get it solved by hit and trial method. So I have many confusions which I am posting below as a questions
How to know what is new gradle version is going on.
How to know which things are now forbidden in the new version of gradle
How to know which support dependencies will work with new gradle version
How to know which version of build tools will perfectly match to gradle.
I think there are many stupid things in these question and I google these questions, but end up with deciding to ask you guys as you guys can clear me formally and casually.
please answer my question if you know this thing deeply.

Android Gradle Build systems are software tools designed to automate
the process of program compilation .
How to know what is new gradle version is going on.
The Android build system uses the Android Plugin for Gradle to support
building Android applications with the Gradle build toolkit. The
plugin runs independent of Android Studio so the plugin and the Gradle
build system can be updated independently of Android Studio.
You can Mouse Hover On classpath for checking latest Version .
How to know which things are now forbidden in the new version of gradle
You should check Android Plugin for Gradle Release Notes
For classpath 'com.android.tools.build:gradle:1.3.1'
Fixed the ZipAlign task to properly consume the output of the
previous task when using a customized filename.
Fixed Renderscript packaging with the NDK.
Maintained support for the createDebugCoverageReport build task.
Fixed support for customized use of the archiveBaseName property in
the build.gradle build> file.
Fixed the Invalid ResourceType lint warning caused by parameter
method annotation lookup when running lint outside of Android
Studio.
Now For your 3rd and 4th questions you should check manual testing .

Related

How do I solve the problem of Build gradle?

I have just installed the filter but I am not able to run it
Every time I try to run it, I run into this problem
I tried to find the answer on the internet but could not find the answer
Some people said make changes to the gradle-wrapper.properties file
But he still did not answer
That project is very old and cannot be opened using newer Android Studio versions because Gradle 4 is obsoleted.
Please use Studio 3.x.
Or try to upgrade to Gradle 7+ by editing "build.gradle", but it could require other changes in gradle files and/or included libraries.

Data binding with errror dataBindingArtifactOutputDir

I have a weird problem when building my app.
Cannot write to file
'myapp/app/build/intermediates/data-binding/dev/debug/bundle-bin'
specified for property 'dataBindingArtifactOutputDir' as it is a
directory.
It 's weird because when I clean project, I can build app. But when building app the second time, the above error happens. If I want to build app, must clean app.
I also set
dataBinding {
enabled true
}
Thanks for any support!
I really found the problems. I took me 1 day. I updated the gradle plugin and Android Studio to the newest version. And this is the reason why.
The newest gradle build tool is 3.4.1, it use the gradle version 5.1.1. When I downgrade the gradle build tool to 3.1.4 as my old project, and clean build app again error still happens. I think this way did not work but this is problem of Android Studio, it did not change the gradle version in gradle/wrapper/gradle-wrapper.properties. I manually update to old gradle version
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
It works now luckily. Everytime Android Studio updates, the weird problems happens again. Expect everything will work well in the future. :|

"Minimum supported Gradle version is 4.4" error started today; no code changes

Today, multiple developers on my team started seeing this error when they attempt to run any Gradle task.
* Where:
Build file 'C:\dev\src\my_app_name\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Minimum supported Gradle version is 4.4. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in C:\dev\src\my_app_name\gradle\wrapper\gradle-wrapper.properties to gradle-4.4-all.zip
Absolutely no code or config changes were made; Gradle builds just suddenly started to fail. Anyone know why this would happen? My best guess is that a plugin with a dependency on a specific version of Gradle auto-updated itself, but I'm not sure how to figure out which one it is. The line number would suggest that it was the com.application.plugin plugin itself.
I am aware that Android Studio updates often require a corresponding upgrade to Gradle, but nobody on my team updated Android Studio. And, according to the Android-Studio-Gradle version compatibility table, Gradle 4.1 should still work fine with Android Studio 3.0.1, which is what I have been running for some time.
We recently started using Kotlin, and I thought that might be part of the problem, but completely removing everything related to Kotlin didn't help.
I have tried deleting the Gradle caches/ directory, running ./gradlew cleanBuildCache, deleting our project's build/ directories, killing Gradle daemons via ./gradlew --stop, and rebooting -- all to no avail.
I also tried upgrading to Gradle 4.4, but that resulted in a "CIRCULAR REFERENCE" NullPointerException error during DexMergerTransform (separate issue), for reasons that are entirely unclear to me. I'd like to be able to force my environment to NOT take on a Gradle 4.4 dependency right now... but I don't know what suddenly triggered this dependency.
The problem turned out to be that we were using a non-specific version of a plugin. When a change was made to the plugin, the new version was downloaded to our dev environments, and it introduced a dependency on a version of Gradle higher than the one we were using.
In our case, this was the culprit:
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
Downgrading to version 8.5.1 of the Butterknife plugin eliminated the dependency on Gradle 4.4.
You also have the option of linking to a specific pre-release "nightly" version. However, this is less than ideal, since these bits don't remain available for long, and you might want to download a build and keep it in your local lib. For example:
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-20180727.012508-40'
instead of down-grading, one could provide the plugin in version 9.0.0 with the expect version of Gradle, by editing the file gradle/wrapper/gradle-wrapper.properties; for example:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip
version 4.5 works stable and might not create the circular reference, alike 4.4 does. and when looking at the issues tracker on GitHub, this Gradle plugin might add more problems, than it would serve any real purpose - because the Android SDK already supports two-way data-binding.
currently the artifacts still list 8.8.1 as the latest version; while a SNAPSHOT is barely stable... that nothing happend there since over a year, hints for that this project might have been abandoned... most likely because of Architecture Components data-binding.

What's the proper way to upgrade gradle in Android Studio?

Most resources online say that you update gradle by simply updating the distribution URL. This is the answer all over Stack Overflow and all over.
Codepath also just says that a url update is enough: https://guides.codepath.com/android/Getting-Started-with-Gradle#upgrading-gradle
I've seen scattered throughout a couple of answers that to upgrade gradle you need to run a gradle update script from the command line ./gradlew wrapper --gradle-version x.x.x.
I haven't been able to find documentation that says "This is how you update gradle". On gradles website you can see, "This is how you add the gradle wrapper". I guess I'm not sure what is enough, and I feel like a lot of people are doing it the wrong way, and maybe are not benefiting from performance and speed increases in gradle.
Any canonical answer on this? Someone from the tools team want to comment?
If your project is using the Gradle wrapper then Android Studio will automatically use it. The correct way to upgrade Gradle (via the wrapper) is to run
$ ./gradlew wrapper --gradle-version x.x.x --distribution-type all
The --distribution-type option is supported since Gradle 3.1 and allows to use the all distribution instead of the default bin distribution to get proper IDE support for Gradle build files.
If you are unsure what the latest version x.x.x is, or you are setting up a project from scratch, you might be interested in my gradle_bootstrap.sh helper script which is able to install / update the Gradle wrapper without having Gradle installed. Use it like:
$ gradle_bootstrap.sh all
Just updating the Gradle distribution URL in gradle-wrapper.properties as described in the official docs is not enough in cases where gradle-wrapper.jar itself got updated.
Finally, if you do not use the wrapper yet, Android Studio will prompt to "Click 'OK' to use the Gradle wrapper, or 'Cancel' to manually set the path of a local Gradle distribution", where the latter can point to the Gradle version that ships as part of its installation. At the example of Android Studio 2.2.3 that would be Gradle 2.14.1, which is a bit dated.

Android Studio - Plugin Too Old (Gradle)

Quite new to Android Dev, and I've been getting a strange error recently. I've searched online, and nothing seems to do the trick, so while I understand that this might be a duplicate question, no other previously asked question was able to offer me a working solution.
When I make a new project in Android Studio (version 2.2 Preview 1), I get bombarded with the error:
Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "84c9986024dd3d7a4767dc5c38710ff1b96f1a21"
With two options: "Fix plugin version and sync project" which seems to do nothing. Upon clicking. And "Open File" which just opens the "build.gradle" file.
In my settings, I have Android Studio set to use the default gradle wrapper. I even set the distributionurl to the newest gradle version, but apparently even that is "too old"...
I have no idea what's causing this problem.
Another peculiar thing I've noticed is that in the project panel, it seems that my project doesnt look as it should.
The project in question looks like this:
Whereas, I understand that it should look more like this:
Again, no idea what's going on... I'm pretty new to Android Studio, but I'll do my best to answer any questions you may have.
While I believe the message may be because you have a 2.2 Preview build of Android Studio, it may want you to use a beta build of the Android Gradle Plugin.
Note: This is not related to the version of Gradle. The latest supported version of Gradle is 2.14.1, which you can check the Android Studio Release Notes, and also here.
From that first link, what I find most people don't understand.
The plugin runs independent of Android Studio so the plugin and the Gradle build system can be updated independently of Android Studio
Or Configuring your build, which explains why they are separated.
you can build your Android apps from within Android Studio, the command line on your machine, or on machines where Android Studio is not installed (such as continuous integration servers). If you are not using Android Studio, you can learn how to build and run your app from the command line. The output of the build is the same whether you are building a project from the command line, on a remote machine, or using Android Studio.

Categories

Resources