I am able to run the project successfully. but unable to resolve this issue which is showing "kotlin Not Configured". I tried every solution for that but its always showing in the currently active file.
Please help.
Delete the .gradle and .idea file and restart the project. This seem to work for me.
Click on Tools -> Kotlin -> Configure Kotlin in Project
then choose the configurator, any one from:
Java with Gradle
Android with Gradle
try to upgrade the kotlin version in build.gradle file
ext.kotlin_version = '1.3.72'
also in the build.gradle app module file make sure implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
in the dependencies section ,
if you see at any time update the gradle option , do so
Furthermore, if you find a line
implementation "androidx.core:core-ktx:+"
in your build.gradle, you may see the warning message:
Avoid using + in version numbers, can lead to unpredictable and anrepeatable builds.
Click on "Replace with specific version", then the current installed version replaces the "+". (For example, "1.3.2")
In my case the "kotlin not configured" message and a lot of "errors" in the kotlin file disappeared.
Simply hitting "Sync Project with Gradle Files" did the job for me.
In my case, it can fix by keep the version of kotlin-gradle-plugin up to date. Check the version here: https://kotlinlang.org/docs/gradle.html#plugin-and-versions
File for configuration Location
Project -> build.gradle
//example: update this dependence:
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10"
}
I faced the same issue after updating to latest android electric eel. So those of you who had a kotlin project which working fine and after update failed to sync gradle files or build projects with error
"Kotlin not configured".
I think this answer might help. I'm not sure if this is the right way to do but this was a life saver for me since I was working with an old project with older dependencies and kotlin version
Just click on the gradle offline toggle and try syncing the project and building it in offline mode. That's it !!!
No need to change any version or other changes. I hope this helps and save your time.
Related
I have a problem: My android studio is analyzing infinitely:
I have tried:
uninstalling Android Studio
Invalidate cashes / Restart
restart my computer.
build.gradle (Project)
build.gradle (Module)
Main Activity (Analyzing text top right corner)
What can I do?
You just need to Upgrade the latest kotlin version.
Upgrade the dependency in the project's build.gradle file.
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10"
Upgrade the dependency in the app's build.gradle file.
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.10"
Finally, I fully deleted my android studio with all connected files using this answers and then reinstalled its new stable (the same 4.2.1. version). The problem was solved.
I was also facing the same issues.
I Follow below step:
Close Project
Delete all “.idea” & ".gradle” folder
Want to solve this problem, you need to download the kotlin plugin with the version 202-1.5.0-release-764-AS8194.7 at this website https://plugins.jetbrains.com/plugin/6954-kotlin/versions, then install it.
I'm having the following error message when trying to do refactor -> migrate to AndroidX
The gradle plugin version in your project build.gradle file needs to
be set to at least com.android.tools.build:gradle:3.2.0 in order to
migrate to AndroidX
Although I have version higher specified in build.gradle...
app/android/build.gradle
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
I have another app/android/app/build.gradle.
I solved it by changing version to 3.4.1 and back to 3.4.2.
now error is gone..
in my case,
apply
classpath("com.android.tools.build:gradle:4.0.1")
instead of
classpath("com.android.tools.build:gradle:${version.gralde}") -> even version.gralde is 4.0.1
:thinking :) maybe android studio can't identity the plugin version if it references to an external value
Only change gradle version of a project may be not enough. Please also check gadle versions of the dependies. Make sure every gradle version of a depency is beyond 3.2.0. Have a try, please.
In order to maintain the version numbers of my gradle dependencies, I chose the below pattern.
In my project level build.gradle I added:
ext.versions = [
'kotlin_version' : '1.2.30',
'dagger' : '2.16'
]
And in my app module's build.gradle I added:
implementation "com.google.dagger:dagger:${versions.dagger}"
implementation "com.google.dagger:dagger-android-support:${versions.dagger}"
implementation "com.google.dagger:dagger-android:${versions.dagger}"
kapt "com.google.dagger:dagger-compiler:${versions.dagger}"
kapt "com.google.dagger:dagger-android-processor:${versions.dagger}"
But my problem is after doing this, I lost the lint warnings of "Newer Library versions available".
What is the correct way to do this without missing the lint checks?
Note: I have also tried other ways like moving these versions to gradle.properties file (for global variables).
I am looking for a solution inside Android Studio. There is one solution which I already found:
Analyze -> Run Inspection by name... -> Type "Newer Library Versions Available"
But my concern is, it is easy to miss on updates until we run some or the other script. That is why I am trying to find a way where dependency versions can be put in a variable and get lint warning for new updates.
See this answer: https://stackoverflow.com/a/46296198/2053763
There is a link to a gradle plugin which can check for dependency updates.
Android Studio 3.1.2 offers some lint checks while using version variables, but still misses some of the updates. See image below:
You can extract dependencies versions into variables stored in a separate Gradle file and then check and update them from the Project Structure (ctrl+alt+shift+S) (screenshot from Android Studio 3.6.3):
Is there a way to reset the default gradle and plugin, without resetting all my settings, so I don't keep having these errors when creating new projects?
Error: Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to
So in the top level build.gradle I update to:
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
}
And then change the gradle to 2.10 as per requirements here.
2.0.0-alpha5 (2016/1/14) // hence alpha6
Needs gradle 2.10 to work
I think you need to follow below step to use Default gradle wrapper(recommended):
Android studio -> Settings -> build tools -> gradle -> Project-level settings -> select Use default gradle wrapper(recommended).
And sync gradle and rebuild your project.
See Below image to get more idea:
It's work for me. I hope its helps you.
Android Studio Template Files located on below path:
{android_studio_installation_path}\plugins\android\lib\templates\
Now for editing every type of Android Studio Template Project you must edit respective file
For Example: (edit android studio new project template)
we must edit below files:
{above_path}\gradle-projects\NewAndroidModule\root\build.gradle.ftl
In this file you must add dependencies that you want to add in every project that you create it, inside the block of dependencies
dependencies {}
Hope my description has been helpful
i just switched to intellij and pretty new to android development.. I've been working on one app for 5 moth and now that i moved it to intellij android studio my options menus became invisible. I've been reading a lot and trying to catch up with newest features that are available now today.
By biggest pain is that im hitting this error ->
Failed to refresh Gradle project 'ActionBarCompat-ListPopupMenu' You are using Gradle version 1.8, which is not supported. Please use version 1.9. Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (
I did search on this problem and some pages suggesting changing classpath to soething like
build:gradle:0.7.+ but that doest help..
What am i doing wrong? All i need is just to make those examples from android to work..
Thanks
The Gradle wrapper file is at the path (project-root)/gradle/wrapper/gradle-wrapper.properties. The distributionUrl property is where you set the Gradle version; it's embedded in the URL:
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
First make sure you've updated to the newest Android SDK Build-tools version, the most current one is 19.0.3; if you haven't, then open the Android SDK manager and update.
Then look in the build.gradle file inside your project folder (not the one in the root folder). This first couple of lines should resemble something like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
Set the class path to com.android.tools.build:gradle:0.9.+.
Then further along in the same file:
android {
compileSdkVersion 18
buildToolsVersion "19.0.3"
...
}
Set buildToolsVersion to 19.0.3 (the newest version).
Make sure Android Studio syncs the Gradle file changes. If it doesn't, restart Android Studio and/or rebuild the project. Then you should be good to go.
I think i figured this out.. Big thanks to Scott and Jaap.
I did updateof my intellij to 0.5.2, also i installed 19.0.3 ( newest build tools).
On few of the existing projects i had to change distributionUrl to
distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip
After rebuilding the project it worked like a charm.
Just a note to say : Scorr Berba's reply was probably the correct one. Also I'm not sure 1.11 can be used - I used the wrapper (there is a lot of confusion here : the wrapper is the gradlew ["gradle*w*"rapper] to set the gradle used for my samples to 1.10 and you must set up your project to use the wrapper OR you can build from the command line e.g "./gradlew build".