NativeScript / NativeScript/android

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

オープン
#1,829 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C++
スター
563
フォーク
144
平均マージ
10時間 46分
マージ済み PR(30日)
14

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、Android Gradle plugin のバージョンが package.json version_info から platforms/tempPlugin/core/build.gradle の 40 行目付近までどのように選択されるかを追跡し、その経路を before-plugins.gradle と比較します。Java 8 の互換性エラーを再現した後、要求された override が適用され、Android build が正常に解決されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, java
領域
build-system, mobile-dev
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。