We welcome all types of contribution.
Need a feature or found a bug? Please create an issue and add the android
label.
Have a question or suggestion? Please create a discussion and add the android
label.
Want to contribute by creating a pull request? Great! Fork this repository to get started.
We'd love to accept your contributions, there are just a few guidelines you need to follow.
A Contribution License Agreement with Bentley must be signed before your contributions will be accepted. Upon opening a pull request, you will be prompted to use cla-assistant for a one-time acceptance applicable for all Bentley projects. You can read more about Contributor License Agreements on Wikipedia.
All submissions go through a review process. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests.
Follow these instructions to do local builds of the Mobile SDK. You will need git, Android Studio, and the GitHub CLI (gh) installed on your computer. You will also need to set up a GitHub Personal Access Token (PAT) as per the instructions for doing that in the Android README.md from iTwin/mobile-samples.
In this step we need to publish the mobile-native-android AAR file to the local Maven repository so it can be used in the next step.
git clone https://github.com/iTwin/mobile-native-android
cd mobile-native-android
./gradlew --no-daemon assembleGitHub publishToMavenLocal
- These instructions are specific to MacOS (or Linux), on Windows use
gradle.bat
instead. - The
assemble
task copies the AAR file usingwget
whereas theassembleGitHub
task uses thegh
CLI. - The file is large and is downloaded from the Releases, so it can take a while depending on your internet speed.
- The
publishToMavenLocal
tasks publishes the AAR file to the local Maven repository (~/.m2/repository
) so it can be used by the next step. - If
gradlew
issues an error stating "Unable to locate a Java Runtime", you can try:brew install --cask temurin
. Note that it will prompt you for asudo
password. - The
--no-daemon
option shouldn't be necessary but seems to be required, due to an unknown incompatibility between the twogradlew
copies (even though they're identical). Without this option thegradlew
call in the next step will hang. - If you end up with a daemon running, you can do:
./gradlew --stop
In this step we will build the Mobile SDK Android code and publish it to the local Maven repository.
git clone https://github.com/iTwin/mobile-sdk-android
cd mobile-sdk-android
echo sdk.dir=/Users/$USER/Libarary/Android/sdk > local.properties
./gradlew --no-daemon publishToMavenLocal
- The
echo
command which creates thelocal.properties
file only needs to be done once. Thesdk.dir
to specify the location of the Android SDK you wish to use. Alternatively, you can setANDROID_SDK
in your shell. On Windows, theecho
command will need to be changed to reflect where Android Studio installs the SDK. In Android Studio the SDK location can be shown by going to: Preferences | Appearance & Behavior | System Settings | Android SDK | Android SDK Location
To use the locally published Mobile SDK in your App do the following:
- Add
mavenLocal()
to the list of repositories in thesettings.gradle
file. Make sure it is before any other repositories. Look atmobile-sdk-android/settings.gradle
to see an example. - In your app's
build.gradle
file, add a dependency tomobile-sdk-android
. Something like this should work:implementation 'com.github.itwin.mobilesdk:mobile-sdk-android:0.22.3'