Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: components/cronet/android/sample/README

Issue 864663004: Quick-start instructions for Cronet Sample Application (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 How to set up and run the sample app as an android studio project.
pauljensen 2015/02/05 15:23:58 android studio -> Android Studio
dougk 2015/02/05 21:56:24 Done.
3
4 Linux (studio version 0.8.11 beta)
pauljensen 2015/02/05 15:23:58 studio -> Android Studio
dougk 2015/02/05 21:56:24 Done.
5 =====
6 (1) Launch Android Studio
mef 2015/02/05 17:02:46 Should line items be complete sentences with perio
dougk 2015/02/05 22:42:36 In theory the outline form itself need not have a
7
8 (2) Choose "Import project"
9 - navigate to chromium/src/components/cronet/android/sample
mef 2015/02/05 17:02:46 Conceivably Sample app source code is / could be p
dougk 2015/02/05 22:42:36 Is that a suggested addition to the text?
mef 2015/02/05 22:56:12 Yeah, I'd say something like 'navigate to location
dougk 2015/02/06 17:35:15 Done.
10 - pick a destination for it
11
12 (3) Copy in the 'jar' files
13 (a) directly under the "app" directory of your project
14 create a "libs" directory. Use a shell command if you like,
15 or use "File|New|Directory" from the menu. But note that
16 you only get "Directory" as an option if you are in
17 "Project" view, not "Android" view. "Project" models
mef 2015/02/05 17:02:46 I like elaborate explanation!
dougk 2015/02/05 22:42:36 Acknowledged.
18 the local machine's filesystem, but Android is a virtual
19 layout of files corresponding to the deployed hierarchy.
20 That is to say, do step (b) before step (a) if you're inclined.
21 (b) toggle the view from "Android" to "Project"
22 in the selection list above the file hierarchy.
23 Otherwise you won't see "libs"
24 (c) Copy 'cronet.jar' and 'cronet_stub.jar' to "libs"
pauljensen 2015/02/05 15:23:58 Should we explain where these files come from and
mef 2015/02/05 17:02:46 I think link to another README about building is f
dougk 2015/02/05 21:56:24 yes, we should. Would it be ok to have the initial
25
26 (4) Inform the IDE about the Jar files
mef 2015/02/05 17:02:46 Is step 3c required if we are doing 4? I mean, cou
dougk 2015/02/05 22:42:36 Yes, it's fine to have the jars sitting next to '.
27 (a) Shift+click both files
28 (b) Right mouse
mef 2015/02/05 17:02:46 FWIW Mac doesn't have right mouse.
dougk 2015/02/05 22:42:36 Indeed, it is control+click on the Mac. Not only t
mef 2015/02/05 22:56:12 I expect target audience to be familiar with UI pa
dougk 2015/02/06 17:35:14 Done.
29 (c) Pick "Add as Library"
30 (d) Confirm "OK" at the "Add to module" dialog
31 (e) If you wish, confirm that you can navigate
32 into the jar files and see their interfaces.
33 Note: This should have added into build.gradle the following:
34 dependencies {
35 compile file('libs/cronet.jar')
36 compile file('libs/cornet_stub.jar')
37 }
38 enabling the IDE to see the classes and interfaces in the jars.
39 "compile" as used here means package those jars into the apk.
40 You could also add those lines by hand.
41
42 (5) Copy in the '.so' file
43 (a) under "app/src/main" create a directory named "jniLibs"
44 (b) copy armeabi and ameabi-v7a into jniLibs, which should
45 contain only subdirectories, not directly a '.so' file
46 (c) the IDE will automatically know about these
47
48 (6) Click "Run"
49
50 If the project doesn't build,
mef 2015/02/05 17:02:46 Should this be a 'troubleshooting' section?
dougk 2015/02/05 22:42:36 yes, will rename.
51 make sure that you have the correct 'cronet.jar'.
52 There is one that is part of the Chromium build which
53 does not include org.chromium.base (and so will be missing PathUtil,
54 at least) and one that is part of the cronet build.
55
56 If it builds but doesn't run, verify that the '.so' files are present
57 in your Android package (which is just a jar file in disguise):
58 % jar tf build/outputs/apk/app-debug.apk
59 AndroidManifest.xml
60 res/layout/cronet_sample_activity.xml
61 resource.arsc
62 classes.dex
63 lib/armeabi/libcronet.so
64 lib/armeabi-v7/libcronet.so
65 META-INF
66 etc
pauljensen 2015/02/05 15:23:58 Should we provide a pointer for what to do if the
dougk 2015/02/05 21:56:24 I'll explain that the jniLibs directory should hav
67
68 MacOS (studio version 1.0.1)
69 =====
70 (0) you might have to set a magic environment variable as follows:
71 export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk
72
73 This has to do with differences between the JDK that the studio runs in
74 as distinct from the JDK that the studio understands to be present on
75 the target machine.
76
77 (1) Launch Android Studio,
78 which can be achieved from the command line with
79 % open '/Applications/Android Studio.app'
80
81 (2) Choose "Import Non-Android Studio Project"
82 (a) Navigate to the path containing "sample"
83 (b) Pick a place to put it, and choose "Finish"
84 I'll use "~/my_example"
85
86 (3) Ignore the instructions below,
87 here and proceed from step (3) for Linux.
88
89 Alternate instructions
90 (Don't do these, they're screwy)
pauljensen 2015/02/05 15:23:58 Why are we including these if they aren't a good i
dougk 2015/02/05 21:56:24 Well, I thought it strange that the steps above in
91
92 - Choose "File -> New -> Folder -> Assets Folder"
93 Check "Change Folder Location" and delete the entire
94 pathname that was there. Change it to 'libs'
95 which is conventional for pre-built jar files.
96
97 - Copy and paste the two pre-built '.jar' files into 'assets'
98 When you do this, it will say that the destination is
99 "app/libs". This is right. If you prefer to see
100 the file hierarchy as it really exists, you can change
101 the dropdown above the tree view from "android view"
102 to "project view". Or just keep in mind that assets = libs
103 at this level of the hierarchy.
104
105 - Select both jar files that you added (Shift+click)
106 and pull up the menu for them (Ctrl+click).
107 Select "Add as library"
108
109 - Choose "File -> New -> Folder -> JNI Folder"
110 Choose "Change Folder Location"
111 and change the name to "src/main/jniLibs"
mef 2015/02/05 17:02:46 I like this explanation, maybe there should be a F
dougk 2015/02/05 22:42:36 Will move this to a Footnotes section.
112 The reason you have to change the name is that Gradle has an automatic
113 rule that tries to build binary libraries in src/main/jni.
114 But you don't want to trigger that rule because it will complains if
dougk 2015/02/05 22:42:36 subject/verb agreement: it will complain.
115 you don't have the Native Development Kit.
116 The magic name of "jniLibs" tells Android Studio that you only
117 want to depend on the libraries therein.
118 See for example http://www.shaneenishry.com/blog/2014/08/17/ndk-with-android-s tudio/
119
120 Ideally the two .jar files and one .so file could be delivered as one .aar
pauljensen 2015/02/05 15:23:58 Should we put this under a "SIDE NOTE" title indic
mef 2015/02/05 17:02:46 I think it is more of TODO items for ourselves to
dougk 2015/02/05 21:56:24 Done.
121 (Android Archive) file, but Studio will try to pull aar files from a maven
122 repository without some workarounds that are about as much trouble
123 as adding in three separate files.
124 See https://code.google.com/p/android/issues/detail?id=55863
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698