// 获取当前程序路径 /data/data/com.example.androiduninstall3/files
String path1 = getApplicationContext().getFilesDir().getAbsolutePath();
// 获取该程序的安装包路径 /data/app/com.example.androiduninstall3-1.apk
String path2 = getApplicationContext().getPackageResourcePath();
原文链接:https://blog.csdn.net/ding1145536113/article/details/42678179