Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 753
Poornan Avatar asked Nov 26 '22 01:11

Poornan


1 Answers

According to your issue

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

Looks like Android SDK is not configured in your project which is why it is failing to compile project in Gradle.

Try this solution:

  1. Go to your project ('/Users/user/Projects/firebaseauthui/FirebaseUI-Android/')
  2. Find local.properties file.
  3. Open that file and add this variable if it's not there

    sdk.dir=`path of your Android SDK`(it is where you've put android sdk in local storage)
    

"For more generic way, check this solution" SO answer by @Ziggy192

like image 64
Jeel Vankhede Avatar answered Nov 28 '22 13:11

Jeel Vankhede