0
  • I've adapted my main src set's manifest for SDK 31, and ./gradlew assembleDebug works fine.
  • ./gradlew assembleAndroidTest fails with android:exported needs to be explicitly specified ...
  • It fails even if I remove all test dependencies from project
  • According to ./gradlew :app dependencies I have no indirect test dependencies
  • If I downgrade target SDK to 30, I see no elements without exported in the merged test manifest
  • I have no manually-declared test manifests
  • I believe I've read all the answers for similar questions

UPD: My dependencies:

object Libraries {

        // Kotlin
        const val KOTLIN_STD_LIB = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.KOTLIN}"

        // Coroutines
        const val COROUTINES_CORE = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.COROUTINES}"
        const val COROUTINES_ANDROID = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.COROUTINES}"
        const val COROUTINES_PLAY_SERVICES = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:${Versions.COROUTINES}"

        // AndroidX
        const val ANDROID_X_ADS_IDENTIFIER = "androidx.ads:ads-identifier:${Versions.ANDROID_X_ADS_IDENTIFIER}"
        const val ANDROID_X_CORE_KTX = "androidx.core:core-ktx:${Versions.ANDROID_X_CORE_KTX}"
        const val ANDROID_X_COLLECTION_KTX = "androidx.collection:collection-ktx:${Versions.ANDROID_X_COLLECTION_KTX}"
        const val ANDROID_X_WORK_RUNTIME_KTX = "androidx.work:work-runtime-ktx:${Versions.ANDROID_X_WORK}"
        const val ANDROID_X_STARTUP_RUNTIME = "androidx.startup:startup-runtime:${Versions.ANDROID_X_STARTUP_RUNTIME}"
        const val ANDROID_X_APPCOMPAT = "androidx.appcompat:appcompat:${Versions.ANDROID_X_APPCOMPAT}"
        const val ANDROID_X_CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:${Versions.ANDROID_X_CONSTRAINT_LAYOUT}"
        const val ANDROID_X_RECYCLER_VIEW = "androidx.recyclerview:recyclerview:${Versions.ANDROID_X_RECYCLER_VIEW}"
        const val ANDROID_X_FRAGMENT_KTX = "androidx.fragment:fragment-ktx:${Versions.ANDROID_X_FRAGMENT_KTX}"
        const val ANDROID_X_SWIPE_REFRESH_LAYOUT = "androidx.swiperefreshlayout:swiperefreshlayout:${Versions.ANDROID_X_SWIPE_REFRESH_LAYOUT}"
        const val ANDROID_X_PALETTE_KTX = "androidx.palette:palette-ktx:${Versions.ANDROID_X_PALETTE_KTX}"
        const val ANDROID_X_CARD_VIEW = "androidx.cardview:cardview:${Versions.ANDROID_X_CARD_VIEW}"

        const val ANDROID_X_LIFECYCLE_VIEW_MODEL_KTX = "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.ANDROID_X_LIFECYCLE}"
        const val ANDROID_X_LIFECYCLE_LIVE_DATA_KTX = "androidx.lifecycle:lifecycle-livedata-ktx:${Versions.ANDROID_X_LIFECYCLE}"
        const val ANDROID_X_LIFECYCLE_VIEW_MODEL_SAVED_STATE = "androidx.lifecycle:lifecycle-viewmodel-savedstate:${Versions.ANDROID_X_LIFECYCLE}"
        const val ANDROID_X_LIFECYCLE_SERVICE = "androidx.lifecycle:lifecycle-service:${Versions.ANDROID_X_LIFECYCLE}"
        const val ANDROID_X_LIFECYCLE_PROCESS = "androidx.lifecycle:lifecycle-process:${Versions.ANDROID_X_LIFECYCLE}"
        const val ANDROID_X_LIFECYCLE_COMMON_JAVA8 = "androidx.lifecycle:lifecycle-common-java8:${Versions.ANDROID_X_LIFECYCLE}"
        const val ANDROID_X_LIFECYCLE_REACTIVE_STREAMS = "androidx.lifecycle:lifecycle-reactivestreams:${Versions.ANDROID_X_LIFECYCLE}"
        const val ANDROID_X_LIFECYCLE_EXTENSIONS = "androidx.lifecycle:lifecycle-extensions:${Versions.ANDROID_X_LIFECYCLE_EXTENSIONS}"

        // Google material
        const val GOOGLE_MATERIAL = "com.google.android.material:material:${Versions.GOOGLE_MATERIAL}"

        // Hilt
        const val HILT_ANDROID = "com.google.dagger:hilt-android:${Versions.HILT}"
        const val HILT_COMPILER = "com.google.dagger:hilt-compiler:${Versions.HILT}"
        const val HILT_ANDROID_COMPILER = "com.google.dagger:hilt-android-compiler:${Versions.HILT}"
        const val ANDROID_X_HILT_COMPILER = "androidx.hilt:hilt-compiler:${Versions.ANDROID_X_HILT}"
        const val ANDROID_X_HILT_WORK = "androidx.hilt:hilt-work:${Versions.ANDROID_X_HILT}"

        // Room
        const val ROOM_RUNTIME = "androidx.room:room-runtime:${Versions.ROOM}"
        const val ROOM_KTX = "androidx.room:room-ktx:${Versions.ROOM}"
        const val ROOM_COMPILER = "androidx.room:room-compiler:${Versions.ROOM}"
        const val SQLITE3_JDBC = "org.xerial:sqlite-jdbc:${Versions.SQLITE3_JDBC}"

        // Firebase
        const val FIREBASE_BOM = "com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}"
        const val FIREBASE_ANALYTICS_KTX = "com.google.firebase:firebase-analytics-ktx"
        const val FIREBASE_CRASHLYTICS_KTX = "com.google.firebase:firebase-crashlytics-ktx"
        const val FIREBASE_PERFORMANCE_KTX = "com.google.firebase:firebase-perf-ktx"
        const val FIREBASE_MESSAGING_KTX = "com.google.firebase:firebase-messaging-ktx"
        const val FIREBASE_DYNAMIC_LINKS_KTX = "com.google.firebase:firebase-dynamic-links-ktx"

        // GMS
        const val GTM = "com.google.android.gms:play-services-tagmanager:${Versions.GTM}"
        const val PLAY_SERVICES_LOCATION = "com.google.android.gms:play-services-location:${Versions.PLAY_SERVICES_LOCATION}"

        // Appsflyer
        const val APPSFLYER = "com.appsflyer:af-android-sdk:${Versions.APPSFLYER}"

        // MyTracker
        const val MY_TRACKER = "com.my.tracker:mytracker-sdk:${Versions.MY_TRACKER}"

        // Facebook
        const val FACEBOOK_CORE = "com.facebook.android:facebook-core:${Versions.FACEBOOK_CORE}"

        // Install referrer
        const val INSTALL_REFERRER = "com.android.installreferrer:installreferrer:${Versions.INSTALL_REFERRER}"

        // Guava
        const val GUAVA = "com.google.guava:guava:${Versions.GUAVA}"

        // Glide
        const val GLIDE = "com.github.bumptech.glide:glide:${Versions.GLIDE}"
        const val GLIDE_COMPILER = "com.github.bumptech.glide:compiler:${Versions.GLIDE}"
        const val GLIDE_OKHTTP3 = "com.github.bumptech.glide:okhttp3-integration:${Versions.GLIDE}"
        const val GLIDE_WEBP_DECODER = "com.github.zjupure:GlideWebpDecoder:2.0.${Versions.GLIDE}"

        // Gson
        const val GSON = "com.google.code.gson:gson:${Versions.GSON}"

        // KotlinX Serialization
        const val KOTLIN_X_SERIALIZATION = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.KOTLIN_X_SERIALIZATION}"

        // Timber
        const val TIMBER = "com.jakewharton.timber:timber:${Versions.TIMBER}"

        // Leak Canary
        const val LEAK_CANARY = "com.squareup.leakcanary:leakcanary-android:${Versions.LEAK_CANARY}"
        const val LEAK_CANARY_PLUMBER = "com.squareup.leakcanary:plumber-android:${Versions.LEAK_CANARY}"

        // XZ
        const val XZ = "org.tukaani:xz:${Versions.XZ}"

        // OkHttp
        const val OKHTTP = "com.squareup.okhttp3:okhttp:${Versions.OKHTTP}"
        const val OKHTTP_LOGGING_INTERCEPTOR = "com.squareup.okhttp3:logging-interceptor:${Versions.OKHTTP}"
        const val RETROFIT = "com.squareup.retrofit2:retrofit:${Versions.RETROFIT}"
        const val RETROFIT_KOTLIN_X_SERIALIZATION_CONVERTER = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:${Versions.RETROFIT_KOTLIN_X_SERIALIZATION_CONVERTER}"

        // Lottie
        const val LOTTIE = "com.airbnb.android:lottie:${Versions.LOTTIE}"

        // Keyboard visibility event
        const val KEYBOARD_VISIBILITY_EVENT = "net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:${Versions.KEYBOARD_VISIBILITY_EVENT}"

        // Cicerone
        const val CICERONE = "com.github.terrakok:cicerone:${Versions.CICERONE}"

        // Adapter delegates
        const val ADAPTER_DELEGATES = "com.hannesdorfmann:adapterdelegates4-kotlin-dsl:${Versions.ADAPTER_DELEGATES}"

        // Test
        const val JUNIT = "junit:junit:${Versions.JUNIT}"
        const val ANDROIDX_TEST_CORE = "androidx.test:core:${Versions.ANDROIDX_TEST_CORE}"
        const val ANDROIDX_TEST_EXT_JUNIT = "androidx.test.ext:junit:${Versions.ANDROIDX_TEST_EXT_JUNIT}"

        /**
         * Versions
         */
        private object Versions {
            const val KOTLIN = "1.5.31"

            const val COROUTINES = "1.5.2"

            const val ANDROID_X_ADS_IDENTIFIER = "1.0.0-alpha04"
            const val ANDROID_X_CORE_KTX = "1.6.0"
            const val ANDROID_X_COLLECTION_KTX = "1.1.0"
            const val ANDROID_X_WORK = "2.7.0"
            const val ANDROID_X_STARTUP_RUNTIME = "1.1.0"
            const val ANDROID_X_APPCOMPAT = "1.3.1"
            const val ANDROID_X_CONSTRAINT_LAYOUT = "2.1.1"
            const val ANDROID_X_RECYCLER_VIEW = "1.2.1"
            const val ANDROID_X_FRAGMENT_KTX = "1.3.6"
            const val ANDROID_X_SWIPE_REFRESH_LAYOUT = "1.1.0"
            const val ANDROID_X_PALETTE_KTX = "1.0.0"
            const val ANDROID_X_CARD_VIEW = "1.0.0"
            const val ANDROID_X_LIFECYCLE = "2.3.1"
            const val ANDROID_X_LIFECYCLE_EXTENSIONS = "2.2.0"

            const val GOOGLE_MATERIAL = "1.4.0"

            const val HILT = "2.39.1"
            const val ANDROID_X_HILT = "1.0.0"
            const val ROOM = "2.3.0"

            const val FIREBASE_BOM = "28.4.2"
            const val GTM = "17.0.1"
            const val PLAY_SERVICES_LOCATION = "18.0.0"
            const val APPSFLYER = "6.4.2"
            const val MY_TRACKER = "2.1.2"
            const val FACEBOOK_CORE = "12.0.1"
            const val INSTALL_REFERRER = "2.2"

            const val GUAVA = "28.0-android"
            const val GLIDE = "4.12.0"
            const val SQLITE3_JDBC = "3.36.0.3"
            const val GSON = "2.8.8"
            const val KOTLIN_X_SERIALIZATION = "1.3.0"
            const val TIMBER = "5.0.1"
            const val LEAK_CANARY = "2.7"

            const val XZ = "1.9"

            const val OKHTTP = "4.9.2"
            const val RETROFIT = "2.9.0"
            const val RETROFIT_KOTLIN_X_SERIALIZATION_CONVERTER = "0.8.0"

            const val LOTTIE = "4.2.0"

            const val KEYBOARD_VISIBILITY_EVENT = "3.0.0-RC3"

            const val CICERONE = "6.6"

            const val ADAPTER_DELEGATES = "4.3.0"


            // Tests
            const val JUNIT = "4.13.2"
            const val ANDROIDX_TEST_CORE = "1.4.0"
            const val ANDROIDX_TEST_EXT_JUNIT = "1.1.3"
        }
    }

app's build.gradle:


plugins {
    id("com.android.application")
    kotlin("android")
    kotlin("kapt")
    id("dagger.hilt.android.plugin")
    id("com.google.firebase.crashlytics")
    kotlin("plugin.serialization")
    id("com.google.gms.google-services")
    id("com.google.firebase.firebase-perf")
}

android {
    compileSdk = BuildVersions.COMPILE_SDK_VERSION

    defaultConfig {
        applicationId = "%removed%"

        minSdk = BuildVersions.MIN_SDK_VERSION
        targetSdk = BuildVersions.TARGET_SDK_VERSION

        versionCode = BuildVersions.VERSION_CODE
        versionName = BuildVersions.versionName

        renderscriptTargetApi = BuildVersions.TARGET_SDK_VERSION
        renderscriptSupportModeEnabled = true

        addVersionsToBuildConfig()

        javaCompileOptions {
            annotationProcessorOptions {
                arguments += mapOf(
                    "room.schemaLocation" to "$projectDir/schemas",
                    "room.incremental" to "true",
                    "room.expandProjection" to "true"
                )
            }
        }

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        getByName("debug") {
            applicationIdSuffix = ".test"

            extra["enableCrashlytics"] = false
            project.ext.set("firebasePerformanceInstrumentationEnabled", "false")

            isMinifyEnabled = false
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
        }

        getByName("release") {
            isMinifyEnabled = false
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")

            signingConfig = signingConfigs.getByName("release")
        }
    }

    flavorDimensions("product", "stand")

    productFlavors {
        // Products
        create("onetothree") {
            dimension = "product"
        }

        // API stands
        create("devStand") {
            dimension = "stand"

            versionNameSuffix = "-devStand"
        }

        create("prodStand") {
            dimension = "stand"
        }
    }

    compileOptions {
        sourceCompatibility = BuildVersions.JAVA_VERSION
        targetCompatibility = BuildVersions.JAVA_VERSION
    }

    kotlinOptions {
        jvmTarget = BuildVersions.JAVA_VERSION.toString()
    }

    kapt {
        correctErrorTypes = true
    }

    packagingOptions {
        exclude("DebugProbesKt.bin")
    }

    lint {
        isCheckReleaseBuilds = false
    }
}

dependencies {
    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))

    implementation(project(":auth"))
    implementation(project(":core"))
    implementation(project(":core-ui"))
    implementation(project(":core-network"))
    implementation(project(":config"))
    implementation(project(":core-apps"))
    implementation(project(":icons"))
    implementation(project(":all-apps"))
    implementation(project(":wallpapers"))
    implementation(project(":feed"))
    implementation(project(":settings"))
    implementation(project(":grid"))
    implementation(project(":workspace"))
    implementation(project(":popup-menu"))
    implementation(project(":widgets"))
    implementation(project(":apps-ui"))
    implementation(project(":dragndrop"))
    implementation(project(":onboarding"))
    implementation(project(":navigation"))
    implementation(project(":analytics"))
    implementation(project(":profile"))
    implementation(project(":weather-forecast"))
    implementation(project(":core-workspace"))
    implementation(project(":cleaner"))
    implementation(project(":defaultset"))

    // Hilt
    addHilt()

    // ImageLoader
    kapt(Dependencies.Libraries.GLIDE_COMPILER)

    // Recycler
    implementation(Dependencies.Libraries.ANDROID_X_RECYCLER_VIEW)
    implementation(Dependencies.Libraries.ADAPTER_DELEGATES)
    implementation(Dependencies.Libraries.ANDROID_X_CARD_VIEW)

    // LeakCanary
    debugImplementation(Dependencies.Libraries.LEAK_CANARY)
    implementation(Dependencies.Libraries.LEAK_CANARY_PLUMBER)

    implementation(Dependencies.Libraries.ANDROID_X_PALETTE_KTX)
}

Base build.gradle for modules:

plugins {
    id("com.android.library")
    kotlin("android")
    kotlin("kapt")
}

android {
    compileSdk = BuildVersions.COMPILE_SDK_VERSION

    defaultConfig {
        minSdk = BuildVersions.MIN_SDK_VERSION
        targetSdk = BuildVersions.TARGET_SDK_VERSION

        addVersionsToBuildConfig()

        javaCompileOptions {
            annotationProcessorOptions {
                arguments += mapOf(
                    "room.schemaLocation" to "$projectDir/schemas",
                    "room.incremental" to "true",
                    "room.expandProjection" to "true"
                )
            }
        }

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles("consumer-rules.pro")
    }

    buildTypes {
        getByName("release") {
            isMinifyEnabled = true
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
        }
    }

    compileOptions {
        sourceCompatibility = BuildVersions.JAVA_VERSION
        targetCompatibility = BuildVersions.JAVA_VERSION
    }

    tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
        kotlinOptions {
            jvmTarget = BuildVersions.JAVA_VERSION.toString()
        }
    }

    lint {
        isAbortOnError = false
        isCheckReleaseBuilds = false
    }

    kapt {
        correctErrorTypes = true
    }
}

One of many module's build.gradle:

plugins {
    `base-lib`

    id("dagger.hilt.android.plugin")
}

android {
    buildFeatures {
        viewBinding = true
    }
}

dependencies {
    implementation(project(":core"))
    implementation(project(":core-network"))
    implementation(project(":analytics"))

    // AndroidX
    api(Dependencies.Libraries.ANDROID_X_APPCOMPAT)
    api(Dependencies.Libraries.ANDROID_X_CONSTRAINT_LAYOUT)
    api(Dependencies.Libraries.ANDROID_X_RECYCLER_VIEW)
    api(Dependencies.Libraries.ANDROID_X_FRAGMENT_KTX)
    api(Dependencies.Libraries.ANDROID_X_SWIPE_REFRESH_LAYOUT)
    implementation(Dependencies.Libraries.ANDROID_X_PALETTE_KTX)

    // Material
    api(Dependencies.Libraries.GOOGLE_MATERIAL)

    // MVVM
    api(Dependencies.Libraries.ANDROID_X_LIFECYCLE_VIEW_MODEL_KTX)
    api(Dependencies.Libraries.ANDROID_X_LIFECYCLE_LIVE_DATA_KTX)
    api(Dependencies.Libraries.ANDROID_X_LIFECYCLE_VIEW_MODEL_SAVED_STATE)
    api(Dependencies.Libraries.ANDROID_X_LIFECYCLE_SERVICE)
    api(Dependencies.Libraries.ANDROID_X_LIFECYCLE_PROCESS)
    api(Dependencies.Libraries.ANDROID_X_LIFECYCLE_COMMON_JAVA8)
    api(Dependencies.Libraries.ANDROID_X_LIFECYCLE_REACTIVE_STREAMS) // FIXME: Remove
    api(Dependencies.Libraries.ANDROID_X_LIFECYCLE_EXTENSIONS)

    // Hilt
    addHilt()

    // Lottie
    api(Dependencies.Libraries.LOTTIE)

    // Keyboard visibility detector
    implementation(Dependencies.Libraries.KEYBOARD_VISIBILITY_EVENT)
}

AndroidManifest.xml (I've removed permissions as the question's body exceeds limit):

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="%removed%">

    <application
        android:name=".app.App">

        <activity
            android:name=".app.presentation.main.MainActivity"
            android:excludeFromRecents="true"
            android:exported="true">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
     
        <service
            android:name=".app.service.FCMService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

        <service
            android:name=".core_apps.service.AppNotificationsListenerService"
            android:enabled="true"
            android:exported="true"
            android:label="Notifications"
            android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
            <intent-filter>
                <action android:name="android.service.notification.NotificationListenerService" />
            </intent-filter>
        </service>

        <service
            android:name=".wallpapers.domain.service.LiveWallpaperService"
            android:enabled="true"
            android:exported="false"
            android:label="Live Wallpaper"
            android:permission="android.permission.BIND_WALLPAPER">
            <intent-filter>
                <action android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>

            <meta-data
                android:name="android.service.wallpaper"
                android:resource="@xml/live_wallpaper" />
        </service>

        <receiver
            android:name="com.appsflyer.SingleInstallBroadcastReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>

        <receiver
            android:name=".defaultset.presentation.NotificationAlarmReceiver"
            android:exported="false" />

        <receiver
            android:name=".app.receiver.BootReceiver"
            android:enabled="true"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <service
            android:name=".wallpapers.service.ChangeWallpaperService"
            android:enabled="true"
            android:exported="true"
            android:permission="android.permission.BIND_JOB_SERVICE"
            android:stopWithTask="false" />

        <service
            android:name=".apps_ui.presentation.view.widget.AppWidgetIdService"
            android:exported="true"
            android:permission="android.permission.BIND_JOB_SERVICE" />

        <provider
            android:name="androidx.startup.InitializationProvider"
            android:authorities="${applicationId}.androidx-startup"
            android:exported="false"
            tools:node="merge">
            <meta-data
                android:name="androidx.work.WorkManagerInitializer"
                android:value="androidx.startup"
                tools:node="remove" />
        </provider>

        <receiver
            android:name=".wallpapers.data.interactor.WallpaperChangeReceiver"
            android:exported="false" />

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <meta-data
            android:name="ru.launcher.core_network.di.GlideModule"
            android:value="AppGlideModule" />

        <!-- Fixes for Android 12 build -->

        <service
            android:name="ru.mts.sso.authenticator.MtsAuthService"
            android:exported="false"
            tools:ignore="ExportedService"
            tools:node="merge" />

        <activity
            android:name="leakcanary.internal.activity.LeakActivity"
            android:exported="true"
            tools:node="merge" />

        <activity
            android:name="leakcanary.internal.RequestStoragePermissionActivity"
            android:exported="true"
            tools:node="merge" />

        <receiver
            android:name="leakcanary.internal.NotificationReceiver"
            android:exported="false"
            tools:node="merge" />

        <!-- END fixes -->


    </application>

</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="ru.launcher">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
    <uses-permission android:name="android.permission.SET_WALLPAPER" />
    <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="com.android.alarm.permission.SET_ALARM" />

    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />

    <!-- Required only when requesting background location access on Android 10 (API level 29). -->
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <uses-permission
        android:name="android.permission.QUERY_ALL_PACKAGES"
        tools:ignore="QueryAllPackagesPermission" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="http" />
        </intent>
    </queries>

    <application
        android:name=".app.App"
        android:allowBackup="true"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/application_name"
        android:networkSecurityConfig="@xml/network_security_config"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:ignore="AllowBackup,UnusedAttribute"
        tools:replace="android:fullBackupContent">

        <activity
            android:name=".app.presentation.main.MainActivity"
            android:clearTaskOnLaunch="true"
            android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize|locale"
            android:excludeFromRecents="true"
            android:exported="true"
            android:launchMode="singleTask"
            android:resizeableActivity="true"
            android:screenOrientation="portrait"
            android:stateNotNeeded="true"
            android:taskAffinity=""
            android:windowSoftInputMode="adjustPan"
            tools:ignore="LockedOrientationActivity,UnusedAttribute">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.MONKEY" />
            </intent-filter>

            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="mtslaunchertest.page.link"
                    android:scheme="https" />

                <data
                    android:host="mtslaunchertest.page.link"
                    android:scheme="http" />
                <data
                    android:host="mtslaunchertest.page.link"
                    android:scheme="https" />
            </intent-filter>
        </activity>

        <activity
            android:name=".core_navigation.presentation.FakeLauncherActivity"
            android:enabled="false"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name=".core_navigation.presentation.SystemDialogActivity"
            android:exported="true"
            android:theme="@style/Theme.AppCompat.Translucent" />

        <activity
            android:name=".core_navigation.presentation.WebActivity"
            android:configChanges="orientation|screenSize"
            android:exported="true"
            android:screenOrientation="sensor" />

        <activity
            android:name=".feed.presentation.ProfileActivity"
            android:exported="true"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.ProfileApp"
            tools:ignore="LockedOrientationActivity" />

        <provider
            android:name="androidx.startup.InitializationProvider"
            android:authorities="${applicationId}.androidx-startup"
            android:exported="false"
            tools:node="merge">
            <meta-data
                android:name="androidx.work.WorkManagerInitializer"
                android:value="androidx.startup"
                tools:node="remove" />
        </provider>

        <receiver
            android:name=".wallpapers.data.interactor.WallpaperChangeReceiver"
            android:exported="false" />

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <!-- Fixes for Android 12 build -->

        <activity
            android:name="leakcanary.internal.activity.LeakActivity"
            android:exported="true"
            tools:node="merge" />

        <activity
            android:name="leakcanary.internal.RequestStoragePermissionActivity"
            android:exported="true"
            tools:node="merge" />

        <receiver
            android:name="leakcanary.internal.NotificationReceiver"
            android:exported="false"
            tools:node="merge" />

        <!-- END fixes -->


    </application>

</manifest>

Any ideas on how to resolve it?

artem
  • 16,382
  • 34
  • 113
  • 189
  • check this answer https://stackoverflow.com/questions/67412084/manifest-merger-failed-apps-targeting-android-12-android-studio-error/68605049#68605049 – Noah Nov 11 '21 at 18:00
  • @Noah all elements already have «exported» attribute, and «regular» build works fine, but not the test build. – artem Nov 11 '21 at 18:05
  • I have no idea what would be the cause. – Noah Nov 11 '21 at 19:04
  • I had this issue. It was to do with an espresso dependency in android test deps, try making sure you are using the latest android test deps where the `exported=true` tag is explicitly added in the depedency AndroidManifest. – Mark Nov 11 '21 at 19:10
  • @MarkKeen the strange thing is that the build fails even if I have zero test dependencies. – artem Nov 11 '21 at 21:50
  • does that extend to androidTest dependencies and any other modules with dependencies? I suggest you post your app/module level `build.gradle` / `build.gradle.kts` file(s) – Mark Nov 11 '21 at 22:31
  • @MarkKeen done. I have many modules, so I can't post all of them, but there is the complete project dependencies list. – artem Nov 12 '21 at 07:27

0 Answers0