How to write build time stamp into apk

后端 未结 10 631
别跟我提以往
别跟我提以往 2020-12-02 07:57
  1. Making some changes in Android Contacts package
  2. Using mm (make) command to build this application

Because I have to change and

10条回答
  •  鱼传尺愫
    2020-12-02 08:21

    Method which checks date of last modification of classes.dex, this means last time when your app's code was built:

      try{
         ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), 0);
         ZipFile zf = new ZipFile(ai.sourceDir);
         ZipEntry ze = zf.getEntry("classes.dex");
         long time = ze.getTime();
         String s = SimpleDateFormat.getInstance().format(new java.util.Date(time));
         zf.close();
      }catch(Exception e){
      }
    

    Tested, and works fine, even if app is installed on SD card.

提交回复
热议问题