This repository contains Measurement Kit for Android. That is, it contains the Java native interface (JNI) code as well as its Java counterpart.
Add the following line to app/build.gradle
's dependencies
:
dependencies {
+ api "org.openobservatory.measurement_kit:android-libs:$version"
Where $version
is the version you want to use (e.g. 0.4.3-aar-3
).
This is the approach that we follow in the android-example app.
Apparently, it's not easy to automatically verify packages signature when downloading packages from jcenter using gradle. If you want to verify dependencies, proceed as follows:
-
download the latest AAR and its digital signature from our jcenter-hosted repository
-
verify the digital signature using
gpg --verify <asc-file>
-
create the
libs
directory and move the AAR inside it -
to the toplevel
build.gradle
add:
allprojects {
repositories {
jcenter()
+ flatDir {
+ dirs 'libs'
+ }
}
}
- to
app/build.gradle
add:
dependencies {
+ api "org.openobservatory.measurement_kit:android-libs:$version"
Where $version
is the version you have downloaded (e.g. 0.4.3-aar-3
).
We currently only support building from macOS.
- add our tap
brew tap measurement-kit/measurement-kit
- install dependencies with brew
brew install android-measurement-kit android-sdk generic-assets jq
- install Android-platform components
sdkmanager --install ndk 'build-tools;29.0.3' 'platforms;android-29'
Upgrade dependencies installed using brew:
brew upgrade
Upgrade the Android platform:
sdkmanager --update
export ANDROID_HOME=/usr/local/Caskroom/android-sdk/<version>
The Makefile is very short and self explanatory. By reading it, you should
be able to understand in what order the scripts in the ./script
are
called. Also the scripts are quite simple and easy to follow.
Make sure that the vendored dependencies (./android-libs/src/main/cpp/vendor
)
are all updated to the latest stable version.
make configure
Assuming you have a running emulator, you can run all instrumented functional tests on such emulator using:
./gradlew connectedAndroidTest
You can run a specific functional test using:
./gradlew connectedAndroidTest \
-Pandroid.testInstrumentationRunnerArguments.class=io.android.mk.androidTests.<ClassName>
You can see the logcat of these tests with:
$ANDROID_SDK/platform-tools/adb logcat -c # clean the logcat
$ANDROID_SDK/platform-tools/adb logcat # show new logs
make dist
This will re-run make configure
for you and then proceed at
building the AAR and the POM files for JCenter.
Once you have built the AAR and the POM files, you should upload them to JCenter.