Error in flutter project build gradle problem - flutter

What went wrong:
A problem occurred configuring root project 'android'
Could not resolve all artifacts for configuration
":classpath
Could not find com.android.tools.build:gradle:6.7.
Searched in the following locations:
-nttps:1/dl.google.com/d/android/maven2/com/android/tools/build/aradle/6.7/gradle-6.7.pom
nttps://repo_naven_apache.org/maven2/com/android/tools/build/aradle/6.7/gradle-6.7.pom
Required by:
project

Related

When I run my flutter code I face the following Gradle Dependency problem. What should I do?

I have tried to solve it through different pre-answered questions on StackOverflow but they are not working, That is why asking here, Please help.
here is the problem:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\TME_Education\StudioProjects\jeda\android\app\build.gradle' line: 58
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method compile() for arguments [com.android.tools.build:gradle:7.1.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Here is my dependency
dependencies {
compile 'com.android.tools.build:gradle:7.1.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
I was runing the code but this gradle Dependency eror happened.

A problem occurred configuring project ':shared_preferences_android'

I was trying to use this dependency but the problem is that my terminal couldn't access the directory due to my user name. I have a school organization account, and after the name it has a "(St" after my name. I tried to cd into that directory but it tells me that is requires a "close parentheses" or ")". How can I fix this?
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':shared_preferences_android'.
Could not resolve all dependencies for configuration ':shared_preferences_android:classpath'.
Could not load module metadata from C:\Users\BoneteJobertJanne(St.gradle\caches\modules-2\metadata-2.97\descriptors\org.jetbrains.kotlin\kotlin-reflect\1.5.31\a8be1fe3b3911d3d3425fe720cf42835\descriptor.bin
Failed to notify project evaluation listener.
Could not get unknown property 'android' for project ':shared_preferences_android' of type org.gradle.api.Project.
Could not get unknown property 'android' for project ':shared_preferences_android' of type org.gradle.api.Project.

Updating an old application caused this error => Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'

Installed an app from git-hub to update it, using flutter 1.22.6 (because the app was built using this version) but facing this error when running the code.
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
Could not resolve com.google.firebase:firebase-messaging:[10.2.1, 17.3.99].
Required by:
project :app > com.onesignal:OneSignal:3.15.6
> Failed to list versions for com.google.firebase:firebase-messaging.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml'. Received status code 403 from server: Forbidden
Could not resolve com.google.android.gms:play-services-ads-identifier:[15.0.0, 16.0.99].
Required by:
project :app > com.onesignal:OneSignal:3.15.6
> Failed to list versions for com.google.android.gms:play-services-ads-identifier.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml'. Received status code 403 from server: Forbidd
en
Could not resolve com.google.android.gms:play-services-base:[10.2.1, 16.1.99].
Required by:
project :app > com.onesignal:OneSignal:3.15.6
> Failed to list versions for com.google.android.gms:play-services-base.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-base/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-base/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-base/maven-metadata.xml'. Received status code 403 from server: Forbidden
because your project has old dependencies I suggest doing a Flutter clean.
but the error says that you don't have permission to download from the link. I think connect to VPN should solve this issue
For error related to 4XX, replace jcenter() with mavenCentral() in build.gradle file.
repositories {
google()
jcenter() //remove this
mavenCentral() //add this
}

when i run my flutter app ,there emerge a unexpected problem , error :

What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not resolve project :path_provider_macos.
Required by:
project :app > project :path_provider
Unable to find a matching configuration of project :path_provider_macos: None of the consumable configurations have attributes.
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
Finished with error: Gradle task assembleDebug failed with exit code 1
Some imports are missing. Try flutter pub get to update packages, or flutter pub cache repair, which will re-import all dependencies.
thank everyone , i get the solution about my problem : go to your Flutter sdk folder ,then go to .pub-cache\hosted\pub.dartlang.org\ ,if there have a path_provider_macos-0.0.4 folder ,delete it ,if no ,you try go .pub-cache\hosted\pub.flutter-io.cn\ , and remove path_provider_macos-0.0.4 folder
Deleted the folder you said,but show this wrong : Project :flutter declares a dependency from configuration 'embed' to configuration 'default' which is not declared in the descriptor for project :path_provider_macos.
The following is detailed:
> A problem occurred configuring project ':flutter'.
> Could not resolve all dependencies for configuration ':flutter:embed'.
> Could not resolve project :path_provider_macos.
Required by:
project :flutter
> Project :flutter declares a dependency from configuration 'embed' to configuration 'default' which is not declared in the descriptor for project :path_provider_macos.
> Could not resolve project :path_provider_linux.
Required by:
project :flutter
> Project :flutter declares a dependency from configuration 'embed' to configuration 'default' which is not declared in the descriptor for project :path_provider_linux.

Please I keep getting this error when I try to run my flutter app

What went wrong: Could not determine the dependencies of task
':app:compileDebugJavaWithJavac'. > Could not resolve all task
dependencies for configuration ':app:debugCompileClasspath'. > Could
not find
io.flutter:flutter_embedding_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
Required by: project :app > Could not find
io.flutter:x86_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
Required by: project :app > Could not find
io.flutter:x86_64_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
Required by: project :ap
Make sure you're on master branch and your flutter upgraded to last version.
then if the error remain delete the .gradle cache folder in youre home and applying ./gradlew cleanBuildCache in the project's android sub directory.