Skip to content

Commit 12cb7b9

Browse files
Capstanejona86
authored andcommitted
Update Android samples for Android Studio 1.2.1.1
https://codereview.appspot.com/241880043/
1 parent af27369 commit 12cb7b9

File tree

8 files changed

+67
-34
lines changed

8 files changed

+67
-34
lines changed

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
*/target
2+
*/proguard
3+
*/gen
4+
.gradle/**
5+
gradle/**
6+
gradlew*
7+
*.iml
8+
*/*.iml
9+
.idea
10+
*/.idea
11+
*/.gwt
12+
build
13+
*/build
14+
*/bin
15+
*/war/WEB-INF/appengine-generated
16+
**/local.properties

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
}
55

66
dependencies {
7-
classpath 'com.android.tools.build:gradle:0.5.+'
7+
classpath 'com.android.tools.build:gradle:1.2.+'
88
}
99
}
1010

calendar-android-sample/AndroidManifest.xml

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
</activity>
3030
<activity android:name=".AddOrEditCalendarActivity" >
3131
</activity>
32+
<!-- The following is necessary if you're not using AndroidStudio.
33+
See http://developer.android.com/google/play-services/setup.html -->
34+
<meta-data
35+
android:name="com.google.android.gms.version"
36+
android:value="@integer/google_play_services_version" />
3237
</application>
3338

3439
</manifest>

calendar-android-sample/build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ dependencies {
99
compile 'com.google.apis:google-api-services-calendar:v3-rev87-1.19.0' exclude module: 'httpclient'
1010
compile 'com.google.api-client:google-api-client-android:1.19.0' exclude module: 'httpclient'
1111
compile 'com.google.http-client:google-http-client-gson:1.19.0' exclude module: 'httpclient'
12-
compile 'com.google.android.google-play-services:google-play-services:1'
12+
compile 'com.google.android.gms:play-services-identity:7.3.0'
1313
}
1414

1515
android {
16-
compileSdkVersion 8
17-
buildToolsVersion "18.0.1"
16+
compileSdkVersion 22
17+
buildToolsVersion "22.0.1"
1818

1919
defaultConfig {
20-
minSdkVersion 8
21-
targetSdkVersion 8
20+
minSdkVersion 11
21+
targetSdkVersion 22
2222
}
2323

2424
sourceSets {
@@ -30,7 +30,7 @@ android {
3030

3131
buildTypes {
3232
release {
33-
runProguard true
33+
minifyEnabled true
3434
proguardFile 'proguard-google-api-client.txt'
3535
proguardFile getDefaultProguardFile('proguard-android.txt')
3636
}

calendar-android-sample/instructions.html

+13-10
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@ <h3>Browse Online</h3>
1515

1616
<ul>
1717
<li><a
18-
href="http://code.google.com/p/google-api-java-client/source/browse?repo=samples#hg/calendar-android-sample">Browse
18+
href="https://github.com/google/google-api-java-client-samples/tree/master/calendar-android-sample">Browse
1919
Source</a>, or main file <a
20-
href="http://code.google.com/p/google-api-java-client/source/browse/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarSampleActivity.java?repo=samples">CalendarSampleActivity.java</a>
20+
href="https://github.com/google/google-api-java-client-samples/tree/master/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarSampleActivity.java">CalendarSampleActivity.java</a>
2121
</li>
2222
</ul>
2323

2424
<h3>Prerequisites</h3>
2525

2626
<ul>
2727
<li>Install <a href="http://java.com">Java</a> (requires 6 or higher)</li>
28-
<li>Install <a href="http://mercurial.selenic.com/">Mercurial</a> (requires 1.6 or higher).</li>
29-
<li>Unzip <a href="http://services.gradle.org/distributions/gradle-1.6-bin.zip">Gradle
30-
1.6</a></li>
28+
<li>Install <a href="http://git-scm.com/downloads">Git</a> (suggested 1.7.10 or higher)
29+
or <a href="http://github.com">GitHub</a> client (<a href="http://mac.github.com/">Mac</a>)
30+
(<a href="http://windows.github.com/">Windows</a>)</li>
31+
<li>Unzip <a href="http://services.gradle.org/distributions/gradle-2.2.1-bin.zip">Gradle
32+
2.2.1</a></li>
3133
<li>Install either <a
3234
href="http://developer.android.com/sdk/installing/studio.html">Android
3335
Studio</a> (which bundles the Android SDK) or just <a
@@ -88,7 +90,7 @@ <h3>Checkout Instructions</h3>
8890

8991
<pre>
9092
cd <i>[someDirectory]</i>
91-
hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
93+
git clone https://github.com/google/google-api-java-client-samples.git
9294
cd google-api-java-client-samples/calendar-android-sample
9395
</pre>
9496

@@ -101,8 +103,8 @@ <h3>Set Up Project in Android Studio</h3>
101103
<li>Run this command in a terminal:
102104
<pre>$ANDROID_HOME/tools/android sdk</pre>
103105
</li>
104-
<li>Under "Tools", check on "Android SDK Build-tools" revision 18.0.1.</li>
105-
<li>Under "Android 2.2 (API 8)", check on "SDK Platform" and "Google APIs".</li>
106+
<li>Under "Tools", check on "Android SDK Build-tools" revision 22.0.1.</li>
107+
<li>Under "Android 5.1.1 (API 22)", check on "SDK Platform" and "Google APIs".</li>
106108
<li>Under "Extras", check on "Android Support Repository", "Android Support Library",
107109
and "Google Repository".
108110
</li>
@@ -126,11 +128,12 @@ <h3>Set Up Project in Android Studio</h3>
126128
</ul>
127129
</li>
128130
<li>Select "Use local gradle distribution" with "Gradle home" of
129-
<code><i>[someDirectory]</i>/gradle-1.6</code> and click OK.
131+
<code><i>[someDirectory]</i>/gradle-2.2.1</code> and click OK.
130132
</li>
131133
</ul>
132134
</li>
133-
<li>Open AndroidManifest.xml and change the package to match the name you registered in the
135+
<li>Open AndroidManifest.xml and change the package attribute of the manifest, initially
136+
"com.google.api.services.samples.calendar.android", to match the name you registered in the
134137
Google Cloud Console, e.g. "org.example.calendar.janedoe20130911".
135138
</li>
136139
<li>Rename the Java package: right-click on src/main/java, click New, click Package, and then

tasks-android-sample/AndroidManifest.xml

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
<category android:name="android.intent.category.LAUNCHER" />
2828
</intent-filter>
2929
</activity>
30+
<!-- The following is necessary if you're not using AndroidStudio.
31+
See http://developer.android.com/google/play-services/setup.html -->
32+
<meta-data
33+
android:name="com.google.android.gms.version"
34+
android:value="@integer/google_play_services_version" />
3035
</application>
3136

3237
</manifest>

tasks-android-sample/build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ dependencies {
99
compile 'com.google.apis:google-api-services-tasks:v1-rev35-1.19.0' exclude module: 'httpclient'
1010
compile 'com.google.api-client:google-api-client-android:1.19.0' exclude module: 'httpclient'
1111
compile 'com.google.http-client:google-http-client-gson:1.19.0' exclude module: 'httpclient'
12-
compile 'com.google.android.google-play-services:google-play-services:1'
12+
compile 'com.google.android.gms:play-services-identity:7.3.0'
1313
}
1414

1515
android {
16-
compileSdkVersion 8
17-
buildToolsVersion "18.0.1"
16+
compileSdkVersion 22
17+
buildToolsVersion "22.0.1"
1818

1919
defaultConfig {
20-
minSdkVersion 8
21-
targetSdkVersion 8
20+
minSdkVersion 11
21+
targetSdkVersion 22
2222
}
2323

2424
sourceSets {
@@ -30,7 +30,7 @@ android {
3030

3131
buildTypes {
3232
release {
33-
runProguard true
33+
minifyEnabled true
3434
proguardFile 'proguard-google-api-client.txt'
3535
proguardFile getDefaultProguardFile('proguard-android.txt')
3636
}

tasks-android-sample/instructions.html

+15-11
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@ <h3>Browse Online</h3>
88

99
<ul>
1010
<li><a
11-
href="http://code.google.com/p/google-api-java-client/source/browse?repo=samples#hg/tasks-android-sample">Browse
11+
href="https://github.com/google/google-api-java-client-samples/tree/master/tasks-android-sample">Browse
1212
Source</a>, or main file <a
13-
href="http://code.google.com/p/google-api-java-client/source/browse/tasks-android-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java?repo=samples">TasksSample.java</a>
13+
href="https://github.com/google/google-api-java-client-samples/tree/master/tasks-android-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java">TasksSample.java</a>
1414
</li>
1515
</ul>
1616

1717
<h3>Prerequisites</h3>
1818

1919
<ul>
2020
<li>Install <a href="http://java.com">Java</a> (requires 6 or higher)</li>
21-
<li>Install <a href="http://mercurial.selenic.com/">Mercurial</a> (requires 1.6 or higher).</li>
22-
<li>Unzip <a href="http://services.gradle.org/distributions/gradle-1.6-bin.zip">Gradle
23-
1.6</a></li>
21+
<li>Install <a href="http://git-scm.com/downloads">Git</a> (suggested 1.7.10 or higher)
22+
or <a href="http://github.com">GitHub</a> client (<a href="http://mac.github.com/">Mac</a>)
23+
(<a href="http://windows.github.com/">Windows</a>)</li>
24+
<li>Unzip <a href="http://services.gradle.org/distributions/gradle-2.2.1-bin.zip">Gradle
25+
2.2.1</a></li>
2426
<li>Install either <a
2527
href="http://developer.android.com/sdk/installing/studio.html">Android
2628
Studio</a> (which bundles the Android SDK) or just <a
@@ -29,6 +31,7 @@ <h3>Prerequisites</h3>
2931
ANDROID_HOME to the Android SDK installation directory, which for Android Studio is in the
3032
"sdk" subdirectory.
3133
</li>
34+
<!-- No longer necessary with latest Android SDK?
3235
<li>Install google-play-services.jar
3336
</br>The first time you run this sample, you will need to install the google-play-services.jar. You can either do it through Eclipse, or by running the "mvn install" command.
3437
<ul>
@@ -49,7 +52,7 @@ <h3>Prerequisites</h3>
4952
</pre>
5053
</li>
5154
</ul>
52-
</li>
55+
</li>-->
5356
</ul>
5457

5558
<h3>Register Your Application</h3>
@@ -102,7 +105,7 @@ <h3>Checkout Instructions</h3>
102105

103106
<pre>
104107
cd <i>[someDirectory]</i>
105-
hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
108+
git clone https://github.com/google/google-api-java-client-samples.git
106109
cd google-api-java-client-samples/tasks-android-sample
107110
</pre>
108111

@@ -115,8 +118,8 @@ <h3>Set Up Project in Android Studio</h3>
115118
<li>Run this command in a terminal:
116119
<pre>$ANDROID_HOME/tools/android sdk</pre>
117120
</li>
118-
<li>Under "Tools", check on "Android SDK Build-tools" revision 18.0.1.</li>
119-
<li>Under "Android 2.2 (API 8)", check on "SDK Platform" and "Google APIs".</li>
121+
<li>Under "Tools", check on "Android SDK Build-tools" revision 22.0.1.</li>
122+
<li>Under "Android 5.1.1 (API 22)", check on "SDK Platform" and "Google APIs".</li>
120123
<li>Under "Extras", check on "Android Support Repository", "Android Support Library",
121124
and "Google Repository".
122125
</li>
@@ -140,11 +143,12 @@ <h3>Set Up Project in Android Studio</h3>
140143
</ul>
141144
</li>
142145
<li>Select "Use local gradle distribution" with "Gradle home" of
143-
<code><i>[someDirectory]</i>/gradle-1.6</code> and click OK.
146+
<code><i>[someDirectory]</i>/gradle-2.2.1</code> and click OK.
144147
</li>
145148
</ul>
146149
</li>
147-
<li>Open AndroidManifest.xml and change the package to match the name you registered in the
150+
<li>Open AndroidManifest.xml and change the package attribute of the manifest, initially
151+
"com.google.api.services.samples.tasks.android", to match the name you registered in the
148152
Google Cloud Console, e.g. "org.example.tasks.janedoe20130911".
149153
</li>
150154
<li>Rename the Java package: right-click on src/main/java, click New, click Package, and then

0 commit comments

Comments
 (0)