How to retrieve path to ADB in build.gradle

前端 未结 6 1340
無奈伤痛
無奈伤痛 2021-02-05 13:01

I trying to start application via gradle task.


task runDebug(dependsOn: [\'installDebug\', \'run\']) {
}

task run(type: Exec) {
comm         


        
6条回答
  •  渐次进展
    2021-02-05 13:40

    You should use the logic that the Android Gradle plugin already has for finding the SDK and adb locations to ensure your script is using the same ones.

    # Android Gradle >= 1.1.0
    File sdk = android.getSdkDirectory()
    File adb = android.getAdbExe()
    
    # Android Gradle < 1.1.0
    File sdk = android.plugin.getSdkFolder()
    File adb = android.plugin.extension.getAdbExe()
    

提交回复
热议问题