SDK Location not found Android Studio + Gradle

后端 未结 13 2260
北荒
北荒 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:50

    In my specific case I tried to create a React Native app using the react-native init installation process, when I encountered the discussed problem.

    FAILURE: Build failed with an exception.
    
    * What went wrong:
    
    A problem occurred configuring project ':app'.
    > SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\***\android\local.properties'.
    

    I add this, because when developing an android app using react native, the 'root directory' to which so many answers refer, is actually the root of the android folder (and not the project's root folder, where App.js resides). This is also made clear by the directory marked in the error message.

    To solve it, just add a local.properties file to the android folder, and type:

    sdk.dir=C:/Users/{user name}/AppData/Local/Android/Sdk
    

    Be sure to add the local disk's reference ('C:/'), because it did not work otherwise in my case.

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