@@ -27,23 +27,16 @@ object ApkObf {
27
27
val dexList = workDir.listFiles { name ->
28
28
name.extension == " dex"
29
29
}
30
-
31
- val dexOut = File (workDir," dexDump" )
32
- dexOut.mkdir()
33
-
34
30
dexList?.forEach {
35
31
logCallback.invoke(" Start Obfuscator ${it.name} " )
36
32
val dexInputBean =
37
- InputBean (it.absolutePath, dexOut .absolutePath+ " /" + it.name, inputBean.depth, inputBean.rule)
33
+ InputBean (it.absolutePath, workDir .absolutePath + " /" + it.name, inputBean.depth, inputBean.rule)
38
34
DexObf .run (dexInputBean, logCallback)
39
35
}
40
36
41
-
42
- originApk.copyTo(File (inputBean.output))
43
-
44
37
logCallback.invoke(" Start Package Apk" )
45
38
46
- zip(dexOut .absolutePath, inputBean.output )
39
+ zip(workDir .absolutePath, originApk, targetApk )
47
40
48
41
} catch (e: Exception ) {
49
42
logCallback.invoke(" Error!!!" )
@@ -63,26 +56,23 @@ object ApkObf {
63
56
}
64
57
}
65
58
66
- // todo
67
- private fun zip (path : String , apk : String ) {
59
+ private fun zip (path : String , origin : File , targetApk : File ) {
68
60
val dexList = File (path).listFiles { name ->
69
61
name.extension == " dex"
70
62
}?.toList()
71
63
72
- ZipFile (apk).use {
64
+ origin.copyTo(targetApk)
65
+ ZipFile (targetApk).use {
73
66
it.addFiles(dexList)
74
67
}
75
68
76
69
}
77
70
78
- // todo
71
+
79
72
private fun unzip (apk : String , path : String ) {
80
73
ZipFile (apk).use {
81
74
it.extractAll(path)
82
75
}
83
-
84
76
}
85
77
86
-
87
-
88
78
}
0 commit comments