3
3
## Android
4
4
5
5
- ** Build Library:**
6
+
6
7
Run the following command to build the native library for Android:
7
8
8
9
``` bash
21
22
- ** Emulator:** Create and launch an Android Virtual Device (AVD).
22
23
- ** USB Device:** Connect an Android device via USB.
23
24
- ** Wireless Device:** Pair your device using ** Android Studio** (recommended for simplicity).
25
+
24
26
2 . Start the ADB server and verify the connection:
27
+
25
28
``` bash
26
29
adb start-server
27
30
adb devices
28
31
```
32
+
29
33
3. Navigate to the Android project directory:
34
+
30
35
` ` ` bash
31
36
cd android
32
37
` ` `
38
+
33
39
4. Ensure ` ./gradlew` has execution permissions:
40
+
34
41
` ` ` bash
35
42
chmod +x ./gradlew
36
43
` ` `
44
+
37
45
5. Build the application:
46
+
38
47
- ** Debug:**
48
+
39
49
` ` ` bash
40
50
./gradlew assembleDebug
41
51
` ` `
52
+
42
53
- ** Release:**
54
+
43
55
` ` ` bash
44
56
./gradlew assembleRelease
45
57
` ` `
58
+
46
59
- ** Bundle (requires signing configuration in Gradle):**
60
+
47
61
` ` ` bash
48
62
./gradlew bundleRelease
49
63
` ` `
64
+
50
65
6. Install the application on the device:
51
-
66
+
52
67
- ** Debug:**
68
+
53
69
` ` ` bash
54
70
adb install -r app/build/outputs/apk/debug/app-debug.apk
55
71
` ` `
72
+
56
73
- ** Release:**
74
+
57
75
` ` ` bash
58
76
adb install -r app/build/outputs/apk/release/app-release-unsigned.apk
59
77
` ` `
78
+
60
79
** Note:** The release build requires signing before installation.
61
-
80
+
62
81
7. Launch the application:
82
+
63
83
` ` ` bash
64
84
adb shell am start -n org.bevyengine.mobile/.MainActivity
65
85
` ` `
75
95
- ** Run Using Shell Commands:**
76
96
77
97
- ** Run on the First Available Simulator:**
98
+
78
99
Simply run:
79
-
100
+
80
101
` ` ` sh
81
102
make
82
103
` ` `
83
-
104
+
84
105
This executes the default ` run` command in the ` Makefile` , launching the app on the first available simulator.
85
-
106
+
86
107
- ** Run on a Specific Device:**
87
-
108
+
88
109
1. ** Find the Device ID:**
89
-
110
+
90
111
- For ** simulators** , run:
112
+
91
113
` ` ` sh
92
114
xcrun simctl list devices
93
115
` ` `
116
+
94
117
- For ** physical devices** , run:
118
+
95
119
` ` ` sh
96
120
xcrun xctrace list devices
97
121
` ` `
122
+
98
123
- Copy the desired ** Device ID** , e.g., ` 912BFD4B-9AFB-4DDE-983A-1816245DB2DA` .
99
-
124
+
100
125
2. ** Run the App on the Selected Device:**
126
+
101
127
` ` ` sh
102
128
make run DEVICE_ID=912BFD4B-9AFB-4DDE-983A-1816245DB2DA
103
129
` ` `
@@ -108,12 +134,12 @@ This section shows how to develop both mobile and desktop apps within the same C
108
134
109
135
- **To run from the Bevy root:**
110
136
111
- ```bash
112
- cargo run -p bevy_mobile_example
113
- ```
137
+ ```bash
138
+ cargo run -p bevy_mobile_example
139
+ ```
114
140
115
141
- **To run from the Bevy examples directory for mobile:**
116
142
117
- ```bash
118
- cargo run
119
- ```
143
+ ```bash
144
+ cargo run
145
+ ```
0 commit comments