This repository has been archived by the owner on Dec 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 167
Updated project to better support Android Studio #6
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,47 +3,36 @@ A fast way to get started with the [Google Maps Android API v2](http://developer | |
|
||
#### Current version of library dependencies: | ||
|
||
* Google Play Services, revision 7 | ||
* Android Support Library, revision 13 | ||
* Google Play Services Maps 8.4.0 | ||
|
||
# TOC | ||
|
||
* [Requirements](#requirements) | ||
* [Check out the project](#check-out-the-project) | ||
* [Eclipse](#eclipse) | ||
* [Download Eclipse](#download-eclipse) | ||
* [Import the project to your workspace](#import-the-project-to-your-workspace) | ||
* [Android Studio](#android-studio) | ||
* [Download Android Studio](#download-android-studio) | ||
* [Open the project](#open-the-project) | ||
* [Add your API key](#add-your-api-key) | ||
* [Run the app](#run-the-app) | ||
* [Troubleshooting](#troubleshooting) | ||
* [IntelliJ](#intellij) | ||
* [Download IntelliJ](#download-intellij) | ||
* [Import the project](#import-the-project) | ||
* [Add your API key](#add-your-api-key-1) | ||
* [Run the app](#run-the-app-1) | ||
* [Troubleshooting](#troubleshooting-1) | ||
|
||
# Requirements | ||
|
||
Java Development Kit (JDK) [Download](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html) | ||
Java Development Kit (JDK) [Download](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) | ||
|
||
Android SDK [Download](http://developer.android.com/sdk/index.html) | ||
|
||
# Eclipse | ||
# Android Studio | ||
|
||
## Download Eclipse | ||
Eclipse is packaged with the [Android Developer Tools bundle](http://developer.android.com/sdk/index.html) | ||
## Download Android Studio | ||
Download Android Studio (http://developer.android.com/sdk/index.html) | ||
|
||
## Import the project to your workspace | ||
1. Choose File> Import... | ||
2. Choose Android > Existing Android Code Into Workspace | ||
3. Navigate to the checked out project | ||
4. You should see two projects - "hellomap" and "google-play-services_lib". | ||
5. Ensure both are selected | ||
6. Press "Finish" | ||
## Open the project | ||
1. On the welcome screen, select "Open an existing Android Studio project" or if you have a project open, choose "File->Open..."" | ||
2. Navigate to the checked out project | ||
3. Press "Ok" | ||
|
||
## Add your API key | ||
1. Navigate to AndroidManifest.xml, under the "hellomap" project. | ||
1. Navigate to the AndroidManifest.xml file | ||
2. Click the "AndroidManifest.xml" tab, next to "Instrumentation", to see the XML view. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this line still true? (originally I meant this in terms of the "instrumentation" tab, but it looks like you've added a custom XML file with the key, so I think this whole block needs an update) |
||
3. Replace "your_api_key" with an API key generated using [these instructions](https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key) | ||
|
||
|
@@ -53,54 +42,6 @@ Eclipse is packaged with the [Android Developer Tools bundle](http://developer.a | |
|
||
## Troubleshooting | ||
### I see a grey map | ||
|
||
Follow the instructions under "Add your API key" and try again. | ||
|
||
### I see the Android starter screen | ||
1. Choose Window>Close All Perspectives | ||
2. Choose Window>Open Perspective>Other... | ||
3. Choose Java | ||
|
||
# IntelliJ | ||
## Download IntelliJ | ||
http://www.jetbrains.com/idea/download/ | ||
Choose the "Community Edition" | ||
|
||
## Import the project | ||
1. In the start up screen, choose "Open project" | ||
2. Select the checked out project, press OK | ||
|
||
## Add your API key | ||
1. Navigate to the AndroidManifest.xml file | ||
2. Replace "your_api_key" with an API key generated using [these instructions](https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key) | ||
|
||
## Run the app | ||
1. Ensure your phone is in plugged in, developer mode enabled and screen unlocked | ||
2. Choose Run>Edit Configurations... | ||
3. Press the + button | ||
4. Click "Android Application" | ||
5. Edit the name | ||
6. Choose "hellomap" as the Module | ||
7. Choose "USB Device" as your Target Device | ||
8. Press OK | ||
9. Press the green play button next to the name you specified. This will build the app, install it on the device and run it. | ||
|
||
## Troubleshooting | ||
### "Please specify Android SDK" | ||
1. Click "New..." | ||
2. Choose "Android SDK" | ||
3. Navigate to the Android SDK's "sdk" directory, press "Choose" | ||
|
||
### "No Java SDK of appropriate version found" | ||
1. Click "New..." | ||
2. Choose "JDK" | ||
3. Navigate to the JDK's home directory. For OS X, this is at `/Library/Java/JavaVirtualMachines/jdk.../Contents/Home` | ||
4. Press "Choose" | ||
5. If you are prompted with "Set up created SDK on project?", press No. | ||
6. Follow the instructions above | ||
7. If you are prompted with "Set up created SDK on project?", press Yes. | ||
|
||
### I see a grey map | ||
Follow the instructions under "Add your API key" and try again. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps add a line here suggesting that the developer should also keep an eye on the logcat output, as the API will often provide extra information there, e.g. if the cert/key aren't set up correctly. |
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
|
||
defaultConfig { | ||
applicationId "com.example.hellomap" | ||
minSdkVersion 9 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-project.txt') | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile 'com.google.android.gms:play-services-maps:8.4.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<resources> | ||
<!-- | ||
TODO: Before you run your application, you need a Google Maps API key. | ||
|
||
To get one, follow this link, follow the directions and press "Create" at the end: | ||
|
||
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID | ||
|
||
Follow the directions here: | ||
https://developers.google.com/maps/documentation/android/start#get-key | ||
|
||
Once you have your key, replace the "google_maps_key" string in this file. | ||
--> | ||
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">your_api_key</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- TODO: Replace "com.example.hellomap" with your desired package name --> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.hellomap" | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
|
||
<application | ||
android:label="@string/app_name" | ||
android:icon="@drawable/ic_launcher"> | ||
|
||
<!-- | ||
The API key for Google Maps-based APIs is defined as a string resource. | ||
(See the file "res/values/google_maps_api.xml"). | ||
Note that the API key is linked to the encryption key used to sign the APK. | ||
You need a different API key for each encryption key, including the release key that is used to | ||
sign the APK for publishing. | ||
You can define the keys for the debug and release targets in src/debug/ and src/release/. | ||
--> | ||
<meta-data | ||
android:name="com.google.android.geo.API_KEY" | ||
android:value="@string/google_maps_key"/> | ||
|
||
<activity | ||
android:name="MainActivity" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,19 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:0.4.2' | ||
} | ||
} | ||
|
||
apply plugin: 'android' | ||
classpath 'com.android.tools.build:gradle:2.0.0' | ||
|
||
dependencies { | ||
compile 'com.google.android.gms:play-services:3.1.36' | ||
compile 'com.android.support:support-v4:13.0.0' | ||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
} | ||
} | ||
|
||
android { | ||
compileSdkVersion 17 | ||
|
||
buildToolsVersion "17.0.0" | ||
|
||
sourceSets { | ||
main { | ||
manifest.srcFile 'AndroidManifest.xml' | ||
java.srcDirs = ['src'] | ||
res.srcDirs = ['res'] | ||
} | ||
allprojects { | ||
repositories { | ||
jcenter() | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Apr 10 15:27:10 PDT 2013 | ||
#Mon Dec 28 10:00:20 PST 2015 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ':app' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section doesn't look right for Android Studio. in the default 'Android' view, the manifest is under 'Application -> manifests'