当一个项目作为模块添加到另一个项目时,Android Studio Gradle构建失败?

时间:2019-04-10 05:12:37

标签: android gradle module

我有两个不同的项目,并尝试将一个项目作为模块添加到另一个项目,并成功将项目作为模块导入。但是,当我从项目结构中添加依赖项时,gradle会显示以下错误:

Error:Unable to find a matching configuration of project :appim:
  - Configuration 'debugApiElements':
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
      - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
      - Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
  - Configuration 'debugMetadataElements':
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Metadata'.
      - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
      - Required org.gradle.api.attributes.Usage 'java-api' but no value provided.
  - Configuration 'debugRuntimeElements':
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
      - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
      - Required org.gradle.api.attributes.Usage 'java-api' and found incompatible value 'java-runtime'.
  - Configuration 'releaseApiElements':
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
      - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
      - Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
  - Configuration 'releaseMetadataElements':
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Metadata'.
      - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
      - Required org.gradle.api.attributes.Usage 'java-api' but no value provided.
  - Configuration 'releaseRuntimeElements':
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
      - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
      - Required org.gradle.api.attributes.Usage 'java-api' and found incompatible value 'java-runtime'.

我从下面的链接尝试了解决方案,但无法解决。

Gradle 4.0 Unable to find a matching configuration

Android Studio 3.0 Compile Issue (Cannot choose between Configurations)

0 个答案:

没有答案