Trouble building ODK-X's services application on Android Studio

Hi everyone!
I was trying to build the services application on Android Studio (4.2.1).

The documentation for services says that " This project depends on ODK-X’s androidlibrary and androidcommon projects". I have tried building androidlibrary & androidcommon. They build successfully.

My directory structure is:

  • odk-x
    • androidlibrary
    • androidcommon
    • services
    • survey

When I try to build the application, it fails with the following exception:

Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [org.opendatakit:demoBasicAndroidlibrary:b202110181814_v2f7fdae] C:\Users\C.gradle\caches\transforms-2\files-2.1\afcf6d04db3e34607bb60a0cb6f0450a\jetified-demoBasicAndroidlibrary-b202110181814_v2f7fdae-demoBasicRelease\AndroidManifest.xml as the library might be using APIs not available in 19
Suggestion: use a compatible library with a minSdk of at most 19,
or increase this project’s minSdk version to at least 21,
or use tools:overrideLibrary=“org.opendatakit.androidlibrary” to force usage (may lead to runtime failures)

Here’s a screenshot of the same.

The problem is that the minSDK isn’t initialized in the build.gradle file. A comment in the code says that the compileSdkVersion & the buildToolsVersion are “set in the common.gradle file.” The common.gradle file isn’t present in the project.

I’m finding myself unable to figure out how to change the minSDKVersion & fix the error. Please suggest me how I can resolve this issue.
Thanks in advance.

Regards,
Chitranshi Srivastava.

PS: The same errors while building occur for survey application too.

We are currently in the process of preparing a preview release so the demo branch is not matching the master branch.

Two possible solutions:

  1. Change your product flavor in Android Studio to “masterBasic”. See Build Scripts — ODK-X Docs for information about build flavors. The discussion about the command line, but the same information about build flavors apply.
  2. Try using the “development” branch on all the repos instead of “master”. NOTE: all contributions first are merged to the development branch for testing.

Thank you. The projects build successfully in the development branch.

2 Likes