diff --git a/adb/Android.bp b/adb/Android.bp
index 7bea1668d587cb999d225b1ff4220ecac69b0edf..6cff0bea1dcbcd539e6d14294466556f9f6de06c 100644
--- a/adb/Android.bp
+++ b/adb/Android.bp
@@ -265,6 +265,10 @@ cc_binary_host {
     // will violate ODR
     shared_libs: [],
 
+    required: [
+        "deploypatchgenerator",
+    ],
+
     target: {
         darwin: {
             cflags: [
diff --git a/adb/client/adb_install.cpp b/adb/client/adb_install.cpp
index 8239dfa90b33084529491f6445facbe89a1e03e3..c0d09fde4e8da6730f9ccc5b984518a5038f733e 100644
--- a/adb/client/adb_install.cpp
+++ b/adb/client/adb_install.cpp
@@ -40,6 +40,8 @@
 #include <android-base/strings.h>
 #include <android-base/test_utils.h>
 
+static constexpr int kFastDeployMinApi = 24;
+
 static bool _use_legacy_install() {
     FeatureSet features;
     std::string error;
@@ -380,7 +382,7 @@ int install_app(int argc, const char** argv) {
     }
 
     if (use_fastdeploy == true) {
-        fastdeploy_init(use_localagent);
+        fastdeploy_set_local_agent(use_localagent);
 
         bool agent_up_to_date = update_agent(agent_update_strategy);
         if (agent_up_to_date == false) {
diff --git a/adb/client/fastdeploy.cpp b/adb/client/fastdeploy.cpp
index c0d793c372171247c6dffd0839cf264bbd30e387..29148362afdd80ad3999ee6be9eda7d9e7056fcb 100644
--- a/adb/client/fastdeploy.cpp
+++ b/adb/client/fastdeploy.cpp
@@ -30,20 +30,13 @@ static constexpr long kRequiredAgentVersion = 0x00000001;
 
 static constexpr const char* kDeviceAgentPath = "/data/local/tmp/";
 
-struct TFastDeployConfig {
-    bool use_localagent;
-};
-
-static TFastDeployConfig& get_fastdeploy_config() {
-    TFastDeployConfig& instance = *new TFastDeployConfig;
-    return instance;
-}
+static bool use_localagent = false;
 
 long get_agent_version() {
     std::vector<char> versionOutputBuffer;
     std::vector<char> versionErrorBuffer;
 
-    int statusCode = capture_shell_command("/data/local/tmp/deployagent.sh version",
+    int statusCode = capture_shell_command("/data/local/tmp/deployagent version",
                                            &versionOutputBuffer, &versionErrorBuffer);
     long version = -1;
 
@@ -68,8 +61,8 @@ int get_device_api_level() {
     return api_level;
 }
 
-void fastdeploy_init(bool use_localagent) {
-    get_fastdeploy_config().use_localagent = use_localagent;
+void fastdeploy_set_local_agent(bool set_use_localagent) {
+    use_localagent = set_use_localagent;
 }
 
 // local_path - must start with a '/' and be relative to $ANDROID_PRODUCT_OUT
@@ -80,7 +73,7 @@ static bool get_agent_component_host_path(const char* local_path, const char* sd
         return false;
     }
 
-    if (get_fastdeploy_config().use_localagent) {
+    if (use_localagent) {
         const char* product_out = getenv("ANDROID_PRODUCT_OUT");
         if (product_out == nullptr) {
             return false;
@@ -105,8 +98,7 @@ static bool deploy_agent(bool checkTimeStamps) {
     }
 
     std::string agent_sh_path;
-    if (get_agent_component_host_path("/system/bin/deployagent.sh", "/deployagent.sh",
-                                      &agent_sh_path)) {
+    if (get_agent_component_host_path("/system/bin/deployagent", "/deployagent", &agent_sh_path)) {
         srcs.push_back(agent_sh_path.c_str());
     } else {
         return false;
@@ -115,7 +107,7 @@ static bool deploy_agent(bool checkTimeStamps) {
     if (do_sync_push(srcs, kDeviceAgentPath, checkTimeStamps)) {
         // on windows the shell script might have lost execute permission
         // so need to set this explicitly
-        const char* kChmodCommandPattern = "chmod 777 %sdeployagent.sh";
+        const char* kChmodCommandPattern = "chmod 777 %sdeployagent";
         std::string chmodCommand =
                 android::base::StringPrintf(kChmodCommandPattern, kDeviceAgentPath);
         int ret = send_shell_command(chmodCommand);
@@ -158,7 +150,7 @@ bool update_agent(FastDeploy_AgentUpdateStrategy agentUpdateStrategy) {
 }
 
 static std::string get_aapt2_path() {
-    if (get_fastdeploy_config().use_localagent) {
+    if (use_localagent) {
         // This should never happen on a Windows machine
         const char* host_out = getenv("ANDROID_HOST_OUT");
         if (host_out == nullptr) {
@@ -214,7 +206,7 @@ int extract_metadata(const char* apkPath, FILE* outputFp) {
         return -1;
     }
 
-    const char* kAgentExtractCommandPattern = "/data/local/tmp/deployagent.sh extract %s";
+    const char* kAgentExtractCommandPattern = "/data/local/tmp/deployagent extract %s";
     std::string extractCommand =
             android::base::StringPrintf(kAgentExtractCommandPattern, packageName.c_str());
 
@@ -231,7 +223,7 @@ int extract_metadata(const char* apkPath, FILE* outputFp) {
 }
 
 static std::string get_patch_generator_command() {
-    if (get_fastdeploy_config().use_localagent) {
+    if (use_localagent) {
         // This should never happen on a Windows machine
         const char* host_out = getenv("ANDROID_HOST_OUT");
         if (host_out == nullptr) {
@@ -269,8 +261,7 @@ std::string get_patch_path(const char* apkPath) {
 }
 
 int apply_patch_on_device(const char* apkPath, const char* patchPath, const char* outputPath) {
-    const std::string kAgentApplyCommandPattern =
-            "/data/local/tmp/deployagent.sh apply %s %s -o %s";
+    const std::string kAgentApplyCommandPattern = "/data/local/tmp/deployagent apply %s %s -o %s";
 
     std::string packageName;
     if (get_packagename_from_apk(apkPath, &packageName) == false) {
@@ -294,8 +285,7 @@ int apply_patch_on_device(const char* apkPath, const char* patchPath, const char
 }
 
 int install_patch(const char* apkPath, const char* patchPath, int argc, const char** argv) {
-    const std::string kAgentApplyCommandPattern =
-            "/data/local/tmp/deployagent.sh apply %s %s -pm %s";
+    const std::string kAgentApplyCommandPattern = "/data/local/tmp/deployagent apply %s %s -pm %s";
 
     std::string packageName;
     if (get_packagename_from_apk(apkPath, &packageName) == false) {
diff --git a/adb/client/fastdeploy.h b/adb/client/fastdeploy.h
index ec24f979ef56e121d091304b4fdfd63dce7ac96b..80f3875c32422eca67f1b0bad1826e03157d3885 100644
--- a/adb/client/fastdeploy.h
+++ b/adb/client/fastdeploy.h
@@ -24,10 +24,7 @@ enum FastDeploy_AgentUpdateStrategy {
     FastDeploy_AgentUpdateDifferentVersion
 };
 
-static constexpr int kFastDeployMinApi = 24;
-
-void fastdeploy_init(bool use_localagent);
-
+void fastdeploy_set_local_agent(bool use_localagent);
 int get_device_api_level();
 bool update_agent(FastDeploy_AgentUpdateStrategy agentUpdateStrategy);
 int extract_metadata(const char* apkPath, FILE* outputFp);
diff --git a/adb/fastdeploy/Android.bp b/adb/fastdeploy/Android.bp
index 30f47308b4721cd608fdcc23a7357d17abda9182..400b12f52955b040a2afccdb5e9641bdca94ad16 100644
--- a/adb/fastdeploy/Android.bp
+++ b/adb/fastdeploy/Android.bp
@@ -14,24 +14,17 @@
 // limitations under the License.
 //
 
-java_library {
+java_binary {
     name: "deployagent",
     sdk_version: "24",
     srcs: ["deployagent/src/**/*.java", "deploylib/src/**/*.java", "proto/**/*.proto"],
     static_libs: ["apkzlib_zip"],
+    wrapper: "deployagent/deployagent.sh",
     proto: {
         type: "lite",
     }
 }
 
-cc_prebuilt_binary {
-    name: "deployagent.sh",
-
-    srcs: ["deployagent/deployagent.sh"],
-    required: ["deployagent"],
-    device_supported: true,
-}
-
 java_binary_host {
     name: "deploypatchgenerator",
     srcs: ["deploypatchgenerator/src/**/*.java", "deploylib/src/**/*.java", "proto/**/*.proto"],