What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all files for configuration ':classpath'.
Could not find com.android.tools.build:gradle:7.2.2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.2.2/gradle-7.2.2.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.2.2/gradle-7.2.2.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
File build.gradle
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.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
}
I don't know what to do
It's an access-related issue. You can try to check this link with your browser https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.2.2/gradle-7.2.2.pom
you can see that there is an error, and it's not accessible for you.
And there are multiple ways to gain access.
Here is an old answer of mine explaining how to set up a valid connection.
You can also use some VPNs like ProtonVPN, which will have a system-wide effect.
Related
Today when I build the flutter (flutter version:2.8.0) project in android studio 2021.2.1, shows error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':device_info:compileDebugJavaWithJavac'.
> Failed to calculate the value of task ':device_info:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
> Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /Users/foo/source/reddwarf/frontend/cruise-open/build/device_info/generated/ap_generated_sources/debug/out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer#265a97d4) before task ':device_info:compileDebugJavaWithJavac' has completed is not supported
* 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 6s
Exception: Gradle task assembleDebug failed with exit code 1
why did this happen? what should I do to fix this problem? Anyone facing the similiar issue? The lib device info in pubspec.yaml version is: device_info: ^2.0.0. This is my build.gradle:
buildscript {
ext.kotlin_version = '1.6.20'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1'
}
}
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
}
I get this error when I create and run a new project.This is the error I get when I run the project normally. I didn't do anything extra. Even if I run it in Visual Studio Code, this error appears. Can you help me ?
This is below the flutter file android > 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}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is the error I got:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10.
Required by:
project :
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10.
> Could not get resource 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.10/kotlin-gradle-plugin-1.6.10.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.10/kotlin-gradle-plugin-1.6.10.pom'.
> Connect to localhost:44444 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
> Could not resolve 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.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.10/kotlin-gradle-plugin-1.6.10.pom'.
> Connect to localhost:44444 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
EDIT:
I finally found the solution. The problem was the internet connection. Firstly, you should check your proxy settings and then I don't know if it might be but you can delete .gradle file.This solved the problem. Thanks for all the supports.
I'm facing issue when work with 2 dependences together , I'm using this dependences in pubspec.yaml
dependencies:
flutter:
sdk: flutter
location: ^2.3.5 . ** this one
image_picker: ^0.6.1+10 ** this one
if use these dependents will show the next issue in blow
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.core:core' has different version for the compile (1.0.0-rc01) and runtime (1.0.2) 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 2s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
but if I use one of these dependencies it worked as good , but if both together make the same issue in top
this is code of
gradle.properties
android.useAndroidX=true
android.enableJetifier=true
org.gradle.jvmargs=-Xmx1536M
this is code of
build.gradle
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
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
}
Edit
I tred to downgrade this package image_picker to 0.6.1+1 or less and it's working now !! but I want to know is there regular fix way another this ?
I had a similar error recently.
You just have to explicitly tell the compiler which version of the dependency to use.
That did the trick for me.
You can re-write this section of your project-level build.gradle file:
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
as
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('multidex')) {
details.useVersion "1.0.2"
}
}
}
I hope that fixes your issue :)
* Error running Gradle:
ProcessException: Process exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\user\AndroidStudioProjects\stop\android\app\build.gradle' line: 5
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'reader' for project ':app' 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. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 17s
Command: C:\Users\user\AndroidStudioProjects\stop\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Process finished with exit code 1
Info:-
1.I have deleted IOS directory before running build apk
2.I don't know if IOS directory affect a flutter app or not
3.After trying to build apk this above error is displaying in the console box
I have added build.gradle code
//buildscript {
// ext.kotlin_version = '1.3.50'
// repositories {
// google()
// jcenter()
// }
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
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
}
Local.properties
sdk.dir=C:\\Users\\user\\AppData\\Local\\Android\\Sdk
flutter.sdk=C:\\Users\\user\\flutter
flutter.versionName=1.0.0
flutter.versionCode=1
flutter.buildMode=release
app/build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.ramram.quit"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
I have added build.grale and local properties please help now...
Below code is the latest error
* Error running Gradle:
ProcessException: Process exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\user\AndroidStudioProjects\stop\android\build.gradle' line: 30
* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not find method classpath() for arguments [com.android.tools.build:gradle:3.5.1] 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 1m 15s
Command: C:\Users\user\AndroidStudioProjects\stop\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
I was building a language server following this tutorial
https://www.eclipse.org/community/eclipse_newsletter/2017/may/article5.php
But, when I tried to build the shadowJar, I kept getting this error:
D:\leaf\org.xtext.example.mydsl1.parent>gradle shadowJar
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\leaf\org.xtext.example.mydsl1.parent\build.gradle' line: 25
* What went wrong:
A problem occurred evaluating root project 'org.xtext.example.mydsl1.parent'.
> Plugin with id 'org.xtext.xtend' not found.
* 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 0s
Below is my build.gradle file of the parent script
buildscript {
repositories {
jcenter()
}
plugins {
id "org.xtext.xtend" version "2.0.1"
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
classpath "org.xtext:xtext-gradle-plugin:2.0.1"
}
}
subprojects {
ext.xtextVersion = '2.16.0-SNAPSHOT'
repositories {
jcenter()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
apply plugin: 'java'
apply plugin: 'org.xtext.xtend'
apply plugin: 'com.github.johnrengelman.shadow'
apply from: "${rootDir}/gradle/source-layout.gradle"
apply from: "${rootDir}/gradle/maven-deployment.gradle"
apply plugin: 'eclipse'
group = 'org.xtext.example.mydsl1'
version = '1.0.0-SNAPSHOT'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
configurations.all {
exclude group: 'asm'
}
}
I created the project again and used the code that the wizard created. I selected the Language server build type as "Fat jar" since my goal was to create one. Apart from that, I added the basename, classifier, and version given in the tutorial to the auto-generated code. The shadowjar (in the build.gradle file of the .ide folder) was the only part of code that I changed. Thus, my shadowjar code looks like this:
shadowJar {
baseName = 'dsl-language-server'
classifier = null
version = null
from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output)
configurations = [project.configurations.runtime]
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA','schema/*',
'.options', '.api_description', '*.profile', '*.html', 'about.*', 'about_files/*',
'plugin.xml', 'modeling32.png', 'systembundle.properties', 'profile.list')
classifier = 'ls'
append('plugin.properties')
}
Then I navigated to the parent folder of my project through Windows PowerShell and built it using the command "gradle shadowjar". It built fine!
The built jar file can be found in /build/libs/ in the .ide directory.