'A problem occurred configuring project ':cloud_firestore' //closed
My project is going very well, but after adding some dependencies I am facing an error message.
flutter clean
flutter upgrade
flutter pub get
are not working in my case.
Here is the error message :
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':cloud_firestore'.
> Could not open proj remapped class cache for avok974yim47bw7y5uibkvy5o (C:\Users\Lenovo\.gradle\caches\5.6.2\scripts-remapped\build_7tod23iwanax3gvxok38cccwk\avok974yim47bw7y5uibkvy5o\projc2aa9a77c8f22767dac24ce473ea6e20).
> Unexpected lock protocol found in lock file. Expected 3, found 0.
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':cloud_firestore' of type org.gradle.api.Project.
> Could not find method implementation() for arguments [project ':firebase_core'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
> Could not find method implementation() for arguments [project ':cloud_firestore_web'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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 2s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
dependencies
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
animated_text_kit: ^2.0.0
firebase_core: ^0.4.4+2
firebase_auth: ^0.15.5+2
cloud_firestore: ^0.13.4
build.gradle
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
this are the dependencies of app gradle build.gradle()
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Solution 1:[1]
I removed all
firebase_core: ^0.4.4+2
firebase_auth: ^0.15.5+2
cloud_firestore: ^0.13.4
and then added them one by one
like
add firebase_core: ^0.4.4+2 then run the app
add firebase_auth: ^0.15.5+2 and run the app
and it works I do not know where is the problem but I solved it with that.
Solution 2:[2]
In my case, I have removed the version of dependencies the error was automatically removed. before:
firebase_core: ^1.10.0
firebase_app_check: ^0.0.3
cloud_firestore: 3.1.0
after:
firebase_core: ^1.10.0
firebase_app_check: ^0.0.3
cloud_firestore:
Solution 3:[3]
The problem seems to be how you are using the $.post method. jQuery uses the application/x-www-form-urlencoded;charset=UTF-8 contentType on post by default if you don't specify another contentType. Combined with the @RequestBody annotation at backend (which requires application/json by default) it results in the seen exception and 415 status code.
The solution to this problem should be fairly easy, just add the correct configuration for the .post method, something like this:
$.post({
url: urlCrearAlta,
type: "POST",
contentType: 'application/json',
dataType: 'json',
data: JSON.stringify(data)
})
.done((data, status) => {
console.log(data, status);
//do whatever you like with data and status
});
Also, as stated in jQuery documentation here, $.post is just a shorthand method for $.ajax, so if $.ajax doesn't work and $.post does, there should be something wrong in how you configure the request or how you handle the callbacks methods. The major suspect for me would be the success function you specify in the $.ajax request, check there is nothing wrong in there, or just use the other callback methods, like .done, .fail and .always
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Khaled Mahmoud |
| Solution 2 | Talha Iqbal |
| Solution 3 | Dharman |
