I have this problem in my visual studio code:
Could not run phased build action using connection to Gradle distribution
'https://services.gradle.org/distributions/gradle-7.4-all.zip'.
Every time I start a new project this happens.
how is my .build.gradle file in android:
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
How is the local.properties file:
sdk.dir=/Users/luana/Library/Android/sdk
flutter.sdk=/Users/luana/src/flutter
the path of my gradle: Users/luana/.gradle
I tried deleting the .gradle folder from my files, and it didn't work. I tried to add a path in android studio, it didn't work. I do not know what else to do!
Related
every time I want to build the android project in flutter shows this message:
Could not create task ':path_provider_android:generateDebugUnitTestConfig'.
this and base files have different roots: E:\apps\our_class\build\path_provider_android and F:\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_android-2.0.9\android.
I tried many versions of Gradel, but still same problem
I have fixed this issue by moving my whole project to C: drive where i have installed the flutterSDK. I moved my project to C:\Users\name\AndroidStudioProjects
It works fine when I change my gradle version in android/build.gradle
Before I change my gradle file it looks like
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
After I change it
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Then run flutter clean to clean the previous build file
You just needed to delete conflicting file from this location
E:\apps\our_class\build\path_provider_android
Which could be done with
flutter clean
And then tried gradle build or sync again
i had same problem and this answer helped me. i hope it's work for you
https://stackoverflow.com/a/54596753/12315661
This issue is a pain for me I normally fix this issue by doing the following steps
run flutter clean / delete the build folder
Build the project on Android studio
run flutter pub get
I am using Firebase Database in my Unity project, but I am having some issues when building the project for android.
It runs fine in the unity player, but when I try to build and run for android, I get the following error message.
I have double checked that the Firebase SDK is imported correctly.
The console outputs this error;
IOException: Failed to Move File / Directory from 'Temp/StagingArea\android-libraries\firebase-core-11.2.0\classes.jar' to 'Temp/StagingArea\android-libraries\firebase-core-11.2.0\libs\classes.jar'.
After checking the Temp folder I see that these files does indeed not exist. Should these files be generated during build? Am I missing something?
In your build settings change it from Internal to Gradle and then add a build.gradle file to your root folder
Here's a sample build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
I am trying to use gradle build. It gives me error saying that
Failed to apply plugin [id 'com.android.library']
Gradle version 2.2 is required. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /home/sanjeewa/workspace/Android/UVCCamera/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip
But my gradle-wrapper.properties includes gradle-2.4-all.zip. I have changed it to gradle-2.2-all.zip
Still same problem.
When I run gradle -version in terminal Gradle 2.10 shows as version.
How to solve that error??
my build gradle file is
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Open gradle-wrapper.properties
Change this line:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
with
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
Go to build.gradle (Project: your_app_name)
Change this line
classpath 'com.android.tools.build:gradle:XXX'
to this
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
or
classpath 'com.android.tools.build:gradle:1.5.0'
Don't click Sync Now
From menu choose File -> Invalidate Caches/Restart...
Choose first option: Invalidate and Restart
Android Studio would restart. After this, it should work normally
Hope it help
Current work around is to overrideVersionCheck: In your build.gradle
buildscript {
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
...
}
Check this link for more Details
Just Change in build.gradle file
classpath 'com.android.tools.build:gradle:1.3.0'
To
classpath 'com.android.tools.build:gradle:2.0.0'
Now GoTo -> menu choose File -> Invalidate Caches/Restart...
Choose first option: Invalidate and Restart
Android Studio would restart.
After this, it should work normally.
Based on
https://developer.android.com/studio/releases/gradle-plugin.html ...
The following table lists which version of Gradle is required for each version of the Android plugin for Gradle.
For the best performance, you should use the latest possible version of both Gradle and the Android plugin.
So, the Plugin version with Required Gradle version should be match.
Here's what I did to fix this:
1) Create a new project
2) open the gradle-wrapper.properties file and copy the distributionUrl to your project e.g.:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip
3) open the build.gradle (Project) and copy the gradle dependency to your project e.g.:
classpath 'com.android.tools.build:gradle:2.3.0-beta1'
4) File --> Invalidate Caches / Restart (I think a re-sync may have sufficed, but didn't try it)
5) Delete that project you made (optional)
Look, this is a silly way to do things, but Android Studio is free so who am I to complain...
Use ./gradlew instead of gradle to resolve this issue.
The android studio and Gradle version looks like very bad managed. And there's tons of version in-capability issues. And the error message is mostly clueless. For this particular issue. The closest answer is from "Jitendra Singh". Change the version to:
classpath 'com.android.tools.build:gradle:2.0.0'
But in my case: Android studio 2.2 RC, I still get another error:
Could not find matching constructor for: com.android.build.gradle.internal.LibraryTaskManager(org.gradle.api.internal.project.DefaultProject_Decorated, com.android.builder.core.AndroidBuilder, android.databinding.tool.DataBindingBuilder, com.android.build.gradle.LibraryExtension_Decorated, com.android.build.gradle.internal.SdkHandler, com.android.build.gradle.internal.DependencyManager, org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry)
So I went to the maven central to find the latest com.android.tools.build:gradle version which is 2.1.3 for now. So after change to
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
Solved my problem eventually.
I Had similar issue. Every project has his own gradle folder, check if in your project root there's another gradle folder:
/my_projects_root_folder/project/gradle
/my_projects_root_folder/gradle
If so, in every folder you'll find /gradle/wrapper/gradle-wrapper.properties.
Check if in /my_projects_root_folder/gradle/gradle-wrapper.properties gradle version at least match /my_projects_root_folder/ project/ gradle/ gradle-wrapper.properties gradle version
Or just delete/rename your /my_projects_root_folder/gradle and restart android studio and let Gradle sync work and download required gradle.
I'm trying to import a project from GitHub and build/run it on Android Studio. I am getting the following error:
"Error:Could not create an instance of Tooling API implementation
using the specified Gradle distribution
'https://services.gradle.org/distributions/gradle-2.4-all.zip'."
I have tried the following:
Invalidate Cache and Restart
Changing the distributionURL in gradle-wrapper/properties to 2.5 etc.
Deleting build.gradle and restarting
These are ideas I got from several other posts on stackoverflow so I cannot explain why I tried these. (I'm very fairly new to Android Studio).
My build.gradle file looks like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
} }
allprojects {
repositories {
jcenter()
} }
task clean(type: Delete) {
delete rootProject.buildDir }
I was facing a similar issue, updating the Gradle version in distributionUrl solved it.
distributionUrl field is present under this directory:
project-root-directory/gradle/wrapper/gradle-wrapper.properties
Please, change
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
with
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
Then change
classpath 'com.android.tools.build:gradle:1.5.1'
with
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
It should work.
For me I think it is permission issue. From Eclipse I have also faced the same issue. On my gradle installation path (i.e. /opt/gradle) I have make it chmod as 777. So that other tool can access the same. Run the following 2 commands -
cd /opt
sudo chmod 777 -R gradle
Java versions > 9 and Gradle versions >= 5.0.0 has some code breaking changes. Here is to go around them using Eclipse. It should be similar in AndroidStudio.
Install the latest version of gradle from its distribution site
("https://services.gradle.org/distributions/") and
unzip the it on your PC.
When importing the gradle project in eclipse select the option "local installation
directory" and point to the folder where you unzip gradle.
(Bonus) if it is a LibGDX project, you need to also change the following in the Desktop
build file due to code breaking changes between gradle versions <5.0.0 and >=5.0.0.
Change "sourceSets.main.output.classesDir" to "sourceSets.main.output.classesDirs".
This is working for me and I am using LibGDX with Java 11 and Gradle 5.2.1 on Windows 10 while running Eclipse 2018-12.
Try deleting the folder gradle-2.4-all in ~/.gradle/wrapper/dists
I generated build.gradle file from eclipse and import it to android studio.
However, it returns error after "refreshing gradle" :
Gradle sync failed: Could not find com.android.tools.build:gradle-1.12
This is the classpath :
classpath 'com.android.tools.build:gradle-1.12'
This is what i have in my gradle directory :
C:\Users\user\.gradle\wrapper\dists\gradle-1.12-all
And this is what i have in gradle-wrapper.properties file in my project's root :
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-all.zip
This is the error log :
java.io.FileNotFoundException: Unable to find path to Gradle home directory
at com.android.tools.idea.gradle.util.GradleUtil.stopAllGradleDaemons(GradleUtil.java:462)
What should i do?
I have tried to use different internet connections, with/without proxy.
Thanks for your time.
Don't confuse the gradle-plugin for Android and gradle.
They are different. You can find more info about the android plugin here
With the classpath inside your gradle files, you set the version of the android plugin for Gradle.
Change your classpath using:
classpath 'com.android.tools.build:gradle:1.3.1'
instead of:
classpath 'com.android.tools.build:gradle-1.12'
In the gradle-wrapper.properties file you set the version of the Gradle. For example the 2.4 version.
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
I recommend you to use gradle 2.4, you can download it here. Then, extract the downloaded file into C:\Program Files\Android\Android Studio\gradle. After that, open File > Settings from Android Studio. On the searchbox, type gradle and search.
Open build.gradle from the main project and type classpath 'com.android.tools.build:gradle:1.3.0' under dependencies:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Finally, rebuild your project in Build > Rebuild project.