Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Finally I managed to run GoogleMapsAPIv2 project using Android Studio.</p> <p><strong>EDIT: As mentioned by Xavier, this method is going to work for non-gradle based projects only. And UI part which was used in this tutorial will be excluded from AndroidStudio. So if you have your own project which uses Gradle build system, you need to manually modify build.gradle configuration file since Android Studio UI doesn't affect it.</strong> </p> <p><strong>EDIT2: With AndroidStudio v0.1.1 release, UI part responsible for modules dependencies has been eliminated, so for now we need to update dependencies manually through build.gradle file. UI for changing gradle dependencies is going to be released in next releases</strong></p> <p><strong>EDIT3: For those who still tries to use this approach - please note that it is obsolete and doesn't work anymore</strong></p> <p>Here is what I did:</p> <p>1) I took <code>maps</code> project from the Google Play Services samples and copied that to the separate directory. That is going to be our MapsApiV2 project we will be trying to run. On my Mac it was located at <code>&lt;sdk_location&gt;/extras/google/google_play_services/samples</code> I placed it to the <code>~/Work/stack/</code></p> <p>2) Copied <code>google-play-services_lib</code> project directory to the same place (<code>~/Work/stack</code>), so my working directory looks like this. Btw, lib project is located at <code>&lt;sdk_location&gt;/extras/google/google_play_services/libproject</code>: <img src="https://i.stack.imgur.com/M8SNq.png" alt="enter image description here"></p> <p>3) Now let's open Android Studio. On welcome screen press <code>Import Project</code> and import our <code>maps</code> project from <code>~/Work/stack/maps</code>. Now we see a lot of complaints about unknown reference to GMS library:</p> <p><img src="https://i.stack.imgur.com/Xe7iL.png" alt="enter image description here"></p> <p>4) Now we need to add Google Play Service as a reference library. Going to <code>View -&gt; Open Module Settings</code></p> <p>5) On the <code>Modules</code> tab, click <code>+</code> button and select <code>Import Module</code> and import your GooglePlayServices lib. I didn't change anything in the wizards, so clicked <code>Next</code> all the way to the end:</p> <p><img src="https://i.stack.imgur.com/zBnde.png" alt="enter image description here"></p> <p>6) Now you need to reference this imported library. Open this screen again (go to <code>View -&gt; Module Settings</code>). Make sure you have your <code>maps</code> project and <code>Dependency</code> tab selected. Click <code>+</code> to add a dependency and select <code>Library</code>. Choose your imported library there:</p> <p><img src="https://i.stack.imgur.com/vFGD3.png" alt="enter image description here"></p> <p>7) Now we can see that it is not complaining about <code>GMS</code> library, but still complaining about support library:</p> <p><img src="https://i.stack.imgur.com/MStze.png" alt="enter image description here"></p> <p>8) Let's fix it. I have my support library located at <code>&lt;sdk location&gt;/extras/android/support/v13/android-support-v13.jar</code>. So let's try to add it to our workspace. Go to <code>View -&gt; Open Module Settings</code> and select <code>Libraries</code> tab. Select <code>+</code> -> <code>Java</code> and select support library:</p> <p><img src="https://i.stack.imgur.com/0h6Fn.png" alt="enter image description here"></p> <p>9) Now it is going to ask you which project to add this lib to, so make sure you have selected your <code>maps</code> project:</p> <p><img src="https://i.stack.imgur.com/HMMr7.png" alt="enter image description here"></p> <p>10) At this point code should compile w/o problems. Just make sure you are targeting the right SDK version in Manifest.</p> <p>Have fun</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload