Skip to content

Could not resolve com.android.tools.build:gradle:8.1.1. #7

@nrob81

Description

@nrob81

Hello, i tried to build my app with this image with no success.
i got this error message.
I run my job with gitlab-runner in my machine.
Can you please help me out with this?

assembleRelease:
  image: mobiledevops/android-sdk-image:30.0.3
  stage: build
  before_script:
     # Writing GE_JOB_ID variable to environment file, will need the value in the next stage.
     - echo GE_JOB_ID=$CI_JOB_ID >> generate_executables.env
  script:
    - mkdir bin
    - ./gradlew clean assembleRelease
    - cp app/build/outputs/apk/release/app-release.apk bin/${APK_BINARY}
    - export JOB_ID=$CI_JOB_ID
  artifacts:
    paths:
      - bin/
    reports:
      dotenv: generate_executables.env
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '8.1.1' apply false
    id 'com.android.library' version '8.1.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.22' apply false
}

tasks.register('clean', Delete) {
    delete rootProject.buildDir
}
plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
}

android {
    namespace 'app.x.sklad'
    compileSdk 34

    defaultConfig {
        applicationId "app.x.sklad"
        minSdk 33
        targetSdk 33
        versionCode 3
        versionName "1.0.4"

        ...
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile(
                    'proguard-android-optimize.txt'),
                    'proguard-rules.pro'
        }       
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }
    buildFeatures {
        compose true
        dataBinding true
    }
    composeOptions {
        kotlinCompilerExtensionVersion '1.4.8'
    }
}

dependencies {
    implementation "androidx.compose.runtime:runtime:1.5.1"
    implementation 'androidx.core:core-ktx:1.12.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.9.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation "androidx.camera:camera-camera2:1.2.3"
    implementation 'androidx.camera:camera-mlkit-vision:1.3.0-beta02'
    implementation 'com.google.mlkit:barcode-scanning:17.2.0'
}

Actual behaviour

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'Sklad'.

Could not resolve all files for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:8.1.1.
Required by:
project : > com.android.application:com.android.application.gradle.plugin:8.1.1
project : > com.android.library:com.android.library.gradle.plugin:8.1.1
> No matching variant of com.android.tools.build:gradle:8.1.1 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.3' but:
- Variant 'apiElements' capability com.android.tools.build:gradle:8.1.1 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
- Variant 'javadocElements' capability com.android.tools.build:gradle:8.1.1 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
- Variant 'runtimeElements' capability com.android.tools.build:gradle:8.1.1 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component, compatible with Java 11 and the consumer needed a component, compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
- Variant 'sourcesElements' capability com.android.tools.build:gradle:8.1.1 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
...

Steps to reproduce the behaviour

Which Docker version is used?

24.0.5

Which host operation system is used?

  • Linux
  • [ ] Windows
  • [ ] macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions