本文介绍了Android Studio 3.5.2脱机安装错误:app @ debug/compileClasspath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助,设置好之后,请按照以下说明进行操作:

Help please,After I setup and I follow this instructions:

配置离线构建依赖项

如果您想在没有网络连接的情况下构建项目,请按照以下步骤将IDE配置为使用离线版本的Android Gradle插件和Google Maven依赖项.

If you'd like to build your project without a network connection,follow the steps below to configure the IDE to use offline versions of the Android Gradle Plugin and Google Maven dependencies.

如果尚未这样做,请从下载页面下载脱机组件.

If you haven't already done so, download the offline components from the downloads page.

下载并解压缩脱机组件

下载脱机组件后,将其内容解压缩到以下目录,如果尚不存在,则可能需要创建以下目录:

After you have downloaded the offline components, unzip their contents into the following directory, which you might need to create if it doesn’t already exist:

•在Windows上:%USER_HOME%/.android/manual-offline-m2/

• On Windows: %USER_HOME%/.android/manual-offline-m2/

•在macOS和Linux上:〜/.android/manual-offline-m2/

• On macOS and Linux: ~/.android/manual-offline-m2/

要更新脱机组件,请按照下列步骤操作:

To update the offline components, proceed as follows:

  1. 删除manual-offline-m2/目录中的内容.
  2. 重新下载脱机组件.
  3. 将下载的ZIP文件的内容解压缩到manual-offline-m2/目录中.在Gradle项目中包含离线组件要告诉Android构建系统使用已下载并解压缩的离线组件,您需要创建一个脚本,如下所述.请记住,即使更新了脱机组件,您也只需创建和保存此脚本一次.
  4. 使用以下路径和文件名创建一个空的文本文件:•在Windows上:%USER_HOME%/.gradle/init.d/offline.gradle•在macOS和Linux上:〜/.gradle/init.d/offline.gradle
  5. 打开文本文件,并包含以下脚本:

  1. Delete the content inside the manual-offline-m2/ directory.
  2. Re-download the offline components.
  3. Unzip the contents of the ZIP files you downloaded into the manual-offline-m2/ directory.Include offline components in your Gradle projectTo tell the Android build system to use the offline components you've downloaded and unzipped, you need to create a script, as described below. Keep in mind, you need to create and save this script only once, even after updating your offline components.
  4. Create an empty text file with the following path and file name:• On Windows: %USER_HOME%/.gradle/init.d/offline.gradle• On macOS and Linux: ~/.gradle/init.d/offline.gradle
  5. Open the text file and include the following script:

def reposDir =新文件(System.properties ['user.home'],.android/manual-offline-m2")

def reposDir = new File(System.properties['user.home'], ".android/manual-offline-m2")

def repos =新的ArrayList()reposDir.eachDir {repos.add(it)}repos.sort()

def repos = new ArrayList()reposDir.eachDir {repos.add(it) }repos.sort()

allprojects {

allprojects {

buildscript {

buildscript {

repositories {

  for (repo in repos) {

    maven {

      name = "injected_offline_${repo.name}"

      url = repo.toURI().toURL()

    }

  }

}

}储存库{

for (repo in repos) {

  maven {

    name = "injected_offline_${repo.name}"

    url = repo.toURI().toURL()

  }

}

}

}

保存文本文件.

我收到此错误:

错误:无法解析':app @ debug/compileClasspath'的依赖关系:无法解析androidx.appcompat:appcompat:1.0.2.禁用离线模式并同步项目显示详细资料受影响的模块:应用

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.Disable offline mode and sync projectShow DetailsAffected Modules: app

错误:无法解析':app @ debug/compileClasspath'的依赖关系:无法解析androidx.constraintlayout:constraintlayout:1.1.3.禁用离线模式并同步项目显示详细资料受影响的模块:应用

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.constraintlayout:constraintlayout:1.1.3.Disable offline mode and sync projectShow DetailsAffected Modules: app

错误:无法解析':app @ debugAndroidTest/compileClasspath'的依赖关系:无法解析androidx.test.ext:junit:1.1.0.禁用离线模式并同步项目显示详细资料受影响的模块:应用

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.test.ext:junit:1.1.0.Disable offline mode and sync projectShow DetailsAffected Modules: app

错误:无法解析':app @ debugAndroidTest/compileClasspath'的依赖关系:无法解析androidx.test.espresso:espresso-core:3.1.1.禁用离线模式并同步项目显示详细资料受影响的模块:应用

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.test.espresso:espresso-core:3.1.1.Disable offline mode and sync projectShow DetailsAffected Modules: app

错误:无法解析':app @ debugAndroidTest/compileClasspath'的依赖关系:无法解析androidx.appcompat:appcompat:1.0.2.禁用离线模式并同步项目显示详细资料受影响的模块:应用

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.Disable offline mode and sync projectShow DetailsAffected Modules: app

错误:无法解析':app @ debugAndroidTest/compileClasspath'的依赖关系:无法解析androidx.constraintlayout:constraintlayout:1.1.3.禁用离线模式并同步项目显示详细资料受影响的模块:应用

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.constraintlayout:constraintlayout:1.1.3.Disable offline mode and sync projectShow DetailsAffected Modules: app

错误:无法解析':app @ debugUnitTest/compileClasspath'的依赖关系:无法解析androidx.appcompat:appcompat:1.0.2.禁用离线模式并同步项目显示详细资料受影响的模块:应用

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.Disable offline mode and sync projectShow DetailsAffected Modules: app

错误:无法解析':app @ debugUnitTest/compileClasspath'的依赖关系:无法解析androidx.constraintlayout:constraintlayout:1.1.3.禁用离线模式并同步项目显示详细资料受影响的模块:应用

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.constraintlayout:constraintlayout:1.1.3.Disable offline mode and sync projectShow DetailsAffected Modules: app

错误:无法解析':app @ debugUnitTest/compileClasspath'的依赖关系:无法解析junit:junit:4.12.禁用离线模式并同步项目显示详细资料受影响的模块:应用

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve junit:junit:4.12.Disable offline mode and sync projectShow DetailsAffected Modules: app

推荐答案

我通过还原 gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

并且还从

恢复 build.gradle 中的 gradle 依赖关系

classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.android.tools.build:gradle:3.3.2'

现在我的项目很好.

这篇关于Android Studio 3.5.2脱机安装错误:app @ debug/compileClasspath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 20:49
查看更多