I have the following build.gradle in my Android app:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
}
}
repositories {
google()
mavenCentral()
}
apply plugin: 'com.android.application'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'com.google.android.gms:play-services-ads:21.3.0'
implementation "com.android.billingclient:billing:4.0.0"
}
and get a warining:
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33
This Android Gradle plugin (7.0.2) was tested up to compileSdk = 31
This warning can be suppressed by adding
android.suppressUnsupportedCompileSdk=33
to this project's gradle.properties
The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33
But when I try to use Gradle plugin 7.4 I get this:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android-build'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:7.4.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.4/gradle-7.4.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.4/gradle-7.4.pom
Required by:
project :
* 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
with 7.2 I get this:
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\build.gradle' line: 17
* What went wrong:
A problem occurred evaluating root project 'android-build'.
> Failed to apply plugin 'com.android.internal.version-check'.
> Minimum supported Gradle version is 7.4. Current version is 7.2. If using the gradle wrapper, try editing the distributionUrl in D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\gradle\wrapper\gradle-wrapper.properties to gradle-7.4-all.zip
* 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
What is happening?
EDIT1
If I spefify 7.3.1 version in build.gradle I get the following strange error message:
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\build.gradle' line: 17
* What went wrong:
A problem occurred evaluating root project 'android-build'.
> Failed to apply plugin 'com.android.internal.version-check'.
> Minimum supported Gradle version is 7.4. Current version is 7.2. If using the gradle wrapper, try editing the distributionUrl in D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\gradle\wrapper\gradle-wrapper.properties to gradle-7.4-all.zip
* 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
What can it be?
Version 7.4 of the Android Gradle plugin doesn't exist, the latest stable version is 7.3.1, as you can see in the Google's Maven repo index. Other versions you could use are 7.4.0-beta02 and 8.0.0-alpha05.
Related
what should i do if in flutter error like this?
* Where:
Build file 'D:\StudioProjects\dindiksbynew\android\app\build.gradle' line: 26
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not open dsl generic class cache for script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' (C:\Users\RRHP\.gradle\caches\7.4\scripts\emabqxituwovfmtng117ez4xf).
> Unexpected lock protocol found in lock file. Expected 3, found 0.
* 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 43s
Exception: Gradle task assembleDebug failed with exit code 1
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
I've tried changing the gradle version, still can't, please help
been faced this issue lastweek. Its quite difficult to debug. and here my current workaroud:
android>build.gradle
buildscript {
ext.kotlin_version = '1.7.20' // upgrade my kotlin version
...
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0' // change this
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
doc: https://kotlinlang.org/docs/gradle.html#apply-the-plugin
latest stable kotlin version 1.7.20, maximum fully support only for gradle 7.1.1
its recommended do not use gradle above it.
next
add this line to: android>gradle>wrapper>gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
another step, maybe its required to upgrade to java sdk 11.
hope its help.
My code working perfectly before I will be add cloud firestore plugin but after I will be added this plugin and i get this error
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "D:\Flutter\myfarmer\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Flutter\myfarmer\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
* 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 3s
Command: D:\Flutter\myfarmer\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.```
in your gradle make sure you are using google the old google-services 4.2.0
in android/build.gradle
dependencies {
...
classpath 'com.google.gms:google-services:4.2.0'
...
}
update flutter or use other version of gradle by changing the class path in my case this was worked
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
hope it helps you
I try to add google maps on flutter, I added the following dependence:
dependencies:
google_maps_flutter: ^0.5.17
and its respective api key in android and ios.
But when running the project it marks the following:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.google.android.gms:play-services-tasks' has different version for the compile (15.0.1) and runtime (16.0.1) classpath. You should manually set the same version via DependencyResolution
* 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 4s
Finished with error: Gradle task assembleDebug failed with exit code 1
and try to add the dependencies manually in buil.gradle
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
}
and this in build.gradle in project level
apply plugin: 'com.google.gms.google-services'
but still with the same.
You probably have to migrate your project to AndroidX. I had a similar issue in my project.
Open you Android folder in Android studio, go to File -> Sync Project With Gradle Files and then Refactor -> Migrate to AndroidX
I have updated top-level build.gradle file :
from
classpath 'com.android.tools.build:gradle:3.1.4'
to
classpath 'com.android.tools.build:gradle:3.3.0'
And now cant build project on Bitbucket-Pipelines:
Error is:
FAILURE: Build failed with an exception.
* Where:
Build file '/opt/atlassian/pipelines/agent/build/app/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Minimum supported Gradle version is 4.10.1. Current version is 4.4. If using the gradle wrapper, try editing the distributionUrl in /opt/atlassian/pipelines/agent/build/gradle/wrapper/gradle-wrapper.properties to gradle-4.10.1-all.zip
* 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 37s
Minimum supported Gradle version is 4.10.1. Current version is 4.4.
The statement itself says the solution
Please change inside
project>gradle>wrapper>gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
I want to see which library uses play-services.
I command gradlew app:dependencies in my Android Studio terminal. It throws this:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Projects\project\android\app\build.gradle' line: 18
* What went wrong:
A problem occurred evaluating project ':app'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
The 18th line of my app gradle is: apply plugin: 'com.android.application'
Any ideas?
Run with Java 8.
52 missmatch:
https://javarevisited.blogspot.com/2015/05/fixing-unsupported-majorminor-version.html
probably got this in build.gradle as well?
sourceCompatibility = 1.8
targetCompatibility = 1.8