相信大家在開發Android App都有個困擾,預設build出來的app file name會叫做app-debug.apk 或是app-release.apk,顯然不符合我們的需求,要改的話要怎麼改? 也沒有很難,
打開你專案下app/build.gradle :
加入以下程式碼
android {
applicationVariants.all { variant ->
variant.outputs.all { output ->
def newFileName = "Your.apk"
output.outputFileName = newFileName
}
}
}改好之後存檔,接著就會依照你指定檔名build出來。
如果你的專案是library呢?
libraryVariants.all { variant ->
variant.outputs.all { output ->
def newFileName = "Your.aar"
output.outputFileName = newFileName
}
}以上就解決我們的需求了。
0 留言