简体   繁体   English

Travis CI Android版本无法检测Product Flavor目录中的文件

[英]Travis CI Android build failed to detect file in Product Flavour directory

My Android project has two product flavour FlavourOne & FlavourTwo and BuildType Debug & Release . 我的Android项目有两个产品风味FlavourOneFlavourTwo和BuildType DebugRelease

My project src directory has 我的项目src目录有

  1. main 主要
  2. FlavourOneDebug FlavourOneDebug
  3. FlavourOneRelease FlavourOneRelease
  4. FlavourTwoDebug FlavourTwoDebug
  5. FlavourTwoRelease FlavourTwoRelease

xxx.xxx.test.constant.FlavourConstant is placed in FlavourOneDebug, FlavourOneRelease, FlavourTwoDebug, FlavourTwoRelease and not in main directory xxx.xxx.test.constant.FlavourConstant放在FlavourOneDebug,FlavourOneRelease,FlavourTwoDebug,FlavourTwoRelease中,而不是放在主目录中

xxx.xxx.test.MainActivity which is placed in main directory imports FlavourConstant 放置在主目录中的xxx.xxx.test.MainActivity导入FlavourConstant

here is my travis.yml 这是我的travis.yml

language: android
sudo: required
jdk: oraclejdk8

android:
  components:

  # The BuildTools version used by your project
  - build-tools-26.0.2

  # The SDK version used to compile your project
  - android-26

  # Additional components
  - extra-google-google_play_services
  - extra-google-m2repository
  - extra-android-m2repository

  before_cache:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/

  cache:
    directories:
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/
    - $HOME/.android/build-cache

    before_install:
    - mkdir "$ANDROID_HOME/licenses" || true
    - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
    - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"

script:
  - ./gradlew build --stacktrace

Travis CI failed to reference FlavourConstant from product flavour directory. Travis CI未能从产品风味目录中引用FlavourConstant。

在此输入图像描述

Reference to Travis failed job https://travis-ci.org/KarthikUCH/MokaTest/jobs/527169383 参考Travis失败的工作https://travis-ci.org/KarthikUCH/MokaTest/jobs/527169383

Finally managed to solve the issue, which is actually caused by the flavour source set directory naming. 最后设法解决了这个问题,这实际上是由flavor源集目录命名造成的。

The Gradle task in Travis expects the flavour directory to be CaseSensitive. Travis中的Gradle任务期望flavor目录为CaseSensitive。

Changed the directory naming form flavoruonedebug to flavoruoneDebug solved the issue 将目录命名格式flavoruonedebug更改为flavoruoneDebug解决了该问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM