Android Studio Gradle dont want to sync - android

This is first time using Android Studio. and found problem said that
Build file 'C:\Users\anauf\AndroidStudioProjects\Modul1_Kel20_1\build.gradle' line: 8
A problem occurred evaluating root project 'Modul1_Kel20_1'.
Could not find method implementation() for arguments [androidx.appcompat:appcompat:1.2.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
as shown here
i've delete and re download the gradle, but the erorr still remain. anyone can help me please?

Please make sure your Gradle version is 3.*.* or higher before using "implementation"
Open the project level Gradle file
dependencies{
classpath 'com.android.tools.build:gradle:3.1.2'
}
Open the 'gradle-wrapper.properties' file and set the distributionUrl:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
or any latest version. And finally Sync the project.

Related

Android studio showing error,gradle file,please find the solution,it shwing some find of error

When I sync my project in Android Studio, I got this error
ERROR: Cause: https://downloads.gradle-dn.com/distributions/gradle-3.4.2-all.zip
I think you have added wrong dependency package.
So Go to gradle > wrapper > gradle-wrapper.properties and checkout your "distributionUrl" has the correct value or not.
You have added a wrong package gradle-3.4.2-all.zip. try changing it to gradle-4.10.2-all.zip
I hope this helps.
Don't confuse gradle with the Android Gradle plugin.
classpath 'com.android.tools.build:gradle:3.4.2'
It is the Android Gradle plugin.
Check the release notes for other versions.
The gradle version is defined in gradle/wrapper/gradle-wrapper.properties.
Use:
distributionUrl = https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

ANDROID STUDIO 3.0 upgrade : Error:Could not resolve all files for configuration ':app:xxxxxxxDebugCompileClasspath'

I found this warning after upgrading the latest android studio stable version
Error:Could not resolve all files for configuration ':app:xxxxxxxDebugCompileClasspath'.
Failed to transform file 'commons-lang-2.4.jar' to match attributes {artifactType=android-classes} using transform JarTransform
Transform output file xxxxxxx/xxxxxxx/xxxxxxx/app/commons-lang-2.4.jar does not exist.
here is gradle and gradle wrapper versions :
gradle : classpath 'com.android.tools.build:gradle:3.0.0'
and
gradle wrapper :
distributionUrl=https\://services.gradle.org/distributions/g‌​radle-4.1-all.zip
change dependency declaration
from
compile files('libs/commons-lang-2.4.jar')
to
implementation files('libs/commons-lang-2.4.jar')
I had the same problem, build -> clean project worked for me.
Change the classpath of Project Gradle to:
classpath 'com.android.tools.build:gradle:3.1.0-alpha01'
OR
change distributionUrl of gradle-wrapper.properties to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Hope it helps you
I had same problem , googled a lot but nothing worked. Following worked for me on Android 4.2.1
Go to File -> Manage IDE Settings -> Restore IDE Settings
Then follow the instructions.

Gradle sync failed: Access is denied

I have installed Android studio and i have created the new project but it is giving me the error:
Gradle 'MyApplication2' project refresh failed
Gradle sync failed: Access is denied
I have also run android studio as an administrator but it did not work. Please help me with this. How can I build the gradle and run the project.
I have had a similar issue recently when the gradle plugin release was updated to 5.1.1. which caused an error message "apollo\generatedIR\debug (Access is denied)".
In order to fix this I had to revert back to the previous gradle version which was 3.3.2 and I had to make sure that the zip file that is downloaded when the project syncs matched the 3.3.2 version.
Here is where to check the versions of the gradle builds: https://developer.android.com/studio/releases/gradle-plugin
The changes I made where:
In the gradle (project) file change the classpath plugin to the previous version:
classpath 'com.android.tools.build:gradle:3.3.2'
Then in the gradle-wrapper.properties file change the distributionUrl to match the required gradle version.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Then resync your project. If it doesn't work double check your gradle files by going to the C:Users//.gradle/wrapper/dists folder and it should match the version on the web page above.
if there is permission related issue. Then you can change the gradle path from C to D drive. it will fix the issue
Go to your project folder right click ->Properties->under Security tab on it check permission and allow all permissions.

Android Studio installation doesn't work with gradle

I am absolute beginner with Android Studio (especially Gradle) and having big trouble getting Android Studio to work. I downloaded and installed the most recent version of Android Studio (0.8.0). I have set the JDK_HOME variable. However, after I create a new project, I always receive the following message:
Error:Unknown host 'jcenter.bintray.com'.
Enable Gradle 'offline mode' and sync project.
Learn about configuring HTTP proxies in Gradle
If I try to compile the project, I get the following message dialog:
After reading a post, I manually downloaded the Gradle binaries (latest, 2.0), extracted it onto the local drive, went to Settings and set the Gradle path to the respective directory using the following:
I also tweaked the build.gradle file under the project to point to the latest Gradle 2.0 version. However, now I get the following error message:
Error:A problem occurred configuring root project 'HelloAndroidStudio'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.0.+.
Required by:
:HelloAndroidStudio:unspecified
Failed to list versions for com.android.tools.build:gradle.
Unable to load Maven meta-data from http://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml.
Could not GET 'http://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml'.
jcenter.bintray.com
Please can someone help. Being my first time with Gradle, I have been trying for so many days without any clue to the problem. Thanks.
Change the Gradle version to lower ones and restart the Android Studio, you may get it.
Add this in build.gradle
classpath 'com.android.tools.build:gradle:1.1.0'
Setting the http_proxy under appearance & behaviour -> system settings -> http proxy has solved the problem
Change to the latest classpath in the dependencies.
For AS 1.5.1 I will do like this :
buildscript {
repositories {
jcenter()
}
dependencies {
**classpath 'com.android.tools.build:gradle:1.5.0'**
}
}

Android Studio 0.4.3 - Unable to compile official Android Samples

I've got Android Studio 0.4.3 installed on my system and try to import and run the official samples from the Android Developers site:
http://developer.android.com/samples/index.html
Unfortunately when I try to compile I get the following error:
FAILURE: Could not determine which tasks to execute.
What went wrong: Task 'assemble' not found in root project 'ActionBarCompat-Basic'.
Try: Run gradle tasks to get a list of available tasks.
As you can see I tried to compile the ActionBarCompat-Basic example, but the result is the same for all samples.
I already tried to delete the <component name="FacetManager"> ... </component>
from my iml file and deleted the .idea folder like suggested in this thread:
Gradle: FAILURE: Could not determine which tasks to execute
This did not solve the problem. After removal of the files I imported the project to Android Studio and tried to compile. As a consequence the iml file and the .idea folder are generated again and the error message stays the same.
Anyone else got this problem? Any help is greatly appreciated!
Sample projects are using old version of gradle plugin which is no longer supported by Android Studio 0.4.3
Please do the following changes
Go to your module's build.gradle(like ActionBarCompat-BasicSample/build.gradle) file inside the project and replace dependency classpath at beginning by this
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
Change the distrubutionUrl in ActionBarCopat-Basic/gradle/gradle-wrapper.properties file to this
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
If you are using gradle version 1.10 replace 0.7.+ to 0.8.+ and 1.9 to 1.10 in above configurations .
I am assuming you have already removed component FacetManager from ActionBarCopat-Basic.iml file and re-imported the project.
This worked perfectly for me.

Categories

Resources