android icon indicating copy to clipboard operation
android copied to clipboard

Error: Could not resolve com.android.tools.build:gradle:8.3.2

Open danielritter opened this issue 1 year ago • 0 comments

Environment My app.gradle:

// You can add your native dependencies here
dependencies {
//  implementation 'androidx.multidex:multidex:2.0.1'
}

android {
    compileSdkVersion 34
    buildToolsVersion "34"
    defaultConfig {
        minSdkVersion 23
        targetSdkVersion 34
        generatedDensities = []
    }

    aaptOptions {
        additionalParameters "--no-version-vectors"
    }
}

and before-plugins.gradle:

// this configurations is loaded before building plugins, as well as before building
// the app - this is where you can apply global settings and overrides

project.ext {
    // androidXAppCompat = "1.4.1"
    // androidXExifInterface = "1.3.3"
    // androidXFragment = "1.4.1"
    // androidXMaterial = "1.5.0"
    // androidXMultidex = "2.0.1"
    // androidXTransition = "1.4.1"
    // androidXViewPager = "1.0.0"

    useKotlin = true
    kotlinVersion = "1.6.0"
    androidBuildToolsVersion = "8.4.0"
}

Describtion During building I get the following error and nothing changes even when I add androidBuildToolsVersion = "8.4.0" to before-plugings.gradle:

...
 @ ./src/main.ts 2:0-28
WARNING in ./src/app.android.scss
Module Warning (from ../../../../node_modules/@nativescript/webpack/node_modules/sass-loader/dist/cjs.js):
26 repetitive deprecation warnings omitted.
 @ ./src/main.ts 2:0-28
webpack 5.96.1 compiled with 16 warnings in 7855 ms
Webpack compilation complete.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'core'.
> Could not resolve all files for configuration ':classpath'.

> Could not resolve com.android.tools.build:gradle:8.3.2.
     Required by:
         project :
      > No matching variant of com.android.tools.build:gradle:8.3.2 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.4' but:
          - Variant 'apiElements' capability com.android.tools.build:gradle:8.3.2 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.4')
          - Variant 'javadocElements' capability com.android.tools.build:gradle:8.3.2 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.4')
          - Variant 'runtimeElements' capability com.android.tools.build:gradle:8.3.2 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.4')
          - Variant 'sourcesElements' capability com.android.tools.build:gradle:8.3.2 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.4')
* 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 855ms
Failed to build plugin @nativescript/core : 
Error: Command gradlew.bat failed with exit code 1

Both version seems the be hardcoded here: https://github.com/search?q=repo%3ANativeScript%2Fandroid%208.3.2&type=code and the androidBuildToolsVersion = "8.4.0" does not have any effect on the version. In the error message and under platforms/tempPlugin/core/build.gradle on line 40, it shows always the version 8.3.2: classpath 'com.android.tools.build:gradle:8.3.2'. It seems to come from package.json version_info. I tried Java 1.8, 11 and 23.

I would like to be able to override the gradle version number, so that I can resolve the error.

danielritter avatar Dec 29 '24 22:12 danielritter