33require 'yaml'
44require 'fileutils'
55
6- def unpack_apk ( apk_path )
6+ def unpack_apk ( apk_path , output_path )
77 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 " )
99
1010 if status == false
1111 abort "\n [adjust-dtt][e]: Aborting...\n \n "
1212 end
1313end
1414
15- def repack_apk ( apk_name , store_name )
15+ def repack_apk ( apk_folder , apk_name , store_name )
1616 puts "[adjust-dtt][i]: Packing the APK file ..."
1717 status = system ( { "APK_NAME" => apk_name ,
18+ "APK_PATH" => apk_folder ,
1819 "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" )
2021
2122 if status == false
2223 abort "\n [adjust-dtt][e]: Aborting...\n \n "
@@ -168,13 +169,13 @@ def edit_apk_for_store(store_name, store_config)
168169 adj_apk_path_wo_ext = File . expand_path ( File . basename ( used_apk_path , File . extname ( used_apk_path ) ) )
169170
170171 # Unpack the APK file first.
171- unpack_apk ( used_apk_path )
172+ unpack_apk ( used_apk_path , adj_apk_folder )
172173
173174 # Process the unpacked APK file.
174175 process_unpacked_apk ( adj_apk_assets , adj_config_file , adj_default_tracker )
175176
176177 # Repack the APK file.
177- repack_apk ( adj_apk_name , store_name )
178+ repack_apk ( adj_apk_folder , adj_apk_name , store_name )
178179
179180 # Sign the APK file.
180181 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
204205 end
205206
206207 puts "[adjust-dtt][i]: Done.\n \n "
207- end
208+ end
0 commit comments