SDK Location not found Android Studio + Gradle

后端 未结 13 2258
北荒
北荒 2020-12-08 04:09

I have seen this same thing posted quite a few times, but whenever I try to import my project to my new work laptop I keep getting this error.

I have pulled the proj

相关标签:
13条回答
  • 2020-12-08 04:32

    If none of the answers work for you which happened to me on macbook pro in one of the projects you can always try to run Android Studio with an alias command passing sdk.dir with each run:

    alias studio='launchctl setenv ANDROID_HOME '\''/Users/username/Library/Android/sdk'\'' && open -a '\''Android Studio'\'''
    
    0 讨论(0)
  • 2020-12-08 04:32

    To fix this problem, I had to define the ANDROID_HOME environment variable in the Windows OS.

    To do this, I went to the System control panel.
    I selected "Advanced system settings" in the left column.
    On the "Advanced" tab, I selected "Environment Variables" at the bottom.

    Here, I did not have an ANDROID_HOME variable defined. For this case, I selected "New..." and:
    1) for "Variable name" I typed ANDROID_HOME,
    2) for "Variable value", I typed the path to my SDK folder, e.g. "C:\...\AppData\Local\Android\sdk".

    I then closed Android Studio and reopened, and everything worked.

    Thanks to Dibish (https://stackoverflow.com/users/2244411/dibish) for one of his posts that gave me this idea.

    0 讨论(0)
  • 2020-12-08 04:34

    You have also to ensure you have the correct SDK platform version installed in your environment by using SDK Manager.

    0 讨论(0)
  • 2020-12-08 04:37

    Copy and paste the local.properties file from a project you created on your new computer to the folder containing the project from your old computer also works too if you don't want to (or know how to) create a new local.properties file.

    0 讨论(0)
  • 2020-12-08 04:40

    Had the same problem in IntelliJ 12, even though I have ANDROID_HOME env variable it still gives the same error. I ended up creating local.properties file under the root of my project (my project has a main project w/ a few submodules in its own directories). This solved the error.

    0 讨论(0)
  • 2020-12-08 04:40

    I clone libgdx demo, can't import project. it also reminds like this.

    Env:
    
    Eclipse(Android-ADT)
    
    window 7
    

    so I create local.properties file at the project root, like following

    sdk.dir = D:/adt-bundle-windows-x86/sdk
    

    I hope this can help others!

    0 讨论(0)
提交回复
热议问题