diff --git a/src/main.c b/src/main.c index 4a403262..ca580fbf 100644 --- a/src/main.c +++ b/src/main.c @@ -1728,18 +1728,15 @@ static jint _tf_server_main(JNIEnv* env, jobject this_object, jstring files_dir, tf_printf("uv_chdir: %s\n", uv_strerror(result)); } - size_t port_file_arg_length = strlen(out_port_file) + strlen("out_http_port_file=") + 1; - char* port_file_arg = alloca(port_file_arg_length); - snprintf(port_file_arg, port_file_arg_length, "out_http_port_file=%s", out_port_file); + size_t args_length = strlen(out_port_file) + strlen("--args=http_port=0,out_http_port_file=") + 1; + char* args_buffer = alloca(args_length); + snprintf(args_buffer, args_length, "--args=http_port=0,out_http_port_file=%s", out_port_file); const char* args[] = { "run", "-z", apk, - "-a", - port_file_arg, - "-p", - "0", + args_buffer, }; tf_task_set_android_service_callbacks(_tf_service_start, _tf_service_stop);