Correct way to import a Google sample Android project to Android Studio

后端 未结 3 1589
一向
一向 2020-12-31 01:32

I want to play with the sample project at http://developer.android.com/training/location/receive-location-updates.html, LocationUpdates.zip, in Android Studio.

I hav

相关标签:
3条回答
  • 2020-12-31 02:20

    Android Studio 1.5 now has it under:

    File > New > Import Sample

    Credit: @johanvs

    0 讨论(0)
  • 2020-12-31 02:21

    None of the samples have instructions for working in Android Studio yet because it's still in early-access preview, and we're waiting until it's more stable before we start reworking a lot of the documentation. You can use the project in Eclipse if you'd like to follow the directions closely.

    If you want to use Android Studio, your best bet might be to create a new empty project from scratch in Android Studio and then move the code in by hand; there isn't an import function that works well yet with the Gradle-based projects that Android Studio creates by default. If you do that, make sure you have Google Play Services and Goole Repository and Android Support Repository installed via your SDK manager, and include a dependency to Google Play Services not by adding it via a jar library in your libs folder, but by adding a Maven-style dependency to 'com.google.android.gms:play-services:3.1.36'. There are plenty of other questions on Stack Overflow that will get you going in the right direction; Gradle build fails looking for Google Play Services in Android Studio is a place to start.

    0 讨论(0)
  • 2020-12-31 02:31

    Android Studio v1.0+ now offers easy importing of the sample projects via File->Import Sample.

    Update: Since v1.3 (roughly), the option can now be found at File->New->Import sample. (Thanks to @johanvs)

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