📜 ⬆️ ⬇️

Are you afraid of gradle as I fear it?

I will say right away - in Gradle, I'm completely new.
Half a working day, instead of writing the code containing my family, I spent to find out which of the 150 lines of the config, I had to fix one by changing the classpath 'com.jakewharton.sdkmanager:gradle-plugin:+ to com.jakewharton.sdkmanager:gradle-plugin:0.10.1 .
The program started yesterday and today stopped. And you know what I did wrong today? And nothing. Absolutely the same code and the same configs. I have not changed a single file.
A smart or experienced programmer has already guessed that the "+" sign means that you need to download the latest version of the library and something is loaded wrong. Yes, this is part of the problem, but not all. The library itself did not spoil anything. She just had a dependency on the other - which was spoiling.
And in general, what kind of mod upload untested libraries to a common repository? When Maven was not like this!

And if you're interested, I will describe how it looked.
Stopped from IDE to run the application on Android. To understand that the IDE is not guilty, but Graddle, which builds the application, took time. By the way, everything was compiled perfectly. Until the end. But it did not start.
I looked for a mistake, on the Internet, that the plugin has android.tools.build in the latest version of the bug. It is only necessary to return the old, 11th and everything will work. I look into the configs and see that the 11th is already standing. In general, I was perverted for a long time, until I realized that despite the fact that the 11th is spelled out, the latter is still used.
In Gradle, I did not find how to see the dependencies of the plug-ins (and there is such an opportunity in Maven). But by commenting the lines and restarting the build, again and again I found the plugin, which in the new version uses the new version of the ill-fated android.tools.build.

Why did this happen at all?
This situation occurred because of my inexperience. When I started the project, not being a Gradle expert, I just copied the config laid out on the git hub. Yes. I know that copy-and-paste is evil, but a newcomer must start somewhere. I admit that the fault lies entirely with me, but it would be nice if new users were somehow protected from such problems.

In order to be not just a crybaby, but an erudite blubber, I will try to make my suggestions to nothing:
Well, if the config of the plug-in is directly specified in the config, then you can somehow inform the user that another one will be used.
Yes, it would be nice to enter a command showing the tree dependencies of plug-ins.
No need to upload poorly tested plugins to the public.
The ability to put a "+" must be prohibited. At least at the top level. That is, "10. +" is still possible, but just "+" - ATATA!
')
Here is a fascinating adventure for 5 hours in the world of Gradle I had today.
In general, newbies Gradle, do not step on my rake, and old-timers scold me for my incompetence.

Source: https://habr.com/ru/post/230249/


All Articles