Skip to content

Commit cee5dab

Browse files
joefernandezAndroid (Google) Code Review
authored andcommitted
Merge "docs: JOBB tool help page" into jb-dev-docs
2 parents 4623c0d + e4ba91d commit cee5dab

File tree

3 files changed

+119
-15
lines changed

3 files changed

+119
-15
lines changed

docs/html/guide/google/play/expansion-files.jd

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,10 @@ yourself or be able to distinguish between the two files.</p>
114114

115115
<h3 id="Filename">File name format</h3>
116116

117-
<p>Each expansion file you upload can be any format you choose (ZIP, PDF, MP4, etc.). Regardless of
118-
the file type, Google Play considers them opaque binary blobs and renames the files
119-
using the following scheme:</p>
117+
<p>Each expansion file you upload can be any format you choose (ZIP, PDF, MP4, etc.). You can also
118+
use the <a href="{@docRoot}tools/help/jobb.html">JOBB</a> tool to encapsulate and encrypt a set
119+
of resource files and subsequent patches for that set. Regardless of the file type, Google Play
120+
considers them opaque binary blobs and renames the files using the following scheme:</p>
120121

121122
<pre class="classic no-pretty-print">
122123
[main|patch].&lt;expansion-version&gt;.&lt;package-name&gt;.obb
@@ -136,7 +137,7 @@ value).
136137
<p>"First" is emphasized because although the Developer Console allows you to
137138
re-use an uploaded expansion file with a new APK, the expansion file's name does not change&mdash;it
138139
retains the version applied to it when you first uploaded the file.</p></dd>
139-
<dt>{@code &lt;package-name&gt;}</dt>
140+
<dt>{@code &lt;package-name&gt;}</dt>
140141
<dd>Your application's Java-style package name.</dd>
141142
</dl>
142143

@@ -253,7 +254,7 @@ expansion file, you can use the patch file for the rest of your assets.</p>
253254
<li>Develop your application such that it uses the resources from your expansion files in the
254255
device's <a href="#StorageLocation">shared storage location</a>.
255256
<p>Remember that you must not delete, move, or rename the expansion files.</p>
256-
<p>If your application doesn't demand a specific format, we suggest you create ZIP files for
257+
<p>If your application doesn't demand a specific format, we suggest you create ZIP files for
257258
your expansion files, then read them using the <a href="#ZipLib">APK Expansion Zip
258259
Library</a>.</p>
259260
</li>
@@ -347,7 +348,7 @@ href="#StorageLocation">shared storage location</a> (in the
347348
<ol>
348349
<li>Perform a request using Google Play's <a
349350
href="{@docRoot}guide/google/play/licensing/index.html">Application Licensing</a> to get your
350-
app's expansion file names, sizes, and URLs.</li>
351+
app's expansion file names, sizes, and URLs.</li>
351352
<li>Use the URLs provided by Google Play to download the expansion files and save
352353
the expansion files. You <strong>must</strong> save the files to the <a
353354
href="#StorageLocation">shared storage location</a>
@@ -651,7 +652,7 @@ public class SampleAlarmReceiver extends BroadcastReceiver {
651652
SampleDownloaderService.class);
652653
} catch (NameNotFoundException e) {
653654
e.printStackTrace();
654-
}
655+
}
655656
}
656657
}
657658
</pre>
@@ -698,7 +699,7 @@ boolean expansionFilesDelivered() {
698699
return false;
699700
}
700701
return true;
701-
}
702+
}
702703
</pre>
703704
<p>In this case, each {@code XAPKFile} object holds the version number and file size of a known
704705
expansion file and a boolean as to whether it's the main expansion file. (See the sample
@@ -749,7 +750,7 @@ public void onCreate(Bundle savedInstanceState) {
749750
...
750751
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
751752
notifierIntent, PendingIntent.FLAG_UPDATE_CURRENT);
752-
753+
753754
// Start the download service (if required)
754755
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
755756
pendingIntent, SampleDownloaderService.class);
@@ -1050,9 +1051,9 @@ your ZIP expansion files as a virtual file system.</p>
10501051
<dl>
10511052
<dt>{@code APKExpansionSupport}</dt>
10521053
<dd>Provides some methods to access expansion file names and ZIP files:
1053-
1054+
10541055
<dl style="margin-top:1em">
1055-
<dt>{@code getAPKExpansionFiles()}</dt>
1056+
<dt>{@code getAPKExpansionFiles()}</dt>
10561057
<dd>The same method shown above that returns the complete file path to both expansion
10571058
files.</dd>
10581059
<dt>{@code getAPKExpansionZipFile(Context ctx, int mainVersion, int
@@ -1063,7 +1064,7 @@ patch file. That is, if you specify both the <code>mainVersion</code> and the
10631064
all the data, with the patch file's data merged on top of the main file.</dd>
10641065
</dl>
10651066
</dd>
1066-
1067+
10671068
<dt>{@code ZipResourceFile}</dt>
10681069
<dd>Represents a ZIP file on the shared storage and performs all the work to provide a virtual
10691070
file system based on your ZIP files. You can get an instance using {@code
@@ -1083,7 +1084,7 @@ the root of the ZIP file contents. This is useful for certain Android APIs that
10831084
android.content.res.AssetFileDescriptor}, such as some {@link android.media.MediaPlayer} APIs.</dd>
10841085
</dl>
10851086
</dd>
1086-
1087+
10871088
<dt>{@code APEZProvider}</dt>
10881089
<dd>Most applications don't need to use this class. This class defines a {@link
10891090
android.content.ContentProvider} that marshals the data from the ZIP files through a content
@@ -1101,7 +1102,7 @@ following:</p>
11011102
// Get a ZipResourceFile representing a merger of both the main and patch files
11021103
ZipResourceFile expansionFile = APKExpansionSupport.getAPKExpansionZipFile(appContext,
11031104
mainVersion, patchVersion);
1104-
1105+
11051106
// Get an input stream for a known file inside the expansion file ZIPs
11061107
InputStream fileStream = expansionFile.getInputStream(pathToFileInsideZip);
11071108
</pre>
@@ -1254,7 +1255,7 @@ you can easily read all the expansion file data.</li>
12541255

12551256

12561257
<!-- Tools are not ready.
1257-
1258+
12581259
<h3>Using OBB tool and APIs</h3>
12591260

12601261
<pre>

docs/html/tools/help/jobb.jd

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
page.title=JOBB
2+
@jd:body
3+
4+
5+
<p>The {@code jobb} tool allows you to build encrypted and unencrypted APK expansion files in
6+
Opaque Binary Blob (OBB) format. You can download and mount these expansion files in your
7+
application using {@link android.os.storage.StorageManager} on devices with Android 2.3 (API
8+
Level 9) or higher. OBB files are used to provide additional file assets for Android applications
9+
(such as graphics, sounds and video), separate from an application's APK file. For more
10+
information on using expansion files, see
11+
<a href="{@docRoot}guide/google/play/expansion-files.html">APK Expansion Files</a>.</p>
12+
13+
14+
<h2 id="usage">Usage</h2>
15+
16+
<p>The syntax for running {@code jobb} is as follows:</p>
17+
18+
<pre>
19+
jobb [-d &lt;directory&gt;][-o &lt;filename&gt;][-pn &lt;package&gt;][-pv &lt;version&gt;] \
20+
[-k &lt;key&gt;][-ov][-dump &lt;filename&gt;][-v][-about]
21+
</pre>
22+
23+
<p>You can use the {@code jobb} tool to create an OBB file or extract the contents of an
24+
existing OBB. The following example command creates an OBB file from source files.</p>
25+
26+
<pre>
27+
$ jobb -d /temp/assets/ -o my-app-assets.obb -k secret-key -pn com.my.app.package -pv 11
28+
</pre>
29+
30+
<p>This example shows how to dump (extract) the contents of an existing OBB file:</p>
31+
32+
<pre>
33+
$ jobb -d /temp/obb-output/ -o my-app-assets.obb -k secret-key
34+
</pre>
35+
36+
37+
<h2 id="options">Options</h2>
38+
39+
<p>The table below lists the command line options for the {@code jobb} tool.</p>
40+
41+
<table>
42+
<tr>
43+
<th>Option</th>
44+
<th>Description</th>
45+
</tr>
46+
<tr>
47+
<td>{@code -d &lt;directory&gt;}</td>
48+
<td>Set the input directory for creating an OBB file, or the output directory when extracting
49+
({@code -dump}) an existing file. When creating an OBB file, the contents of the specified
50+
directory and all its sub-directories are included in the OBB file system.
51+
</td>
52+
</tr>
53+
<tr>
54+
<td>{@code -o &lt;filename&gt;}</td>
55+
<td>Specify the filename for the OBB file. This parameter is required when
56+
creating an OBB and extracting (dumping) its contents.</td>
57+
</tr>
58+
<tr>
59+
<td>{@code -pn &lt;package&gt;}</td>
60+
<td>Specify the package name for the application that mounts the OBB file, which corresponds
61+
to the {@code package} value specified in your application's manifest. This parameter is
62+
required when creating an OBB file.</td>
63+
</tr>
64+
<tr>
65+
<td>{@code -pv &lt;version&gt;}</td>
66+
<td>Set the minimum version for the application that can mount the OBB file, which corresponds
67+
to the {@code android:versionCode} value in your application's manifest. This parameter is
68+
required when creating an OBB file.</td>
69+
</tr>
70+
<tr>
71+
<td>{@code -k &lt;key&gt;}</td>
72+
<td>Specify a password for encrypting a new OBB file or decrypting an existing, encypted
73+
OBB file.</td>
74+
</tr>
75+
<tr>
76+
<td>{@code -ov}</td>
77+
<td>Create OBB file that is an overlay of an existing OBB file structure. This option allows
78+
the new package contents to be mounted into the same location as a previous package and is
79+
intended for creating patch versions of previously generated OBB files. Files within an
80+
overlay OBB file replace files that have the same path.</td>
81+
</tr>
82+
<tr>
83+
<td style="white-space: nowrap">{@code -dump &lt;filename&gt;}</td>
84+
<td><p>Extract the contents of the specified OBB file. When using this option, you must also
85+
specify the output directory for the contents using the {@code -d &lt;directory&gt;}
86+
parameter.</p>
87+
88+
<p class="note"><strong>Note:</strong> When dumping an existing OBB file, you can omit the
89+
{@code -d &lt;directory&gt;} parameter to get a listing of the directories inside the file,
90+
without extracting the contents.</p>
91+
</td>
92+
</tr>
93+
<tr>
94+
<td>{@code -v}</td>
95+
<td>Set verbose output for the tool.</td>
96+
</tr>
97+
<tr>
98+
<td>{@code -about}</td>
99+
<td>Display version and help information for the {@code jobb} tool.</td>
100+
</tr>
101+
102+
</table>

docs/html/tools/tools_toc.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ the SDK</span></a></div>
144144
<li><a href="<?cs var:toroot ?>tools/help/etc1tool.html">etc1tool</a></li>
145145
<li><a href="<?cs var:toroot ?>tools/help/hierarchy-viewer.html">Hierarchy Viewer</a></li>
146146
<li><a href="<?cs var:toroot ?>tools/help/hprof-conv.html">hprof-conv</a></li>
147+
<li><a href="<?cs var:toroot ?>tools/help/jobb.html">jobb</a></li>
147148
<li><a href="<?cs var:toroot ?>tools/help/lint.html">lint</span></a></li>
148149
<li><a href="<?cs var:toroot ?>tools/help/logcat.html">logcat</a></li>
149150
<li><a href="<?cs var:toroot ?>tools/help/mksdcard.html">mksdcard</a></li>

0 commit comments

Comments
 (0)