Skip to content

Commit 5e1ec89

Browse files
committed
Fix & improve building doc.
1 parent 4c5dbf0 commit 5e1ec89

File tree

1 file changed

+82
-62
lines changed

1 file changed

+82
-62
lines changed

doc/BUILDING.md

Lines changed: 82 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414

15-
1615
# How to build IOSched
1716

18-
Note: while these instructions allow you to build iosched, much of the
19-
functionality that depends on server APIs won't work because in order to
20-
do that you need to configure your own project in Google Developer
21-
Console, create API keys, etc. For more information about what you
22-
need to set up, refer to [Server side setup](#server-side-setup).
17+
This is a Gradle-based project that works best with [Android Studio].
2318

24-
This is a Gradle-based project that works best with
25-
[Android Studio](http://developer.android.com/sdk/installing/studio.html)
19+
<hr>
20+
> __Note I__: While the instructions below allow you to build IOSched, much of
21+
the functionality that depends on server APIs won't work because in order to
22+
do that you need to configure your own project in Google Developer
23+
Console (create API keys, etc). These additional steps required to set up,
24+
are outlined in the [Server side setup] section in this document.
2625

27-
> __NOTE__: Building the project as-is requires the Android Wear SDK, which you
28-
can download from http://developer.android.com/wear/. If you wish to build
29-
without Android Wear support, please refer to the [Building without Android
30-
Wear](#building-without-android-wear) section.
26+
> __NOTE II__: Building the project as-is requires the Android Wear SDK, which
27+
you can download from http://developer.android.com/wear/. If you NOT wish to
28+
build with Android Wear support, further details can be found in the
29+
[Building without Android Wear] section in this document.
30+
<hr>
3131

32-
To build the app:
32+
## Build the app
3333

3434
1. Install the following software:
3535
- Android SDK:
@@ -40,10 +40,9 @@ To build the app:
4040
http://developer.android.com/sdk/installing/studio.html
4141

4242
2. Run the Android SDK Manager by pressing the SDK Manager toolbar button
43-
in Android Studio or by running the 'android' command in a terminal
43+
in Android Studio or by running the `android` command in a terminal
4444
window.
4545

46-
4746
3. In the Android SDK Manager, ensure that the following are installed,
4847
and are updated to the latest available version:
4948
- Tools > Android SDK Platform-tools (rev 21 or above)
@@ -59,97 +58,118 @@ To build the app:
5958

6059
4. Create a file in your working directory called local.properties,
6160
containing the path to your Android SDK. Use local.properties.example as a
62-
model.
61+
model. _(On Windows, use a double-backslash ("\\") as a path separator.)_
6362

6463
5. Import the project in Android Studio:
6564

6665
1. Press File > Import Project
6766
2. Navigate to and choose the settings.gradle file in this project
6867
3. Press OK
6968

70-
6. Add your debug keystore to the project (save it as android/debug.keystore),
69+
6. Add your debug keystore to the project (save it as android/debug.keystore),
7170
or modify the build.gradle file to point to your key.
7271

73-
7. Choose Build > Make Project in Android Studio or run the following
72+
> __NOTE__: In debug mode, you sign your app with a debug certificate generated
73+
by the Android SDK. This certificate has a private key and a known password.
74+
To sign your app in release mode, you need to generate your own certificate.
75+
If you haven't done so, please refer to the [App Signing] guide for further
76+
details. If you wish to build with Android Wear support, please refer to the
77+
[Packaging Wearable Apps] guide for further details.
78+
79+
7.A Choose Build > Make Project in Android Studio or run the following
7480
command in the project root directory:
75-
```
81+
```sh
7682
./gradlew clean assembleDebug
7783
```
7884
8. To install on your test device:
7985

80-
```
86+
```sh
8187
./gradlew installDebug
8288
```
8389

84-
8590
## Building without Android Wear
8691

87-
If you do not wish to build the Android Wear component, you can remove or
88-
comment out the following line on android/build.gradle:
89-
92+
If you do NOT wish to build the Android Wear component, you need to make the two
93+
changes below.
94+
1. Open android/build.gradle and remove (or comment out) the following line:
95+
```
9096
wearApp project(":Wearable")
91-
92-
Also, remove ':Wearable' from settings.gradle, leaving only ':android'.
93-
97+
```
98+
2. Open settings.gradle and remove `':Wearable'`, leaving only `':android'`.
9499

95100
# Server-side setup
96101

97-
These steps are optional, in the sense that IOSched will build and run
98-
even if you don't set up the server side. However, unless you perform
99-
this setup, your build won't be able to use any of the Google APIs
100-
such as Google sign in, Google Drive integration, Google Maps integration,
101-
etc. So following the instructions in this section is highly
102-
recommended.
102+
These steps are optional, in the sense that IOSched will build and run even if
103+
you don't set up the server side. However, unless you perform this setup, your
104+
build won't be able to use any of the Google APIs such as Google sign in, Google
105+
Drive integration, Google Maps integration, etc. So following the instructions
106+
in this section is highly recommended.
103107

104-
0. Change the project's package name to your own package name.
105-
To do that, you can set the "package" attribute of the <manifest>
106-
tag in AndroidManifest.xml.
108+
1. Change the project's package name to your own package name. To do that, you
109+
can set the "package" attribute of the <manifest> tag in AndroidManifest.xml.
107110

108-
1. Create a project in the Google Developers Console,
109-
at https://cloud.google.com/console
111+
2. Create a project in the Google Developers Console, at
112+
https://cloud.google.com/console
110113

111-
2. Note your project's Project ID. It is a 11-12 digit sequence
112-
that appears in the URL, indicated by ########### below:
114+
3. Note your project's Project ID. It is a 11-12 digit sequence that appears in
115+
the URL; indicated by ########### below:
113116
```
114117
https://console.developers.google.com/project/###########/...
115118
```
116119
Write down this project ID number you will need it soon.
117120

118-
3. In the APIs and Auth section, enable these APIs:
121+
4. Navigate to "APIs and auth" > "APIs" and enable all of the following APIs:
119122
- Drive API
120123
- Google Cloud Messaging for Android
121124
- Google Maps Android API v2
122125
- Google+ API
123126
- YouTube Data API v3
124127

125-
4. In the Credentials section, create a Client ID for Android applications
126-
with your package name and your certificate fingerprint. As a reminder,
127-
you can get your debug certificate fingerprint by issuing this command:
128-
```
128+
5. Navigate to "APIs and auth" > "Credentials" and create a new Client ID for
129+
Android applications with the package name (as defined in AndroidManifest.xml in
130+
Step 1) and your debug certificate fingerprint. As a reminder, to get your debug
131+
certificate fingerprint, run the following command (on Windows, substitute
132+
`%USERPROFILE%` for `$HOME`):
133+
```sh
129134
keytool -exportcert -alias androiddebugkey \
130135
-keystore $HOME/.android/debug.keystore -list -v
131136
```
132-
It's also advisable to create a Client ID corresponding to your release
137+
It's also advisable to create a 2nd Client ID corresponding to your release
133138
certificate as well. To get your release certificate's fingerprint, run:
134-
```
139+
```sh
135140
keytool -exportcert -alias your-key-name \
136141
-keystore /path/to/your/release/keystore/file -list -v
137142
```
138-
139-
5. Still in the Credentials section, create an API Key for Public API
140-
access. The key's type is Key for Android applications, and you should
141-
add both your debug and release certificate fingerprints in the
142-
list of accepted certificates. Note the API key you created. It's
143-
a long alphanumeric string with digits, letters and with a
144-
few underscores.
145-
146-
6. Enter your API Key from Step 5 into this file:
143+
> __NOTE__: In order to create a Client ID, you might be required to set up the
144+
consent screen first! _(The screen that will be shown to users whenever you
145+
request access to their private data using your Client ID.)_ To do so, go to
146+
"APIs and auth" > "Consent screen", enter a "PRODUCT NAME" and click "Save".
147+
Finally, go back to Step 5 to create your Client ID(s).
148+
149+
6. Still at the "Credentials" page, create an API Key for Public API access.
150+
As a key type use _"Key for Android applications"_, and you should add both your
151+
debug and release certificate fingerprints in the list of accepted certificates.
152+
Note the API key you created. _(It's a long alphanumeric string that may contain
153+
digits, letters and underscores.)_
154+
155+
7. Enter the API key from Step 6 into this file:
147156
```
148157
android/src/main/res/values/maps_api_key.xml
149158
```
150-
7. Enter your API key in the YOUTUBE_API_KEY constant in Config.java
151-
152-
Done. IOSched should now work with Google sign in, Google Drive
153-
integration and Maps integration. Note that we did NOT include
154-
setting up GCM. For more information about this, see [CUSTOM.md](CUSTOM.md).
155-
159+
8. Enter the API key from Step 6, as a value for the `YOUTUBE_API_KEY` constant,
160+
into this file:
161+
```
162+
android/src/main/java/com/google/samples/apps/iosched/Config.java
163+
```
164+
<hr>
165+
166+
Done. IOSched should now work with Google sign in, Google Drive and Maps
167+
integration. Note that we did NOT include setting up GCM. For more information
168+
about this, see the [CUSTOM.md] file.
169+
170+
[Android Studio]:http://developer.android.com/sdk/installing/studio.html
171+
[App Signing]:http://developer.android.com/tools/publishing/app-signing.html#studio
172+
[Building without Android Wear]:https://github.com/google/iosched/blob/master/doc/BUILDING.md#building-without-android-wear
173+
[CUSTOM.md]:https://github.com/google/iosched/blob/master/doc/CUSTOM.md
174+
[Packaging Wearable Apps]:http://developer.android.com/training/wearables/apps/packaging.html
175+
[Server side setup]:https://github.com/google/iosched/blob/master/doc/BUILDING.md#server-side-setup

0 commit comments

Comments
 (0)