Build gradle failed with exeption, - flutter

i am getting this error ,
my build.gradlefile
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build file '/home/Ecommerce_app /ecomm/android/build.gradle' line: 27
What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
Failed to notify project evaluation listener.
> 'org.gradle.api.file.RegularFileProperty org.gradle.api.file.ProjectLayout.fileProperty(org.gradle.api.provider.Provider)'
> Could not get unknown property 'ndkVersion' for extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.

Change the classpath in gradle.xml
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
}
And also I change the distributionUrl in gradle-wrapper.properties(Global Version)
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

Related

Build failed with an exception error flutter android device running error

This is my build.gradle code:
buildscript {
ext.kotlin_version = '<latest-version>'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Error showing:
I checked my Kotlin version but I can't fixed the error. How can fix this error? I think this is my computer Kotlin version error but I can't understand how to showing gradle file error. I'm trying to update Kotlin version.

Tried to build flutter app and got this Error "A problem occurred configuring root project 'android'"

The errors are below
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all files for configuration ':classpath'.
Could not download kotlin-gradle-plugin-1.6.10.jar (org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10)
> Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.10/kotlin-gradle-plugin-1.6.10.jar'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.10/kotlin-gradle-plugin-1.6.10.jar'.
> repo.maven.apache.org
Could not download dokka-core-1.4.32.jar (org.jetbrains.dokka:dokka-core:1.4.32)
> Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/dokka/dokka-core/1.4.32/dokka-core-1.4.32.jar'.
> Could not HEAD 'https://repo.maven.apache.org/maven2/org/jetbrains/dokka/dokka-core/1.4.32/dokka-core-1.4.32.jar'.
> repo.maven.apache.org
this is the build.gradle file below
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-
plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Put this code in your project-level build.gradle file
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Build failed with an exception in flutter while configuring with firebase

buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0 '
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
maven { url "https://maven.google.com" }
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am getting the following :
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all files for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:4.2.0 .
Required by:
project :
> Could not resolve com.android.tools.build:gradle:4.2.0 .
> Could not get resource 'https://dl.bintray.com/kotlin/kotlin-eap/com/android/tools/build/gradle/4.2.0%20/gradle-4.2.0%20.pom'.
> Could not GET 'https://dl.bintray.com/kotlin/kotlin-eap/com/android/tools/build/gradle/4.2.0%20/gradle-4.2.0%20.pom'. Received status code 502 from server: Bad Gateway
Does anyone
have an idea what the issue is,
how to fix it

Gradle failure A problem occurred evaluating project ':app' and Failed to apply plugin 'com.android.internal.application'

I am trying to build the gradle for my app but the build fails
I've looked around some other questions regarding to this issue and I couldn't solve it. Also, I have tried changing the gradle build tool version, adding different lib and some more stuff which didn't mange to solve the problem.
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Could not resolve all files for configuration ':app:debugRuntimeClasspath'

I am trying to build the flutter application. It was working fine before but suddenly this error is being shown:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.github.yalantis:ucrop:2.2.6.
Required by:
project :app > project :image_cropper
> Could not resolve com.github.yalantis:ucrop:2.2.6.
> Could not get resource 'https://www.jitpack.io/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom'.
> Could not HEAD 'https://www.jitpack.io/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom'.
> Connect to www.jitpack.io:443 [www.jitpack.io/149.56.28.39] failed: Read timed out
Following is my build.gradle file:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
maven { url 'https://www.jitpack.io' }
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I tried all the answers specified in github and stackoverflow. none of them worked. Please help me