error creating bundle with ./gradlew bundleRelease

I am not a developer and have no plans to become one. I did this for fun, but I haven’t touched code for several years now, and I’ve forgotten all about the principles.

I created an unpretentious application, which we use as a family, and which I put on the play store for a practical purpose, and in case it might interest someone.
Today, I have to update API level from 33 to 34 (asked by google).

I’m used to create apk with ./gradlew assembleRelease and the bundle with ./gradlew bundleRelease
All seems to work normally for the apk, but error for the bundle:

BUILD SUCCESSFUL in 6s
75 actionable tasks: 2 executed, 73 up-to-date

FAILURE: Build failed with an exception.

* Where:
Build file '/ssd/chris/AndroidStudioProjects/MyApp/app/build.gradle' line: 183

* What went wrong:
Could not determine the dependencies of task ':app:bundleRelease'.
> Could not create task ':app:bundleDemoRelease'.
   > DefaultTaskContainer#register(String, Action) on task set cannot be executed in the current context.

* 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 484ms

Do I need to change somthing in build or the method to create bundle please?

app/build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdk 34

    signingConfigs {
        release {
            storeFile file(RELEASE_STORE_FILE)
            storePassword RELEASE_STORE_PASSWORD
            keyAlias RELEASE_KEY_ALIAS
            keyPassword RELEASE_KEY_PASSWORD
            // Optional, specify signing versions used
            v1SigningEnabled true
            v2SigningEnabled true
        }
    }

    defaultConfig {
        applicationId "fr.myapp"
        minSdkVersion 22
        targetSdkVersion 34
        versionCode 260
        versionName '2.6.0'
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        vectorDrawables.useSupportLibrary = true
        signingConfig signingConfigs.release
    }
    buildFeatures {
        buildConfig = true
    }
    buildTypes {
        debug {
            buildConfigField "String", "VARIANT", ""dev""
            buildConfigField "boolean", "DEV", "true"
        }
        release {
            buildConfigField "String", "VARIANT", """"
            buildConfigField "boolean", "DEV", "false"
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            android.applicationVariants.all { variant ->
                def appName
                //Check if an applicationName property is supplied; if not use the name of the parent project.
                if (project.hasProperty("applicationName")) {
                    appName = applicationName
                } else {
                    appName = parent.name
                }
                variant.outputs.all { output ->
                    outputFileName = "${appName}-${variant.versionName}.apk"
                }
            }
        }
    }
    productFlavors {
        demo {
            applicationId "fr.myappdemo"
            versionNameSuffix '-demo'
        }
        full {
        }
    }
    compileOptions {
        targetCompatibility = 1.8
        sourceCompatibility = 1.8
    }
    packagingOptions {
        resources {
            excludes += ['META-INF/LICENSE.md', 'META-INF/NOTICE.md']
        }
    }
    namespace 'fr.myapp'
    flavorDimensions += 'app'
}

dependencies {
    modules {
        module("org.jetbrains.kotlin:kotlin-stdlib-jdk7") {
            replacedBy("org.jetbrains.kotlin:kotlin-stdlib", "kotlin-stdlib-jdk7 is now part of kotlin-stdlib")
        }
        module("org.jetbrains.kotlin:kotlin-stdlib-jdk8") {
            replacedBy("org.jetbrains.kotlin:kotlin-stdlib", "kotlin-stdlib-jdk8 is now part of kotlin-stdlib")
        }
    }

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.recyclerview:recyclerview:1.3.2'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.3.2'
    implementation 'androidx.preference:preference:1.2.1'
    implementation 'org.droidparts:droidparts-misc:3.2.5'
    implementation 'joda-time:joda-time:2.12.5'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.3'
    //noinspection GradleDependency
    implementation 'com.google.android.material:material:1.9.0'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.sun.mail:android-mail:1.6.7'
    implementation 'com.sun.mail:android-activation:1.6.7'
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'androidx.annotation:annotation:1.8.0'
    implementation 'com.github.yalantis:ucrop:2.2.6'
    implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
}
allprojects {
   repositories {
      maven { url "https://jitpack.io" }
   }
}
configurations {
    configureEach {
        exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
    }
}

static String firstMatchingSubstring(String taskName, String[] keys) {
    def lcName = taskName.toLowerCase()
    for(String key: keys) { if(lcName.contains(key.toLowerCase())) return key }
    return null
}

/**
 *
 * @param taskName e.g., bundleMyFlavorRelease or bundleRelease
 * @return
 */
String getBuildType(String taskName) {
    return firstMatchingSubstring(taskName, getBuildTypeNames())
}

/**
 *
 * @param taskName e.g., bundleMyFlavorRelease
 * @return
 */
String getFlavor(String taskName) {
    return firstMatchingSubstring(taskName, getProductFlavorNames())
}

String[] getBuildTypeNames() {
    def types = []
    android.buildTypes.configureEach { type -> types.add(type.name) }
    return types
}

String[] getProductFlavorNames() {
    def flavors = []
    android.productFlavors.configureEach { flavor -> flavors.add(flavor.name) }
    return flavors
}

tasks.configureEach { task ->
    def name = task.name
    //Skip some unnecessary tasks
    if (name.startsWith("bundle")
            && !name.contains("Classes")
            && !name.contains("Resources")
            && name != "bundle") {

        def renameTaskName = "rename${task.name.capitalize()}Aab"
        def version = "${android.defaultConfig.versionName}"
        def flavor = getFlavor(name)
        def type = getBuildType(name)
        if(flavor == null || type == null) return

        def outputName
        if (flavor == "full")
            outputName = "MyApp-$version"
        else
            outputName = "MyApp-$version-$flavor"

        tasks.register(renameTaskName) {
            def path = "${rootDir}/app/${flavor}/${type}/"
            def originalFile = "$path/app-${flavor}-${type}.aab"

            doLast {
                if (file("$originalFile").exists()) {
                    ant.move file: "$originalFile",
                            tofile: "$path/${outputName}.aab"
                }
            }
        }
        task.finalizedBy(renameTaskName)
    }
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật