1## How to update APK files and DM files in the `res` folder
2
3The source code of the test app is in `../app/SplitApp`. After updating the
4source code, you need to update the APK files and DM files in the `res` folder.
5
6### Updating APK files
7
81. Build the APK from source.
9
10    ```
11    m CtsDexMetadataSplitApp
12    ```
13
142. Copy the APK to the `res` folder.
15
16    ```
17    cp \
18      $ANDROID_BUILD_TOP/out/host/linux-x86/cts/android-cts/testcases/CtsDexMetadataSplitApp/x86_64/CtsDexMetadataSplitApp.apk \
19      res/CtsDexMetadataSplitApp.apk
20    ```
21
22    Note: You may need to replace `x86_64` with a different ISA, depending on
23    the product that you `lunch`-ed.
24
253. Repeat the steps above for the split APK (`CtsDexMetadataSplitAppFeatureA`).
26
27### Updating DM files
28
29The DM files contain profiles, whose headers have the dex checksums that need to
30match the dex files in the APKs. Therefore, after updating the APKs, you must
31update the DM files.
32
331. Create a binary profile from the text profile.
34
35    ```
36    profman \
37      --create-profile-from=res/CtsDexMetadataSplitApp.prof.txt \
38      --apk=res/CtsDexMetadataSplitApp.apk \
39      --dex-location=base.apk \
40      --reference-profile-file=/tmp/primary.prof \
41      --output-profile-type=app
42    ```
43
44    Note: `--dex-location` must be set to `base.apk`, regardless of the actual
45    APK name.
46
47    Note: `--reference-profile-file` is the output. You can specify a different
48    output location, but the filename must be `primary.prof`.
49
50    Tip: If `profman` is not found, run `m profman`.
51
522. Delete the existing DM file and create the DM file from the binary profile.
53
54    ```
55    rm res/CtsDexMetadataSplitApp.dm
56    zip -j res/CtsDexMetadataSplitApp.dm /tmp/primary.prof
57    ```
58
593. Repeat the steps above for the split APK (`CtsDexMetadataSplitAppFeatureA`).
60