NativeScript / NativeScript/android

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

Đang mở
#1,829 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
C++
Star
563
Fork
144
Merge trung bình
10 giờ 46 phút
Pull request đã merge (30 ngày)
14

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách lần theo cách phiên bản Android Gradle plugin được chọn từ package.json version_info đến platforms/tempPlugin/core/build.gradle, quanh dòng 40; so sánh đường đi đó với before-plugins.gradle. Tái hiện lỗi tương thích với Java 8, sau đó xác minh rằng override được yêu cầu được áp dụng và Android build được resolve thành công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
android, java
Lĩnh vực
build-system, mobile-dev
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.