【问题标题】:Cant use android studio virtual machine无法使用android studio虚拟机
【发布时间】:2020-03-18 22:24:34
【问题描述】:

我安装了 android studio 并更新了所有功能。我创建了一个虚拟设备然后尝试运行一个简单的 hello world 文本,这就是我得到的错误

">任务:app:preBuild UP-TO-DATE

任务:app:preDebugBuild UP-TO-DATE 任务:app:generateDebugBuildConfig UP-TO-DATE 任务:app:javaPreCompileDebug UP-TO-DATE 任务:app:compileDebugAidl NO-SOURCE 任务 :app:compileDebugRenderscript 无源 任务:app:mainApkListPersistenceDebug UP-TO-DATE 任务:app:generateDebugResValues UP-TO-DATE 任务:app:generateDebugResources UP-TO-DATE 任务 :app:mergeDebugResources 失败

FAILURE:构建失败并出现异常。

  • 出了什么问题: 任务 ':app:mergeDebugResources' 执行失败。

    无法解析配置“:app:_internal_aapt2_binary”的所有文件。 无法解析 com.android.tools.build:aapt2:3.6.1-6040484。 要求: 项目:应用程序 没有可用于离线模式的 com.android.tools.build:aapt2:3.6.1-6040484 缓存版本。 没有缓存版本的 com.android.tools.build:aapt2:3.6.1-6040484 可用于离线模式。

  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

  • 通过https://help.gradle.org获得更多帮助

在 357 毫秒内构建失败"

我已经尝试过“*try”部分中的内容,但我似乎无法让它发挥作用。

我该怎么办?

【问题讨论】:

  • 请发布您的 build.gradle 文件

标签: android virtual-machine


【解决方案1】:

看起来 Gradle 正在尝试在离线模式下工作。确保您有一个活跃、稳定的互联网连接,并且 Offline workSettings -> Build, Execution, Deployment -> Build Tools -> Gradle 中被禁用

【讨论】:

    【解决方案2】:

    Could not resolve com.android.tools.build:aapt2:3.6.1-6040484
    AAPT2(Android 资产打包工具 2)已移至 Google 的 Maven 存储库,请阅读: https://developer.android.com/studio/releases/#aapt2_gmaven

    buildscript {
        repositories {
            google() // make sure you have this
            jcenter()
    
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.4.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()  //and this
            jcenter()
    
        }
    }
    

    在 build.gradle(项目)中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多