Search code examples
androidandroid-studiofirebaseuigradle-kotlin-dsl

Could not import project 'FirebaseUI-Android'


I tried importing via import project wizard, didn't work. This project is using Gradle Kotlin DSL. I am using Android Studio 3.1.4.

I tried running gradle idea and got this message

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/user/Projects/firebaseauthui/FirebaseUI-Android/build.gradle.kts' line: 400

* What went wrong:
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

What is the recommended way to import this project as they have migrated to Kotlin DSL?

This has been reported on GitHub Repository. Still I have issue importing.

A note on importing the project using Android Studio: Using 'Project from Version Control' will not automatically link the project with Gradle (issue #1349). When doing so and opening any build.gradle.kts file, an error shows up: Project 'FirebaseUI-Android' isn't linked with Gradle. To resolve this issue, please git checkout the project manually and import with Import from external model.

screenshot of the issue


Solution

  • I did update the Android Studio, current version

    Android Studio 3.1.4 Build #AI-173.4907809, built on July 24, 2018 JRE: 1.8.0_152-release-1024-b01 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.13.6

    I did update Kotlin plugin, current version

    Version: 1.2.70-release-Studio3.1-1

    Still I could not import from Version Control- GitHub.

    Manual git checkout then open build.gradle.kts with Android Studio did solve the issue.

    success screenshot