XZ: Android application building practice + Principle elaboration

Based on the latest construction tool chain, this course takes the development and release of a page routing framework as the main line, combines actual practice with theory, and deeply learns Gradle’s popular compile-time annotation processing, bytecode peg and other advanced technologies, leading everyone to systematically master the knowledge of Android application construction and improve the development efficiency.

Technical language: Groovy/Java/Kotlin Android: Mac IDE: Android Studio 4.0+Gradle: 6.0+ Android Gradle Plugin: 4.1.0+

Coding =UTF-8 XingHeStudio File to MD5 and SHA1 Create by stream. Wang 2012-04-10 Modify by XingHeStudio.com Stream.Wang 2012-04-10 def fil_changefileext(filename,extname=”): FIL ChangeFileExt change filename filename change file path name extname= “to change the filename extension, for example. TXT import OS try: if extname[0]<>’.’: extname=’.’+extname except: extname=” if os.path.splitext(filename)[1]==”: uouttxt=filename+’.’+extname elif os.path.splitext(filename)[1]==’.’: uouttxt=filename+extname else: uouttxt=filename[:0-len(os.path.splitext(filename)[1])]+extname return uouttxt def fil_str2file(fstr,filename):

FIL STR2File Stores the string to a file

copy

try:
    outfile=open(filename,'w')
    outfile.writelines(fstr)
    outfile.close()
    return True   
except:
    return False
Copy the code

System main program start

if name == ‘main’: Import OS,sys,math if len(sys.argv)==1:sys.argv.append(r’c:\ freenas-8.0.4-release-x64.iso ‘) if len(sys.argv)>1: filepathname=sys.argv[1] if os.path.isfile(filepathname) : Fmaxs = os.path. getSize (FilepathName)+0.00 fpos = 0.00 ppos=0 pmax=50 pjy=0 fMD5 = fil_Changefileext (filepathName,’.md5′) FFM =os.path.basename(filepathname) print ‘Program Runing “‘+filepathname+'” … ‘ import hashlib try: Umd5str = hashlib.md5() usha1str = hashlib.sha1() xFilepathName = Unicode (filepathname,’utf8′) needs to read file contents in binary format ufile = file(xfilepathname,’rb’) while True: datas = ufile.read(1024

if not datas: break

umd5str.update( datas )

usha1str.update( datas )

fpos=fpos+1024

512

ppos=int(math.floor(fpos / fmaxs

50))

pposbfh=int(math.floor(fpos / fmaxs

If pjy<>ppos: print ‘[‘+’

ppos +’=’

Print (pmax-ppos)+’] ‘+ STR (pposbfh) +’%’ Pjy =ppos uoutstrmd5= STR (umd5str.hexdigest()) uoutstrsha1= STR (usha1str.hexdigest()) ufile.close() print ” fil_str2file(uoutstrmd5+’

‘+ffm+’\n’,fmd5) fil_str2file(uoutstrsha1+’ *’+ffm+’\n’,fsha1) print ‘Task is completed ! ‘ + r’ [ XingHe Studio File to MD5 and SHA1 ]’ except: print ‘Error ! ‘ + r’ [ XingHe Studio File to MD5 and SHA1 ]’ else: print ‘File “‘+filepathname+'” not exist! ‘+ r’ [ XingHe Studio File to MD5 and SHA1 ]’ else: print r’ [ XingHe Studio File to MD5 and SHA1 ]’