1. ホーム
  2. アンドロイド

CCのコンポーネント化を使用すると、"Could not determine dependencies of task ':xxxx:compileReleaseJavaWithJavac'" というエラーが報告されます。解決方法

2022-02-28 10:31:51
<パス

エラーの詳細です。

 What went wrong:
Could not determine the dependencies of task ':baseres:compileReleaseJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':baseres:releaseCompileClasspath'.
   > Could not resolve project :baseutils.
     Required by:
         project :baseres
      > Unable to find a matching configuration of project :baseutils:
          - Configuration 'debugApiElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'release' and found incompatible value 'debug'.
              - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
              - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
          - Configuration 'debugBundleElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'release' but no value provided.
              - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but no value provided.
              - Required org.gradle.usage 'java-api' and found incompatible value 'android-bundle'.
          - Configuration 'debugMetadataElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'release' and found incompatible value 'debug'.
              - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Metadata'.
              - Required org.gradle.usage 'java-api' but no value provided.
          - Configuration 'debugRuntimeElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'release' and found incompatible value 'debug'.
              - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
              - Required org.gradle.usage 'java-api' and found incompatible value 'java-runtime'.
          - Configuration 'releaseApiElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'release' and found compatible value 'release'.
              - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
              - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
          - Configuration 'releaseBundleElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'release' but no value provided.
              - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but no value provided.
              - Required org.gradle.usage 'java-api' and found incompatible value 'android-bundle'.
          - Configuration 'releaseMetadataElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'release' and found compatible value 'release'.
              - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Metadata'.
              - Required org.gradle.usage 'java-api' but no value provided.
          - Configuration 'releaseRuntimeElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'release' and found compatible value 'release'.
              - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
              - Required org.gradle.usage 'java-api' and found incompatible value 'java-runtime'.

* 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 f
Run with --scan to get f ull insights.



エラーの解析と解決

コンポーネント化では、コンポーネントが互いに依存しない、つまり baseutils のコンポーネント化でもあります。 Moudle を経由してアクセスすることはできません。 implementation project(':baseutils') を使用する必要があります。 addComponent 'baseutils' addComponent 'baseres', project(':baseres') // parameter 2 can be omitted here コンポーネントの依存関係

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation rootProject.ext.dependencies["kotlin"]
    implementation rootProject.ext.dependencies["constraint_layout"]
    implementation rootProject.ext.dependencies["appcompat_v7"]
    testImplementation rootProject.ext.dependencies["junit"]
    androidTestImplementation rootProject.ext.dependencies["runner"]
    androidTestImplementation rootProject.ext.dependencies["espresso_core"]
    implementation rootProject.ext.dependencies["utilcode"]
// implementation "com.android.support:appcompat-v7:27.1.1"
    // common dependency package
// addComponent 'baseutils'
    implementation project(':baseutils')
}