When I switch in an Android project with
classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
to
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50"
I run into
What went wrong:
Some problems were found with the configuration of task ':detector:kaptDebugKotlin'.
Directory '~/project/build/intermediates/feature_data_binding_base_feature_info/debug/dataBindingExportFeaturePackageIdsDebug/out' specified for property 'annotationProcessorOptionProviders$kotlin_gradle_plugin.$0.$0.baseFeatureInfoDir' does not exist.
Directory '~/project/build/intermediates/feature_data_binding_base_feature_info/debug/dataBindingExportFeaturePackageIdsDebug/out' specified for property 'databinding.baseFeatureInfoDir' does not exist.
with classpath 'com.android.tools.build:gradle:3.1.3' it works properly
This issue will be fixed in Android Gradle plugin 3.2.0-beta02
Change-Id: I7b7977845e5dee13240f2b0422ccc270513cade9
Related
after changing gradle android plugin version to 3.2.1
classpath 'com.android.tools.build:gradle:3.2.1'
I received such build error:
Task with name 'mockableAndroidJar' not found in project ':app'.
Invalidate cache and restart doesn't help
Happened to me too, fixed by upgrading Android Studio to version 3.2.1
Seems like they've changed the gradle task name from mockableAndroidJar to createMockableJar
How can I resolve this error :
Android Studio : 3.1.4
Gradle version : 4.4
Android Plugin Version : 3.1.4
What went wrong:
A problem occurred configuring root project 'myApplication'.
> Failed to notify project evaluation listener.
> com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)
Can I use Old Gradle(4.4) and Android Plugin version(2.14.1) with new Android Studio (3.1.4) as my current project is using this.
Try deleting build folder in root and project repo, Also try removing gradle cache folder may be it helps. usually it happens because there are some corrupt files in root folder
Update the gradle-wrapper.properties file
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
and Root Project Dependencies
dependencies {
//Gradle dependencies
classpath 'com.android.tools.build:gradle:3.1.4'
// Kotlin if use kotlin your project
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Using the latest Android Studio 3.0 Canary 5
Here's the error:
Error:(1, 1) A problem occurred evaluating project ':app'.
Failed to apply plugin [class 'com.android.build.gradle.api.AndroidBasePlugin']
Android Gradle plugin 3.0.0-alpha5 must not be applied to project [path_to_my_project] since version 3.0.0-alpha5 was already applied to this project
Tried: cleaning, rebuilding, opening/closing. Not working.
any ideas ?
[LATER EDIT]
Solution: Migrate to Canary 8+ and all should be ok.
From this reddit thread, killing daemons fixed the problem for me.
./gradlew --stop
This worked for me:
Deactivate Configuration On Demand
In gradle.properties:
org.gradle.configureondemand=false
Then stop the daemon in a terminal window:
gradlew.bat --stop
Now everything works again.
Versions used:
Android Studio 3.0 Canary 5
gradle: gradle-4.1-milestone-1
android gradle plugin: com.android.tools.build:gradle:3.0.0-alpha5
UPDATE
After upgrading to Android Studio 3.0 Beta 2 I can reactivate Configuration on Demand and everything works fine.
Migrating the gradle version from 3.0.0-alpha5 to 3.0.0-alpha7 saved my day !!
I got the issue and realized the issue related with caches.
You have to invalidate caches of Android studio by select File-> Invalidate Caches/Restart.
It worked for me. The issue was resolved.
Open a terminal and write
./gradlew --stop
In gradle.properties make sure you don't have funny stuff
Notice that there are no custom jvmargs...
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=false
Include the google() repo in build.gradle (project one)
there's how mine look like
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
maven { url "http://objectbox.net/beta-repo/" }
}
dependencies {
classpath 'io.objectbox:objectbox-gradle-plugin:0.9.12.1'
classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
jcenter()
google()
maven { url "http://objectbox.net/beta-repo/" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
lastly the support library versions in the app build.gradle file
build.gradle
...
//----- Support Libs
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
implementation "com.android.support:design:26.0.0-beta2"
implementation "com.android.support:recyclerview-v7:26.0.0-beta2"
implementation "com.android.support:cardview-v7:26.0.0-beta2"
...
I had the same issue, I closed Android Studio and opened again, I noticed that it automatically applied these changes to the following files and everything worked fine:
build.gradle: changed the class path of Gradle from:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
to
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
}
gradle-wrapper.properties: from
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
I already tried all the solutions including
Clean,
Rebuild,
Invalidate Project
But nothing is working but i figured it out.
For temporary just downgrade your gradle plugin version to stable version
classpath 'com.android.tools.build:gradle:2.3.2'
Replace your alpha line with this line. And have fun.. :)
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 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.