I got this error when I was building my Android project by gradle. It roughly happened once per week.
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture snapshot of input files for task ':xxxxxxxx:compileDebugAidl' property 'importDirs' during up-to-date check.
> Cannot invoke method containsKey() on null object
* 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
Any idea what may cause this error? thanks
From #tapchicoma comment to the original question, the issue: NullPointerException in Google Services Plugin now is marked as fixed for 4.2.0.
So, the final solution is to update to:
classpath 'com.google.gms:google-services:4.2.0'
Until the bug is fixed by google, downgrading to the play services 4.0.1 seems to have fixed this issue for me so far:
classpath 'com.google.gms:google-services:4.0.1'
https://stackoverflow.com/a/50930048/4096987
Related
In an Android app I'm using Kotlin 1.7.20 and I'm trying to switch to Kotlin 1.8.10 but I'm getting the error:
1: Task failed with an exception.
What went wrong:
Execution failed for task ':useraction:kaptGenerateStubsDebugKotlin'.
'void org.jetbrains.kotlin.incremental.FileUtilsKt.cleanDirectoryContents(java.io.File)'
Try:
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Unfortunately it isn't clear what is triggering the call to cleanDirectoryContents.
I know that Kotlin 1.8.0 introduced a change around that features but I didn't find any tutorial for the migration.
It looks like it was a problem with the gradle cache although I can't be sure.
When I upgraded the gradle wrapper to 7.6 from 7.3.3 suddenly it started working. I tried to reverse the change to reproduce the issue again and I couldn't.
I can't really point to the thing that fixed it
I am going through Android Tutorials to learn how to code. I haven't dealt with Gradle before. So I am having a hard time understanding the error codes. I build a very basic app.
When I go to build and click Make Project I get a weird error at the bottom:
And it doesn't do much after that. I am not sure if that is a warning that I can ignore or not. When it comes to Android dev, I am just a spring chicken.
EDIT: If i run the gradle.bat file from the command line I get this:
C:\git\Others\android-code\MyTestApp>gradlew.bat
Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\git\Others\android-code\MyTestApp\build.gradle' line: 7
* What went wrong:
Plugin [id: 'com.android.application', version: '7.4.0', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:7.4.0')
Searched in the following repositories:
Google
MavenRepo
Gradle Central Plugin Repository
* 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
BUILD FAILED in 6m 14s
Any help would be appreicated. I cant even get through the tutorial with these errors!
If you use a proxy I suggest You look at this issue.
Pay attention to it:
Also I had clean my proxy in gradle.properties. Don't know if there is
any check that I have left.
Thx I finally found the problem:
After I set the proxy in Android Studio, it set the proxy to the file
in /User/.gradle/gradle.properties
Thanks again for your help and sorry for the bothering.
Earlier my project was running without error but today i am getting following error. I would appreciate if anyone can help to get out of this issue.
Note- I am not using jCenter in my app, payment sdk flutter_stripe using jCenter
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.stripe:stripe-android:20.12.+.
Required by:
project :app > project :stripe_android
> Failed to list versions for com.stripe:stripe-android.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/stripe/stripe-android/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/stripe/stripe-android/maven-metadata.xml'.
> Read timed out
* 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
BUILD FAILED in 1m 47s
Exception: Gradle task assembleDebug failed with exit code 1
Here is a link to a solution in the flutter_stripe issue list
You need to add the following line inside app level build.gradle file:
constraints { implementation('com.stripe:stripe-android') { version { strictly '20.11.0' } } }
constraints { implementation('com.stripe:financial-connections') { version { strictly '20.11.0' } } }
I also had this problem and for two days I tried to figure out what the cause was. The problem is jcenter. Not so why it decided not to work. I solved it by replacing with mavenCentral in your project level build.gradle.
Reference: My flutter Android build broke all sudden with a gradle error, with no changes to the gradle configuration on my part
If you also have the "Stripe" plugin, you have to add this extension as well as the user indicated above
Jcenter seems down today.I guess you should switch to mavenCentral instead.
I have an error after implementing Google Play games in Unity 2019, I'm using Google ARcore and Google Play games for Android. I never had a problem with this before and I read through some answers online on forums, but they all not work.
Does someone know how to fix this error?
I already have tried to change the mainTemplate.gradle file but it doesn't work.
The errors I'm getting are:
Could not determine the dependencies of task ':launcher:lintVitalRelease'.
This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
* 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.
After latest update of android studio , using classpath 'com.android.tools.build:gradle:2.3.0-beta1' , I am getting the following error on gradle sync .
Error:Gradle DSL method not found: 'has()'
Any ideas
Update its casused by android volley , full error :
Error:FAILURE: Build failed with an exception.
Where:
Script 'D:\APPS-MOBI**\Android\volley\bintray.gradle' line: 64
What went wrong:
A problem occurred evaluating script.
Could not find method has() for arguments [release] on project ':volley' of type org.gradle.api.Project.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
The Volley project has given the following warning for a while now:
The has() method has been deprecated and is scheduled to be removed in Gradle 3.0. Please use the hasProperty() or ext.has() method instead.
Changing the line in Volley's bintray.gradle file from
publish = project.has("release")
to
publish = project.hasProperty("release")
Seems to fix the issue
I found the publish=project.has("release") around line 64 in bintray.gradle.
in android studio click the top of the project tree and Edit|FindInPath
Had the same problem then I tried this:
go to your volley module and comment out "publish = project.has("release")" in the "bintray.gradle" file