Android Studio Gradle Build Error: Could not determine the dependencies of task ':app:compileFreeDebugJavaWithJavac'

问题描述 投票:0回答:2

然后在我的设备上构建或启动时出现以下错误:

Could not determine the dependencies of task ':app:compileFreeDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:freeDebugCompileClasspath'.
   > Could not resolve project :capacitor-android.
     Required by:
         project :app
      > No matching configuration of project :capacitor-android was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'minApi' with value '____free', attribute 'tier' with value 'free', attribute 'abi' with value 'x86' but:
          - None of the consumable configurations have attributes.

它正在使用 grable 构建我的项目。

我也尝试过 Build Clean、Build Rebuild 和 File > Invlaidate Caches 和 Resatrt。

请帮助。

android gradle ionic4 capacitor ionic-vue
2个回答
0
投票

安装 jetifier 解决了我的错误 通过执行

npm install jetifier

Jetifier 工具迁移 support-library-dependent 库以依赖等效的 AndroidX 包


0
投票

我遇到了同样的错误,在我的例子中,android 文件夹是在 wsl 中生成的,并复制到 windows 文件夹中以使用 android studio 构建 apk,node_modules 文件夹是必需的,因为 android 项目引用了 ../node_modules/@capacitor /.......

您可以复制 node_modules 或只复制 package.json 并运行 npm install

android和node_modules文件夹需要在同一层

© www.soinside.com 2019 - 2024. All rights reserved.