2014-06-23 4 views
2

디버그 또는 릴리스 모드에서 destiantion 폴더를 설정하려고합니다. 그러나 나는 정말로 성공적이지 않다. 디버그 및 릴리스의 경우 항상 디버그 폴더로 이동합니다. 그리고 만약 내가 디버그 설정을 제거하면 폴더를 릴리스하지만 둘 다 (릴리스 및 디버그).디버그 할 때 안드로이드 스튜디오 출력 폴더

나는 실행 구성을 수정해야한다고 생각하지만 어떻게해야할지 모르겠다.

어떤 도움이 필요합니까?

Gradle을 파일 :

android { 
    compileSdkVersion 19 
    buildToolsVersion "19.1.0" 

    defaultConfig { 
     minSdkVersion 15 
     targetSdkVersion 19 
     versionCode 18 
     versionName "0.70" 
    } 
    signingConfigs { 
     release { 
      storeFile file("xxxx") 
      storePassword "xxxx" 
      keyAlias "xxx" 
      keyPassword "xxxx" 
     } 
    } 
    buildTypes { 
     release { 
      signingConfig signingConfigs.release 
      applicationVariants.all { variant -> 
       def file = variant.outputFile 
       variant.outputFile = new File("C:\\PATH_TO_FOLDER\\release", "name" + defaultConfig.versionName + ".apk") 
      } 
     } 
     debug { 
      applicationVariants.all { variant -> 
       def file = variant.outputFile 
       variant.outputFile = new File("C:\\PATH_TO_FOLDER\\debug", "name_DEBUG_" + defaultConfig.versionName + ".apk") 
      } 
     } 

    } 

} 

답변

1

좋아요 ... 나는 그것을 알아낼.

최상의 솔루션인지는 확실치 않지만 buildtype의 이름을 확인한 다음 그에 따라 출력 폴더를 설정합니다.

buildTypes { 
     release { 
      signingConfig signingConfigs.release 

     } 
     applicationVariants.all { variant -> 
      def file = variant.outputFile 
      println "Build info: $variant.buildType" 
      if (variant.buildType.name=="release") { 
       println "Release mode" 
       variant.outputFile = new File("C:\\PATH_TO_FOLDER\\verify", "app" + defaultConfig.versionName + ".apk") 
      } else { 
       variant.outputFile = new File("C:\\PATH_TO_FOLDER\\debug", "app_DEBUG_" + defaultConfig.versionName + ".apk") 
      } 
     } 

    }