3
3
require 'yaml'
4
4
require 'fileutils'
5
5
6
- def unpack_apk ( apk_path )
6
+ def unpack_apk ( apk_path , output_path )
7
7
puts "\n [adjust-dtt][i]: Unpacking the APK file ..."
8
- status = system ( { "APK_FILE" => apk_path } , "apktool d -f $APK_FILE" )
8
+ status = system ( { "APK_FILE" => apk_path , "OUTPUT_DIR" => output_path } , "apktool d -f $APK_FILE -o $OUTPUT_DIR " )
9
9
10
10
if status == false
11
11
abort "\n [adjust-dtt][e]: Aborting...\n \n "
12
12
end
13
13
end
14
14
15
- def repack_apk ( apk_name , store_name )
15
+ def repack_apk ( apk_folder , apk_name , store_name )
16
16
puts "[adjust-dtt][i]: Packing the APK file ..."
17
17
status = system ( { "APK_NAME" => apk_name ,
18
+ "APK_PATH" => apk_folder ,
18
19
"STORE_NAME" => store_name } ,
19
- "apktool b $APK_NAME -o ${APK_NAME}_${STORE_NAME}.apk" )
20
+ "apktool b $APK_PATH -o ${APK_NAME}_${STORE_NAME}.apk" )
20
21
21
22
if status == false
22
23
abort "\n [adjust-dtt][e]: Aborting...\n \n "
@@ -168,13 +169,13 @@ def edit_apk_for_store(store_name, store_config)
168
169
adj_apk_path_wo_ext = File . expand_path ( File . basename ( used_apk_path , File . extname ( used_apk_path ) ) )
169
170
170
171
# Unpack the APK file first.
171
- unpack_apk ( used_apk_path )
172
+ unpack_apk ( used_apk_path , adj_apk_folder )
172
173
173
174
# Process the unpacked APK file.
174
175
process_unpacked_apk ( adj_apk_assets , adj_config_file , adj_default_tracker )
175
176
176
177
# Repack the APK file.
177
- repack_apk ( adj_apk_name , store_name )
178
+ repack_apk ( adj_apk_folder , adj_apk_name , store_name )
178
179
179
180
# Sign the APK file.
180
181
sign_apk ( adj_apk_path_wo_ext , store_name , used_keystore_path , used_keystore_pass , used_keystore_alias )
@@ -204,4 +205,4 @@ if __FILE__ == $PROGRAM_NAME
204
205
end
205
206
206
207
puts "[adjust-dtt][i]: Done.\n \n "
207
- end
208
+ end
0 commit comments