Skip to content

Commit 5b50c1f

Browse files
authored
RSDK-7806 update android readme (#36)
1 parent d55bce4 commit 5b50c1f

File tree

1 file changed

+56
-49
lines changed

1 file changed

+56
-49
lines changed

android/examples/module/README.md

+56-49
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,65 @@
22

33
## Making a brand new module
44

5-
1. Until this SDK is published, you should run this from the root directory of the
6-
SDK `./gradlew install`
7-
1. This will push artifacts to a mavenLocal repository that can be used in external projects on
8-
the same host
9-
2. Copy or work with the contents
10-
in [standalone-examples/SimpleAndroidModule](../../../standalone-examples/SimpleAndroidModule) (
11-
Java)
12-
or [standalone-examples/SimpleAndroidModuleKT](../../../standalone-examples/SimpleAndroidModuleKT) (
13-
Kotlin)
14-
1. Note: Due to locally installing, you'll notice `mavenLocal` added to every repositories
15-
configuration block. This will not be needed in the future.
16-
2. `module.mainEntryClass` must be set and reflects the main class that has an entry point (
17-
i.e. `public static void main`)
18-
3. The next command depends on if you are wanting to use a local module or registry
19-
* For local
20-
1. `./gradlew pushModuleAdbDebug`
21-
* This will push files to your selected AVD and you can use the following local module
22-
in your machine config:
23-
```json
24-
{
25-
"name": "android-module",
26-
"executable_path": "/sdcard/Download/mod.sh",
27-
"type": "local"
28-
}
29-
```
30-
* For registry
31-
1. `./gradlew copyModuleRelease --into </some/path>`
32-
2. Use the CLI to package the contents of `/some/path` where `mod.sh` is the executable
33-
and `module.jar` is the only additional file to be tarballed up.
34-
4. The component to add will be a generic component with model `viam:generic:mygeneric`
5+
Copy or work with the contents in [standalone-examples/SimpleAndroidModule](../../../standalone-examples/SimpleAndroidModule)
6+
(Java) or [standalone-examples/SimpleAndroidModuleKT](../../../standalone-examples/SimpleAndroidModuleKT) (Kotlin).
7+
8+
In the module/build.gradle file, set `module.mainEntryClass` to the fully qualified class name of your main class.
9+
10+
## Running your module on a machine
11+
12+
For **local development**, i.e. testing your module without uploading to the registry, run:
13+
14+
```sh
15+
./gradlew pushModuleAdbDebug
16+
```
17+
18+
This will push files to the active device or emulator in adb. Then add this to the modules array in your json config:
19+
20+
```json
21+
{
22+
"name": "android-module",
23+
"executable_path": "/sdcard/Download/FOLDER_NAME/module.tar.gz",
24+
"type": "local"
25+
}
26+
```
27+
28+
Then add a local generic component from the builder with model `viam:generic:mygeneric`.
29+
30+
`FOLDER_NAME` is the root folder of your module, for example `SimpleAndroidModule` or `SimpleAndroidModuleKT` if you're starting from the examples.
31+
32+
For **registry upload**, run:
33+
34+
```sh
35+
./gradlew tarModuleRelease
36+
```
37+
38+
That should create a tarball suitable for upload at `./module/build/outputs/module/release/module.tar.gz`.
3539

3640
## Building this example
3741

38-
1. From the root directory of the SDK,
39-
run: `./gradlew :android:examples:viam-android-sdk-examples-module:build`
40-
2. The next command depends on if you are wanting to use a local module or registry
41-
* For local
42-
1. `./gradlew :android:examples:viam-android-sdk-examples-module:pushModuleAdbDebug`
43-
* This will push files to your selected AVD and you can use the following local module
44-
in your machine config:
45-
```json
46-
{
47-
"name": "android-module",
48-
"executable_path": "/sdcard/Download/mod.sh",
49-
"type": "local"
50-
}
51-
```
52-
* For registry
53-
1. `./gradlew :android:examples:viam-android-sdk-examples-module:copyModuleRelease --into </some/path>`
54-
2. Use the CLI to package the contents of `/some/path` where `mod.sh` is the executable
55-
and `module.jar` is the only additional file to be tarballed up.
56-
3. The component to add will be a generic component with model `viam:generic:mygeneric`
42+
From the root directory of the SDK, run:
43+
```sh
44+
./gradlew :android:examples:viam-android-sdk-examples-module:build
45+
```
46+
47+
The next command depends on whether you are installing as a local module or uploading to registry.
48+
49+
For **local**, run:
50+
51+
```sh
52+
./gradlew :android:examples:viam-android-sdk-examples-module:pushModuleAdbDebug
53+
```
54+
55+
Then add a json module and generic component as above in the 'brand new module' instructions. `FOLDER_NAME` in the json will be `viam-java-sdk`.
56+
57+
For **registry**, run:
58+
59+
```sh
60+
./gradlew :android:examples:viam-android-sdk-examples-module:tarModuleRelease
61+
```
62+
63+
That will put your module tarball in `./android/examples/module/build/outputs/module/release/module.tar.gz`.
5764

5865
## Development
5966

0 commit comments

Comments
 (0)