android studio 3.1: build:gradle:3.1.0 - Absolute path are not supported when setting an output file name

后端 未结 7 922
囚心锁ツ
囚心锁ツ 2020-12-05 19:32

When I use Android Studio 3.0 and I use the next version of Android Gradle Plugin in project/build.gradle:

cl         


        
相关标签:
7条回答
  • 2020-12-05 19:52

    Just in case this helps, this error means that now it's not allowed to have absolute paths on anything related to the apk's file name. I can attach you my BEFORE and AFTER to achieve what I needed (to have the APK in the project/app/build/ folder:

    BEFORE gradle 3.1.0

    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            outputFileName = new File(
                    output.outputFile.parent,
                    output.outputFile.name)
        }
    }
    

    IN or AFTER gradle 3.1.0

    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            outputFileName = new File(
                    "./../../../../../build/",
                    output.outputFile.name)
        }
    }
    
    0 讨论(0)
提交回复
热议问题