Getting name of original .APK file in Android

懵懂的女人 提交于 2019-12-04 14:16:56

It is possible to let the app know the apk name that was set at compile time, if that is of any use to you

applicationVariants.all { variant ->
    // Change the target apk file name and path
    String apk_path = "$rootProject.projectDir/bin"
    String apk_name = "john_doe.apk"
    project.delete(project.apk_path) //Delete any remains
    String apkFile = String.format("%s/%s", apk_path, apk_name)
    variant.outputs[0].outputFile = new File(apkFile)
    // This can be used in Java runtime by using getString(R.string.apk_name)
    resValue "string", "apk_name", apk_name
}

But what you are asking, I am pretty sure it is not possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!