Using an AAR With Different minSDK Version

Ive made an Android Library for XOJO as shown in the below blog post example; I require my Android Library to be at a sdk version 33. But as you see from the compile error Xojo is sdk version 26. Is there a way I can override this in permissions?

Also, any chance a ManifestEdiitor will be included in xojo. The permissions and dependencies seem insufficient and lack proper explanation or syntax examples.

Android Compiler
C:\Users\sa-Liam1\AppData\Local\Temp\xojo scratch 28088\MDM Android Agent.xojo_xml_project [FDAF9B3D]\AndroidBuilds\MDM Android Agent_2283C0EE-1B5B-40FF-A344-A1565BF89492\app\src\main\AndroidManifest.xml Error:
	uses-sdk:minSdkVersion 26 cannot be smaller than version 33 declared in library [Android MDM Lib-release.aar] C:\Users\sa-Liam1\.gradle\caches\8.10.2\transforms\52516c9dab56c3c2b2f4a11fb80f500c\transformed\Android MDM Lib-release\AndroidManifest.xml as the library might be using APIs not available in 26
	Suggestion: use a compatible library with a minSdk of at most 26,
		or increase this project's minSdk version to at least 33,
		or use tools:overrideLibrary="com.scooterautomation.androidmdmlib" to force usage (may lead to runtime failures)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseMainManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 26 cannot be smaller than version 33 declared in library [Android MDM Lib-release.aar] C:\Users\sa-Liam1\.gradle\caches\8.10.2\transforms\52516c9dab56c3c2b2f4a11fb80f500c\transformed\Android MDM Lib-release\AndroidManifest.xml as the library might be using APIs not available in 26
  	Suggestion: use a compatible library with a minSdk of at most 26,
  		or increase this project's minSdk version to at least 33,
  		or use tools:overrideLibrary="com.scooterautomation.androidmdmlib" to force usage (may lead to runtime failures)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2s

Tried adding
android:minSdkVersion=“33”
to the Permissions configuration but has the same result

Also, using Xojo 2025 Release 1 Build 64919

It says in the release notes

64854 77702 Feature Request Compiler Android Android apps are now compiled against Sdk 35 (Android 15) for best compatibility. Also updated several internal tool and library versions.

Android portion of build.gradle for the Java library (AAR)

android {
    namespace = "com.example.androidlib"
    compileSdk = 35

    defaultConfig {
        minSdk = 33
        targetSdk = 35
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    buildToolsVersion = "35.0.0"
}

Is there a way to add the /res/xml/device_admin.xml in?

I’m sure @Paul_Lefebvre will be able to help.

1 Like

The legend already has…
https://tracker.xojo.com/xojoinc/xojo/-/issues/78698