|
| 1 | +# Adding a kit to a local mParticle sample app project |
| 2 | + |
| 3 | +Use these quick, step-by-step instructions to integrate a kit to a local sample app project: |
| 4 | + |
| 5 | +1. Navigate to the app/libs folder using command `cd app/libs` (you can use the Tab key to autocomplete the path). |
| 6 | + |
| 7 | + * path should be similar to: *..\mparticle-android-sample-apps\core-sdk-samples\higgs-shop-sample-app\app\libs* |
| 8 | + |
| 9 | +2. Clone the git repository using the command `git clone` *kit repo url* |
| 10 | + |
| 11 | +3. Navigate to the repository folder using the command `cd` *kit name* or use the Tab key, path name should now have the kit repository name. |
| 12 | + |
| 13 | +4. Check out a branch or create a new one using the command `git checkout` *branch name* or `git checkout -b` *new branch name* |
| 14 | + |
| 15 | +5. Add the kit implementation to the app's *module-level build.gradle.kts file*: `implementation(project(":mparticle-android-integration-*replace with kit name*"))` |
| 16 | + |
| 17 | +6. Include the kit in the project-level `settings.gradle` file: |
| 18 | + `include ':mparticle-android-integration-`*replace with kit name* |
| 19 | + `project(':mparticle-android-integration-*replace with kit name*').projectDir = new File('app/libs/mparticle-android-integration-`*replace with kit name*) |
| 20 | + |
| 21 | +7. Finally, add the sample app credentials on the main class cdHiggsShopSampleApplication() replacing .credentials(*your apiKey,*your apiSecret*) |
| 22 | + |
| 23 | +You can now test your kit integration. Place a breakpoint inside the kit's `onCreate()` and run the app in debug mode. If the kit is integrated, the breakpoint should trigger, indicating the kit is being initialized. |
| 24 | + |
| 25 | +# Adding the SDK to a local mParticle sample app project. |
| 26 | + |
| 27 | +Due to the complexity of the multi-module configuration of the SDK, adding it directly as an operable module in the sample app is not currently supported. Different steps must be taken to *build the SDK locally and add it as a dependency.* |
| 28 | + |
| 29 | +1. Fork a local copy of the SDK repository. In this local copy you must make *all the configuration changes that you wish to see implemented on your local sample app* before you make a local build. |
| 30 | + |
| 31 | +2. After your changes are made, run the command `./gradlew publishReleaseLocal`. This command creates a local snapshot of the SDK. |
| 32 | + |
| 33 | +3. Finally, in the sample app's *module-level build.gradle.kts* file, replace the original core implementation with yours. You can find the name in your local **m2** folder. The dependency should contain the word "SNAPSHOT." The complete dependency should be similar to the following: `implementation("com.mparticle:android-core:#.##.#-SNAPSHOT"`. |
0 commit comments