Android-Studio import of simple project fails #1166
Comments
Is there any way to fix this? |
After updating the wrapper to Gradle 4.10.2 with
|
@bamboo where do you get the At least using gradle-wrapper 4.10.2 didn't change anything for me |
Has there been any progress on this issue? Since I converted one of our projects to the Kotlin DSL none of my co-workers are able to open the project properly. Neither am I when I try to open a fresh clone of the project. It does work, however, when I make a copy of the whole project folder, so I am assuming that there must be something inside the folder (but not in Git) that makes it work. But I am afraid I don't know where to look - with a quick look at the |
@daberni: I think I am able to consistently get this to work (with your example project and with my own project) when I do the following (thanks to this answer to my Stack Overflow Question) 1.) Clone the project Can you confirm this? In this case, the only problem is that I want some files in my |
I was able to make it work with @DavidMihola’s solution, but I had to recreate the Android app configuration afterwards. Other than that and the lost .idea files, everything is fine. |
@DavidMihola worked for me. @rcosteira79 is also right, I had to create the "app" configuration manually. |
Just started testing it again and all the suggested work arounds didn't work as expected too. Android Studio doesn't recognize the project as "Android" project and then fails when trying to configure the android gradle tasks. Either What is working at the moment is an It is still not comparable with standard groovy style Furthermore it SHOULD not make a difference when there are some files in the |
This effectively reverts 6fa1abe Android Studio in the current stable version (3.3) is not able to recognize imported projects that use Gradle Kotlin DSL as Android projects. I am not sure if it is a problem in Android Studio or Kotlin DSL. There is a bug report in the Kotlin DSL repo here: gradle/kotlin-dsl-samples#1166 Unfortunately none of the workarounds reported above worked for me. The only way to import the project was to: 1) Checkout the latest commit that used the Groovy DSL 2) Import the project in Android Studio 3) Checkout master This is of course unnaceptable for any potential contributors, therefore for now we are reverting to Groovy DSL. However, we keep the gradle files in the format that allows swift conversion to Kotlin once the problem described above is solved.
This effectively reverts 6fa1abe Android Studio in the current stable version (3.3) is not able to recognize imported projects that use Gradle Kotlin DSL as Android projects. I am not sure if it is a problem in Android Studio or Kotlin DSL. There is a bug report in the Kotlin DSL repo here: gradle/kotlin-dsl-samples#1166 Unfortunately none of the workarounds reported above worked for me. The only way to import the project was to: 1) Checkout the latest commit that used the Groovy DSL 2) Import the project in Android Studio 3) Checkout master This is of course unnaceptable for any potential contributors, therefore for now we are reverting to Groovy DSL. However, we keep the gradle files in the format that allows swift conversion to Kotlin once the problem described above is solved.
Due to a bug related to android projects in kotlin-dsl - gradle/kotlin-dsl-samples#1166
Due to a bug related to android projects in kotlin-dsl - gradle/kotlin-dsl-samples#1166
Closing as outdated, the Gradle Kotlin DSL 1.0 shipped with Gradle 5.0. The sample project uses Gradle 4.6. |
updated the sample project to Gradle 5.1.1, plugins and kotlin to latest version and works now as expected in Android Studio 3.5 Canary 11 👍 |
After creating a new simple Android project and converting it to kotlin-dsl afterwards, an import of this project with Android Studio (or IntelliJ) fails with different errors depending on how it's imported (Gradle, or Android Gradle). I found no way how this can be done without any errors.
Expected Behavior
Importing the project happens without errors and project compiles therefor.
Current Behavior
IntelliJ doesn't recognize the android project and no local.properties file is created with location to the android-sdk
Although I get the message:
and clicking on
Configure
results in a dialog sayingNo Frameworks detected
Android Studio behaves the same when importing with
Gradle
and notAndroid Gradle
Android Studio imports the project by creating a new empty
build.gradle
file without recognizing the existence of thebuild.gradle.kts
and settings file. The project is then not recognized as an android project and build fails again. When deleting thebuild.gradle
file everything works fine again.Steps to Reproduce (for bugs)
Checkout repo: https://github.com/daberni/gradle-kotlin-dsl-android-failed
Try to import the project with Android Studio (or IntelliJ)
Your Environment
Android Studio 3.2
Intellij 2018.2.4
Kotlin Plugin: 1.3.0-rc-116
The text was updated successfully, but these errors were encountered: