Ok, I know this question has been asked over and over and its usually something simple within your own build config that you need to update. However, I keeping seeing:
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. warning message.
I have already checked that I am using the latest of the google services:
'com.google.gms:google-services:4.0.1'
I've cleaned, rebuilt, invalidated cache with restart, and yet nothing changes. At this point my best guess is that this may be an underlying issue with 3rd party libs that I am importing. Could it be that they nay not be up to date with the implementation switch? Is there a way to find out which library would be the root cause, outside of me having to manually inspect each one of them?
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
This warning message is normal as you may be using a later version of Android Studio with android gradle plugin 3.0 or above.
compile, provided, and apk are currently still available. However, they will be removed in the next major release of the Android plugin.
See https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration for more details.
I found that the issue was a 3rd party lib/tool(s). The project I have inherited was including, but not actually using, Freeline Build Tool & Hugo. The moment I commented these out in both of the gradle files (project and app level) the warnings went away.
Related
When using com.android.tools.build:gradle:3.3.0-beta01, gradle fail with:
ERROR: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
I search in the documentation but I don't find how to raise warning, not error. End of 2019 is not here yet.
It happened to me and the problem was solved by commenting on the Fabric plugin in gradle.
If your case is the same but you need to continue using the Fabric, I recommend going back to the to the previous version of the gradle at the project level.
Change the classpath version to com.android.tools.build:gradle:3.2.1.
I followed the example project for the Google Maps SDK as found here, and it works perfectly. However the syntax highlighting in the MapsMarkerActivity is mostly red as shown in the picture.
I'm curious as to why this is and how I'd go about fixing it.
On another note, the compiler also prints out the following warnings:
[![WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
WARNING: Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation' and 'androidTestApi'.
WARNING: Configuration 'androidTestApi' is obsolete and has been replaced with 'androidTestImplementation'.
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.][2]][2]
Where would I find these outdated bits of code and what would be the best way to go about replacing them?
1.For red underline, probably is a lint bug, try update android studio and gradle plugin to latest version. If still failed, disable the lint option as below image:
2 For these warning, just do as IDE prompts,for example,replace compile with implementation. the other warnings are same handled.
implementation 'com.android.support:appcompat-v7:28.0.0'
I am new to Android Studio.
need to Migrate an old project to Android Studio
First I got this error :
android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor'..
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information ...
Then when I make the changes and replace what i need to i get this error:
'keyboard|screenSize|orientation|' is incompatible with ...
anyone having idea about this please help
For the android-apt error refer:
Incompatible plugins for android-apt after upgrading to Android Studio 2.3
Also, in your app gradle file, under dependencies section, change compile to implementation. (compile will be deprecated at the end of 2018, you should use implementation instead).
For the second one, it seems like (according to the image) that you have an extra | at the end (keyboard|screenSize|orientation|) try to remove it.
Next time please attach the code itself, it will be much easier to find what's wrong.
I get these two lines when compiling an old Android project using latest Android Studio (3.1.4):
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
I understand what they mean and how I can fix these warnings, there are also questions explaining it, but I can't any reference to 'testApi' anywhere on developer.android.com. Is it an error in warnings or was there testApi command? Was it added alongside 'testImplementation' and was later deprecated?
Previously we used testCompile but as per the last Gradle update Android Studio sometimes shows this messages though we edit the gradle file with new keywords.Now the "testApi" was not there in gradle as per my own experience.I think this error message is a fault.
I've inherited a cordova project that uses cordova-plugin-xapkreader, which appears to be the standard plugin for accessing expansion (aka OBB) files. I'm encountering an issue with it that I would expect to affect other cordova plugins. I get the following errors when running cordova build android:
Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':com.flyingsoftgames.xapkreader:downloader_library' is deprecated. Use 'implementation' instead.
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'debugCompile' in project ':com.flyingsoftgames.xapkreader:downloader_library' is deprecated. Use 'debugImplementation' instead.
Configuration 'releaseCompile' in project ':com.flyingsoftgames.xapkreader:downloader_library' is deprecated. Use 'releaseImplementation' instead.
Configuration 'compile' in project ':com.flyingsoftgames.xapkreader:library' is deprecated. Use 'implementation' instead.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':debugCompileClasspath'.
> Could not resolve project :com.flyingsoftgames.xapkreader:library.
Required by:
project : > project :com.flyingsoftgames.xapkreader:downloader_library
> Project :com.flyingsoftgames.xapkreader:downloader_library declares a dependency from configuration 'debugCompile' to configuration 'debug' which is not declared in the descriptor for project :com.flyingsoftgames.xapkreader:library.
This has been reported as a bug on the plugin's forum by someone else, but the workaround doesn't reliable work:
https://github.com/agamemnus/cordova-plugin-xapkreader/issues/116
The issue appears to be that gradle expects you to now use implementation rather than compile, debugCompile etc. The gradle file for the plugin is generated by cordova, based on a template inside cordova-android. The suggested workaround is to modify the template (or the generated gradle files) in a script run from a cordova hook. Unfortunately for some reason, the hooks don't appear to work reliably - sometimes they do, sometimes they don't. This feels like it may be due to a race condition caused by the hooks running asynchronously with the rest of the build process - so sometimes the gradle build has started before the gradle files can be modified.
Does any have any ideas how to properly fix this? Does anyone know why this isn't a more wide-spread issue that the cordova-android project hasn't fixed by modifying their template? Is this something I can fix by downgrading some part of the build process?
I'm pretty new to Cordova, so it's all quite baffling and any help is much appreciated!
Unfortunately for some reason, the hooks don't appear to work reliably
- sometimes they do, sometimes they don't. This feels like it may be due to a race condition caused by the hooks running asynchronously
with the rest of the build process - so sometimes the gradle build has
started before the gradle files can be modified.
I think this can be fixed by making the hook return a promise, this way you can ensure the rest of the build won't run in parallel. I posted the code I'm using on the github issue.
The revelant code is the following:
- create a promise at the beginning of the hook:
const deferral = context.requireCordovaModule('q').defer();
- return the promise at the end of the hook:
return deferral.promise;
- resolve the promise once the work is finished (the file is written):
deferral.resolve();