Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – Gradle assembleDebug和preDexDebug因CircleCI而失败大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_404_1@我尝试使用CircleCI汇编调试器,但它必须无法构建(preDeX).
为什么@R_197_10323@样做?

>使用ProductFlavor(名称为生产)
> Android Gradle ver.1.1.0-rc1

问题

circle.yml

general:
  artifacts:
    - "app/build/outputs/apk/app-production-release-unaligned.apk"
machine:
  java:
    version: openjdk7
  environment:
    ANDROID_HOME: /usr/local/android-sdk-linux

dependencies:
  pre:
    - echo y | android update sdk --no-ui --all --filter "build-tools-21.1.2"
    - echo y | android update sdk --no-ui --all --filter "platform-tools"
    - echo y | android update sdk --no-ui --all --filter "tools"
    - echo y | android update sdk --no-ui --all --filter "extra-google-google_play_services"
    - echo y | android update sdk --no-ui --all --filter "extra-google-m2repository"
    - echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"
    - echo y | android update sdk --no-ui --all --filter "extra-android-support"
    - echo y | android update sdk --no-ui --all --filter "android-21"
    - git submodule sync
    - git submodule update --init
  cache_directories:
    - ~/.android
    - ~/android
  override:
    - ./gradlew dependencies

test:
  override:
    - ./gradlew test

deployment:
  master:
    branch: master
    commands:
      - ./gradlew assembleProductionDebug

解决方法

我遇到过同样的问题.事实证明,我必须为ci版本禁用preDex.

把它放在root build.gradle中:

project.ext.preDexLibs = !project.hasProperty('disablePreDex')

subprojects {
    project.plugins.whenPluginAdded { plugin ->
        if ("com.android.build.gradle.AppPlugin".equals(plugin.class.Name)) {
            project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
        } else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.Name)) {
            project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
        }
    }
}

然后,您可以使用以下命令构建ci:

./gradlew ... -PdisablePreDex

大佬总结

以上是大佬教程为你收集整理的android – Gradle assembleDebug和preDexDebug因CircleCI而失败全部内容,希望文章能够帮你解决android – Gradle assembleDebug和preDexDebug因CircleCI而失败所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。