新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
Android如何修改APK的默認(rèn)名稱
Android 如何修改APK的默認(rèn)名稱
創(chuàng)新互聯(lián)建站主營(yíng)略陽(yáng)網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,app軟件定制開(kāi)發(fā),略陽(yáng)h5小程序開(kāi)發(fā)搭建,略陽(yáng)網(wǎng)站營(yíng)銷推廣歡迎略陽(yáng)等地區(qū)企業(yè)咨詢
用Android Studio 打包App時(shí)生成的名稱默認(rèn)是 app-release.apk(已簽名) 或 app-debug.apk(測(cè)試版)。
要想打包時(shí)修改默認(rèn)名稱,可以打開(kāi)在build.gradle(module:app)文件,在android{}中添加如下代碼:
android.applicationVariants.all { variant -> variant.outputs.each { output -> def outputFile = output.outputFile if (outputFile != null && outputFile.name.endsWith('.apk')) { //這里修改apk文件名 def fileName = outputFile.name.replace("app", "你想要的名字") output.outputFile = new File(outputFile.parent, fileName) } } }
寫(xiě)完直接點(diǎn)擊工具欄Build中的 BuildApk 或是使用簽名打包即可。
效果圖如下:
其實(shí),還可以是這樣:右鍵—>重命名 。
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
本文標(biāo)題:Android如何修改APK的默認(rèn)名稱
當(dāng)前鏈接:http://fisionsoft.com.cn/article/jjoodh.html