展开
拓展 关闭
订阅号推广码
GitHub
视频
公告栏 关闭

Android常见错误

错误1

A problem occurred configuring root project '����ʶ��'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:8.4.0.
     Required by:
         project : > com.android.application:com.android.application.gradle.plugin:8.4.0
         project : > com.android.library:com.android.library.gradle.plugin:8.4.0
      > No matching variant of com.android.tools.build:gradle:8.4.0 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.6' but:
          - Variant 'apiElements' capability com.android.tools.build:gradle:8.4.0 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.6')
          - Variant 'javadocElements' capability com.android.tools.build:gradle:8.4.0 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.6')
  • 解决方案:File -> Project Structure -> SDK Location -> JDK location was moved to Gradle Settings.

  • 将Gradle user home和项目的Gradle JDK改为一样的版本目录

报错2

The project is using an incompatible version (AGP 8.3.0-alpha01) of the Android Gradle plugin. Latest supported version is AGP 8.1.3.
  • 解决方案,将如下2个文件中的版本改小

报错3

Error running app:No target device found
  • 解决方案:先创建模拟环境,再点击运行
posted @ 2024-07-04 19:16  DogLeftover  阅读(97)  评论(0编辑  收藏  举报