I updated Android Gradle Plugin to v3.6.2 and Grade to v6.3 in Android Studio. When I run a build with the compiler option --warning-mode all, I get the following two deprecation warnings:
1:
Configure project :app
Internal API constructor DefaultDomainObjectSet(Class<T>) has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use ObjectFactory.domainObjectSet(Class<T>) instead. See https://docs.gradle.org/6.3/userguide/custom_gradle_types.html#domainobjectset for more details.
at build_gklh609eby8f87cnghyses56.run(E:\Mahalaya\app\build.gradle:1)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
2:
Querying the mapped value of map(property(interface org.gradle.api.file.Directory, property(interface org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, E:\Mahalaya\app\build\generated\ap_generated_sources\debug\out)))) before task ':app:compileDebugJavaWithJavac' has completed has been deprecated. This will fail with an error in Gradle 7.0. Consult the upgrading guide for further information: https://docs.gradle.org/6.3/userguide/upgrading_version_6.html#querying_a_mapped_output_property_of_a_task_before_the_task_has_completed
It hasn't been a long time since I have started programming in Android, and I have no idea about what to do about these warnings. I can't understand what is being said in the links. Any help is appreciated.
Update: Gradle v6.5 shows the same warnings.
I think it is caused by one of these plugins. I have it too:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
And i also think they will update these plugins as well. So that the deprecation would not be a problem.
Related
When building my project in Android Studio, I get the following error.
Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16.
I have tried changing the Kotlin version in my project-level gradle file to almost every single stable release available without much success. The one or two stable releases of Kotlin that do make this error go away generate their own errors.
The current Gradle version 5.6.4 is not compatible with the Kotlin Gradle plugin. Please use Gradle 6.1.1 or newer, or the previous version of the Kotlin plugin.
jav.lang.noClassDefFoundError
Build file 'C:\Users\pictu\Downloads\ble-starter-android-master\ble-starter-android-master\app\build.gradle' line: 18
A problem occurred evaluating project ':app'.
> org/gradle/api/services/BuildService
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:227)
at
...
org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
... 130 more
Caused by: java.lang.ClassNotFoundException: org.gradle.api.services.BuildService
... 160 more
I've tried using multiDex, I've tried changing the Kotlin version, I've tried changing the compileSdkVersion + minSdkVersion + targetSdkVersion, but none of them worked. I've also looked at several SO posts, but I haven't found any that help my specific issue.
UPDATE 1: The error message points out this line specifically.
apply plugin: 'kotlin-android'
UPDATE 2: The answer to this SO post helped me get a little further. Now I am getting this cryptic stack trace that mentions something about a circular reference. I haven't been able to find out what a circular reference is in this context.
Invoke-customs are only supported starting with Android O (--min-api 26)
Stack trace:
com.android.tools.r8.a: Invoke-customs are only supported starting with Android O (--min-api 26)
at com.android.tools.r8.dex.r.a(:289)
at com.android.tools.r8.dex.r.a(:98)
at com.android.tools.r8.dex.r.b(:188)
at com.android.tools.r8.dex.b.a(:63)
at
...
Caused by: [CIRCULAR REFERENCE: com.android.tools.r8.a: Invoke-customs are only supported starting with Android O (--min-api 26)]
These are the two Stack Overflow posts that led me to my answer (1, 2).
You need to update your Gradle settings. I updated mine to Gradle version 6.1.1 using the chart in the answer to the first SO post I referenced.
The second thing you need to do is specify sourceCompatibility and targetCompatibility as JavaVersion.VERSION_1_8 in the compileOptions section of the app level Gradle file.
I have created a Flutter project in Android Studio (Bumblebee | 2021.1.1 Patch 3). When I open the android folder in a seperate window, when the gradle syncing is being executed, it fails with the message Gradle project sync failed. Basic functionality(e.g. editing,debugging) will not work properly. I ran ./gradlew --warning-mode all in the command line and it's output is
Configure project :app
The AbstractArchiveTask.destinationDir property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the destinationDirectory property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:destinationDir for more details.
at FlutterPlugin$_addFlutterTasks_closure21$_closure47.doCall(/home/sudipta/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle:863)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
The AbstractArchiveTask.archiveName property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveFileName property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:archiveName for more details.
at FlutterPlugin$_addFlutterTasks_closure21$_closure47.doCall(/home/sudipta/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle:864)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
> Configure project :system_alert_window
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
> Task :help
Welcome to Gradle 6.7.
To run a build, run gradlew <task> ...
To see a list of available tasks, run gradlew tasks
To see a list of command-line options, run gradlew --help
To see more detail about a task, run gradlew help --task <task>
For troubleshooting, visit https://help.gradle.org
The last warning is due to system_alert_window (flutter)plugin that I am using. But these deprecation warnings are causing issues in Android Studio editor so that I am unable to use code completion feature. I don't know why is this happening, since these are only warning messages.
My gradle version is 6.7 and android-gradle version is 4.1.0.
Can anyone please help?
TRY this steps-
Step 1:
Open the gradle.properties file same like given Image-
https://i.stack.imgur.com/S2Y0a.png
Step 2:
Disable android.enableR8=true by adding a # in front:
#android.enableR8=true
Alternatively, you can swap out the R8 for D8, The build system changed to using D8 instead of R8.
android.enableD8=true
After i have updated android studio to 3.4.2 and gradle,
when i run this line
gradlew publishApkappNameRelease
im getting this error :
* What went wrong: Some problems were found with the configuration of task ':app:generateappNameReleasePlayResources'.
> File 'E:\Projects\packagename\app\src\main\play' specified for property '$1' does not exist.
> File 'E:\Projects\packagename\app\src\appName\play' specified for property '$2' does not exist.
> File 'E:\Projects\packagename\app\src\release\play' specified for property '$3' does not exist.
> File 'E:\Projects\packagename\app\src\appNameRelease\play' specified for property '$4' does not exist.
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 47s 56 actionable tasks: 55 executed, 1 from cache
note: this line is used to auto publish apk using
apply plugin: 'com.github.triplet.play'
classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
same when i run this command line gradlew --recompile-scripts i get error
Unknown command-line option '--recompile-scripts'
These commands were running fine before the updates.
UPDATE:
when i try to update the triplet.play to any of t hose versions (2.2.1 - 2.2.0 - 2.1.1 - 2.1.0 - 2.0.0 - 2.0.0-rc2) i get this error
Could not find com.github.triplet.gradle:play-publisher:2.2.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.pom
- https://dl.google.com/dl/android/maven2/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.jar
- https://jcenter.bintray.com/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.pom
- https://jcenter.bintray.com/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.jar
- https://repo.maven.apache.org/maven2/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.pom
- https://repo.maven.apache.org/maven2/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.jar
Required by:
project :
Apparently this can be fixed by upgrading the version of the play-publisher plugin from 1.1.5 to 2.1.1 as per the GitHub issue here: https://github.com/Triple-T/gradle-play-publisher/issues/532
However, it seems that the newer versions of the plugin aren't available on all artifact repositories. I found it here which has clear steps of doing it: https://plugins.gradle.org/plugin/com.github.triplet.play
Lastly it is advised that you check their GitHub page again to make sure that the config you currently have is still compatible: https://github.com/Triple-T/gradle-play-publisher
With regards to gradlew --recompile-scripts, this has been deprecated and removed in the new version since most of the times the gradle daemon is running and ignores this option. More info here: https://github.com/gradle/gradle/issues/1425
First, add a new repo to your repositories on build.gradle (Project)
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
Now , upgrade your classpath.
classpath 'com.github.triplet.gradle:play-publisher:2.1.1'
I am working on a project that previously used Gradle 4.6 and it worked fine. I just updated to Gradle 5.1.1 and I am now receiving the following warnings (Not sure they are warnings or errors, though):
> Configure project :app
Warning: Please apply google-services plugin at the bottom of the build file.
The ProjectLayout.fileProperty() method has been deprecated. This is scheduled to be removed in Gradle 6.0. Please use the ObjectFactory.fileProperty() method instead.
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
FAILURE: Build failed with an exception.
* What went wrong:
Failed to notify build listener.
> org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
CONFIGURE FAILED in 0s
Cause: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;
I searched for ProjectLayout.fileProperty inside the whole project and didn't find a single string like that. Where is fileProperty used then causing the compiler to complain? How can I fix these deprecation warnings rather than suppressing them? Is there a part of my code I need to change? Or does the usage pointed to by compiler occur inside one of the libraries I have added?
These are warnings, not errors, and can come either from your own build scripts, or as it seems to be the case here, from a plugin.
These warnings, as they indicate, can become errors only when moving to the next Gradle major version.
In the case the source of the warning is inside your build script, you should try to make them go away as fast as possible. That way upgrading to the next Gradle major version will not be a problem.
When coming from a plugin, if you can identify the right plugin, upgrade to a more recent version and file an issue if the warning persists. This way you have a better chance that the plugin keeps working with the next Gradle major version.
InspectAndroidManifest new build.gradle
I have tried almost every solution provided on Stack Overflow related to this 'gradle project syc failed' error, but nothing was useful in my case. I am new to Android Studio and miserably got stuck at the beginning.
In the event log this message appears:
Gradle sync failed: Failed to apply plugin [id 'com.android.application']
Consult IDE log for more details (Help | Show Log) (296ms)
But I am not able to click on (Help | Show Log).
Note: Using Android Studio 3.1.3 and Gradle version 4.9.
it's probably problem with your plugin implementation
Probably you don't have the main class (the one executes when the app starts) that is extended from Application. It will be better to see your AndroidManifest as well.
But i guess, if you remove apply plugin: com.android.application from build.gradle it may work.