Skip to content

Build-tool 31.0.0 is missing DX #109

@2sem

Description

@2sem

처음에 도입했다가 뭔가 업그레이드 하면서 해결되어서 삭제 했다가 SDK33으로 올리니까 다시 발생해서 추가
윈도우에서는 안돌아가는 커맨드라 OS 구분
dx가 없고 d8이 있는데 dx를 찾으려고 해서 link 파일을 만들어주는 것이다

app/build.gradle

def migrateToDx() {
     def buildToolPath = "${android.sdkDirectory.path}/build-tools/${buildToolsVersion}"
     println "BuildToolPath: ${buildToolPath}"

     def d8Path = "${buildToolPath}/d8"
     def dXPath = "${buildToolPath}/dx"
     def command = "ln -sf ${d8Path} ${dXPath}"
     exec {
         commandLine command.split()
     }

     println "dx to d8 link Created: ${dXPath}"

     def d8JarPath = "${buildToolPath}/lib/d8.jar"
     def dXJarPath = "${buildToolPath}/lib/dx.jar"
     command = "ln -sf ${d8JarPath} ${dXJarPath}"
     exec {
         commandLine command.split()
     }
     println "dx.jar to d8.jar link Created: ${dXJarPath}"
 }

android {
    ...
    if (System.getProperty('os.name').toLowerCase().contains('linux')) {
         migrateToDx()
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions