RegisterResGeneratingTask is deprecated, use registerGeneratedFolders (FileCollection)

Using the new Android studio with the new Gradle 3.0.0 connection.
During construction, a warning appeared:

registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) 
+133
android android-studio kotlin gradle
Oct 27 '17 at 23:34 on
source share
7 answers

From what I can tell, plugins added as classpath dependencies will cause problems. Those. Firebase had a problem with this. Spoon and flutter . Doing this on Google reveals many GitHub repositories with a problem raised due to the same thing, and all they have in common is that it is a Gradle plugin. The fabric also seems to be the cause, as mentioned by Mate *

From what I can tell, the problem comes from / several Gradle plugins. It may also be called by your Gradle code, but it most likely does not apply if your project is an application and not a Gradle plugin.

And, as Alex Cohn mentioned in his commentary, conviction is a warning. In this case, this means that this function will be deleted in the end. So for now, assuming it's a plugin (not made by you), you can ignore it. By the time it is removed, most / all of the main plugins should be updated to fix this.

And, again, this is a warning; not a mistake. You can still run it and ignore it if you can do nothing about this problem. For example, disabling the Fabric * plugin is unnecessary, as it still works.

I myself donโ€™t use Fabric, and Fabric is not open source, so I donโ€™t know if the developers fixed it or not

TL; DR: Gradle plugins are the reason. This is a warning (not an error), so removing plugins causing the problem is redundant. If you cannot fix it, leave it alone until it is only outdated at the moment (not deleted)




If you use Firebase, there is a specific solution that is also mentioned in the migration guide (the link is given later in this post); exclude guava module

 classpath ('com.google.firebase:firebase-plugins:1.1.0') { exclude group: 'com.google.guava', module: 'guava-jdk5' } 



The problem itself is quite difficult to detect. From what I can say, there is not a single problem that would cause it in all the plugins I tested (and referenced in this answer). If you wrote something that causes the problem (and it can be fixed; adding a third-party gradle plug-in does not cause this), there are some things you can try to fix.

Based on what I can say about the actual reason, it was resolved by updating the Gradle file (although this was fixed in the Spoon library by changing the line associated with TestVariant ), following the topics in the migration guide for the Gradle 3.0.0 plugin.

All of this is covered in developer docs , but here are some of the things that I find relevant that are based on extraction requests made on projects where this was a problem:

In addition to updating the version and the Gradle plugin, you also need to add google() repositories to the repositories .

compile now implementation or api , but implementation is recommended.

provided compileOnly and apk is runtimeOnly

androidTestCompile became androidTestImplementation , and testCompile testImplementation

If you use fragrances, you should use the sizes of fragrances (specified in the documentation).

For assembly types, you should enable fallback options in case there is a library that does not have this assembly type. They are defined in the profile block under the android block.

If not already done, the Gradle plugin should be defined first. Unless you have other class path dependencies, this is not a problem. But if you do, make sure the gradle plugin is defined first.

If you are using testVariants , make sure you do not call testedVariant in the class. This seems to be the reason for the Spoon library.

These things, as far as I can tell, are some of the changes that were made to fix the problem.

+36
Jan 17 '18 at 20:21
source share

I am using the Gradle Play Services plugin com.google.gms:google-services with version 4.2.0 .

In the source code, we see that: enter image description here

So for me, this was the reason for my warnings and cannot be deleted until the plugin is fixed. Question here

As @Zoe already mentioned, this can come from other Gradle plugins.

Best

+16
Dec 11 '18 at 22:20
source share

Upgrading to the latest Fabric Gradle plug-in resolves this issue.

From the change log:

  • Fixed obsolescence warning "registerResGeneratingTask".

https://docs.fabric.io/android/changelog.html#march-15-2018

+9
Mar 30 '18 at 16:14
source share

In my case, this was caused by a mismatch in the versions of the Android support libraries. I updated all the modules to the latest version (28.0.0), and this solved this problem.

+2
Nov 27 '18 at 20:40
source share

After installing Fabric correctly, this problem was resolved for me.

 import com.crashlytics.android.Crashlytics; import io.fabric.sdk.android.Fabric; public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); } } 

build.gradle

 buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' dependencies { implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9' } repositories { mavenCentral() maven { url 'https://maven.fabric.io/public' } } 
+1
Apr 22 '19 at 12:50
source share

For me, this warning disappeared when I turned off the gradle fabric plugin, o check if you are using the fabric or another plugin responsible for this warning.

0
Nov 14 '17 at 9:14
source share

The problem is resolved using the Google Services plugin version 4.3.0 (resolved using this commit )

 buildscript { dependencies { // Change version to 4.3.0 classpath 'com.google.gms:google-services:4.3.0' } } 

Found here

0
Jul 06 '19 at 1:11
source share



All Articles