Browse Source

合并 新旧打包脚本

kaiweicai 2 năm trước cách đây
mục cha
commit
b9abee7ba9
100 tập tin đã thay đổi với 4036 bổ sung0 xóa
  1. 80 0
      V1/Aapt_Util.py
  2. 1406 0
      V1/ChannelReplace.py
  3. 23 0
      V1/CommonUtils.py
  4. 68 0
      V1/Contants.py
  5. 22 0
      V1/Exec_Cmd_Utils.py
  6. 393 0
      V1/File.py
  7. 185 0
      V1/GeneralModifySmali.py
  8. 70 0
      V1/HttpUtils.py
  9. 87 0
      V1/Icon_Util.py
  10. 19 0
      V1/Json_Util.py
  11. 21 0
      V1/PrintLog.py
  12. 325 0
      V1/Replace.py
  13. 36 0
      V1/Replace_GameRes_Utils.py
  14. 64 0
      V1/apk_utils.py
  15. 568 0
      V1/merge_ad_pkg.py
  16. 669 0
      V1/merge_apk.py
  17. 0 0
      V2/README.md
  18. 0 0
      V2/apk_tool.py
  19. 0 0
      V2/channel/huawei/assets/agconnect-services.json
  20. 0 0
      V2/channel/huawei/assets/grs_sdk_global_route_config_apptouchupdatesdk.json
  21. 0 0
      V2/channel/huawei/assets/grs_sdk_global_route_config_opendevicesdk.json
  22. 0 0
      V2/channel/huawei/assets/grs_sdk_global_route_config_opensdkService.json
  23. 0 0
      V2/channel/huawei/assets/grs_sdk_global_route_config_updatesdk.json
  24. 0 0
      V2/channel/huawei/assets/grs_sdk_server_config.json
  25. 0 0
      V2/channel/huawei/assets/grs_sp.bks
  26. 0 0
      V2/channel/huawei/assets/hmsincas.bks
  27. 0 0
      V2/channel/huawei/assets/hmsrootcas.bks
  28. 0 0
      V2/channel/huawei/assets/updatesdkcas.bks
  29. 0 0
      V2/channel/huawei/assets/yyxx_game/yyxx_cfg.properties
  30. 0 0
      V2/channel/huawei/huawei_sdk_config.xml
  31. 0 0
      V2/channel/huawei/res/drawable-hdpi-1208x720-v4/c_buoycircle_icon_normal.png
  32. 0 0
      V2/channel/huawei/res/drawable-hdpi-v4/c_buoycircle_hide_float_eye_off_gray.png
  33. 0 0
      V2/channel/huawei/res/drawable-hdpi-v4/c_buoycircle_icon.png
  34. 0 0
      V2/channel/huawei/res/drawable-hdpi-v4/c_buoycircle_icon_normal.png
  35. 0 0
      V2/channel/huawei/res/drawable-hdpi-v4/c_buoycircle_red_dot.png
  36. 0 0
      V2/channel/huawei/res/drawable-hdpi-v4/hms_game_achievement_finish.png
  37. 0 0
      V2/channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_hide_float_eye_off_gray.png
  38. 0 0
      V2/channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_icon.png
  39. 0 0
      V2/channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_icon_normal.png
  40. 0 0
      V2/channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_red_dot.png
  41. 0 0
      V2/channel/huawei/res/drawable-xhdpi-v4/hms_game_achievement_finish.png
  42. 0 0
      V2/channel/huawei/res/drawable-xhdpi-v4/upsdk_cancel_normal.png
  43. 0 0
      V2/channel/huawei/res/drawable-xhdpi-v4/upsdk_cancel_pressed_bg.png
  44. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_hide_float_eye_off_gray.png
  45. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_icon.png
  46. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_icon_normal.png
  47. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_red_dot.png
  48. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/hms_game_achievement_finish.png
  49. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_normal.png
  50. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_round_black.png
  51. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_round_normal.png
  52. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_round_white.png
  53. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_white.png
  54. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/upsdk_cancel_normal.png
  55. 0 0
      V2/channel/huawei/res/drawable-xxhdpi-v4/upsdk_cancel_pressed_bg.png
  56. 0 0
      V2/channel/huawei/res/drawable-xxxhdpi-v4/c_buoycircle_hide_float_eye_off_gray.png
  57. 0 0
      V2/channel/huawei/res/drawable-xxxhdpi-v4/c_buoycircle_icon_normal.png
  58. 0 0
      V2/channel/huawei/res/drawable-xxxhdpi-v4/c_buoycircle_red_dot.png
  59. 0 0
      V2/channel/huawei/res/drawable-xxxhdpi-v4/hms_game_achievement_finish.png
  60. 0 0
      V2/channel/huawei/res/drawable-xxxhdpi-v4/upsdk_cancel_normal.png
  61. 0 0
      V2/channel/huawei/res/drawable-xxxhdpi-v4/upsdk_cancel_pressed_bg.png
  62. 0 0
      V2/channel/huawei/res/drawable/c_buoycircle_hide_float_top.9.png
  63. 0 0
      V2/channel/huawei/res/drawable/c_buoycircle_hide_guide.gif
  64. 0 0
      V2/channel/huawei/res/drawable/c_buoycircle_hide_shape.xml
  65. 0 0
      V2/channel/huawei/res/drawable/c_buoycircle_hide_shape_red.xml
  66. 0 0
      V2/channel/huawei/res/drawable/hms_game_achievement_bg_shape.xml
  67. 0 0
      V2/channel/huawei/res/drawable/upsdk_cancel_bg.xml
  68. 0 0
      V2/channel/huawei/res/drawable/upsdk_third_download_bg.xml
  69. 0 0
      V2/channel/huawei/res/layout-land/c_buoycircle_hide_guide_dialog.xml
  70. 0 0
      V2/channel/huawei/res/layout/activity_endisable_service.xml
  71. 0 0
      V2/channel/huawei/res/layout/c_buoycircle_hide_guide_dialog.xml
  72. 0 0
      V2/channel/huawei/res/layout/c_buoycircle_hide_notice.xml
  73. 0 0
      V2/channel/huawei/res/layout/c_buoycircle_window_small.xml
  74. 0 0
      V2/channel/huawei/res/layout/hms_game_achievement_finish.xml
  75. 0 0
      V2/channel/huawei/res/layout/hms_game_top_async_login.xml
  76. 0 0
      V2/channel/huawei/res/layout/upsdk_app_dl_progress_dialog.xml
  77. 0 0
      V2/channel/huawei/res/layout/upsdk_ota_update_view.xml
  78. 0 0
      V2/channel/huawei/res/values-am/values-am.xml
  79. 0 0
      V2/channel/huawei/res/values-ar/values-ar.xml
  80. 0 0
      V2/channel/huawei/res/values-as/values-as.xml
  81. 0 0
      V2/channel/huawei/res/values-az/values-az.xml
  82. 0 0
      V2/channel/huawei/res/values-b+jv+Latn/values-b+jv+Latn.xml
  83. 0 0
      V2/channel/huawei/res/values-b+my+Qaag/values-b+my+Qaag.xml
  84. 0 0
      V2/channel/huawei/res/values-b+sr+Latn/values-b+sr+Latn.xml
  85. 0 0
      V2/channel/huawei/res/values-be/values-be.xml
  86. 0 0
      V2/channel/huawei/res/values-bg/values-bg.xml
  87. 0 0
      V2/channel/huawei/res/values-bn/values-bn.xml
  88. 0 0
      V2/channel/huawei/res/values-bo-rCN/values-bo-rCN.xml
  89. 0 0
      V2/channel/huawei/res/values-bs/values-bs.xml
  90. 0 0
      V2/channel/huawei/res/values-ca/values-ca.xml
  91. 0 0
      V2/channel/huawei/res/values-cs/values-cs.xml
  92. 0 0
      V2/channel/huawei/res/values-da/values-da.xml
  93. 0 0
      V2/channel/huawei/res/values-de/values-de.xml
  94. 0 0
      V2/channel/huawei/res/values-el/values-el.xml
  95. 0 0
      V2/channel/huawei/res/values-en-rAU/values-en-rAU.xml
  96. 0 0
      V2/channel/huawei/res/values-en-rGB/values-en-rGB.xml
  97. 0 0
      V2/channel/huawei/res/values-es-rUS/values-es-rUS.xml
  98. 0 0
      V2/channel/huawei/res/values-es/values-es.xml
  99. 0 0
      V2/channel/huawei/res/values-et/values-et.xml
  100. 0 0
      V2/channel/huawei/res/values-eu/values-eu.xml

+ 80 - 0
V1/Aapt_Util.py

@@ -0,0 +1,80 @@
+# -*- coding:UTF-8 -*-
+
+
+import os
+from V1 import File, apk_utils
+from V1.PrintLog import printlog
+#生成R文件
+def createRFile(apkPath,aapt2disable,pkgName=""):
+    mergeRes(apkPath)
+    genPath = os.path.join(apkPath, 'gen')
+    if not os.path.exists(genPath):
+        os.mkdir(genPath)
+    if aapt2disable:
+        createRFileCmd = "%s/aapt p -f -m -J %s/gen -M %s/AndroidManifest.xml -I %s/android.jar -S %s/res " % (
+            apk_utils.getComplieToolsHome(), apkPath, apkPath, apk_utils.getToolsJarHome(), apkPath)
+        printlog("createRFileCmd:%s" % createRFileCmd)
+        if os.system(createRFileCmd) != 0:
+            return 1
+    else:
+        complieResPath = os.path.join(genPath, 'resource.zip')
+        sdkResPath = os.path.join(apkPath, 'res')
+        complieResCmd = '%s/aapt2 compile --dir %s -o %s' % (
+        apk_utils.getComplieToolsHome(), sdkResPath, complieResPath)
+        print("complieResCmd:%s" % complieResCmd)
+        if os.system(complieResCmd) != 0:
+            return 1
+            # link
+        print('link res ...')
+        outApk = os.path.join(genPath, 'sources.apk')
+        linkResCmd = '%s/aapt2 link -o %s  -I %s/android.jar --manifest %s/AndroidManifest.xml --java %s/  %s --custom-package %s' % (
+            apk_utils.getComplieToolsHome(), outApk, apk_utils.getToolsJarHome(), apkPath, genPath, complieResPath, pkgName)
+
+        print('link cmd is %s' % linkResCmd)
+
+        if os.system(linkResCmd) != 0:
+            return 1
+
+    sourcePath = pkgName.replace(".", "/")
+    createRClassCmd = "%s/javac -source 1.8 -target 1.8 %s/gen/%s/R.java" % (
+    apk_utils.getJavaBinPath(), apkPath, sourcePath)
+    printlog("createRClassCmd:%s" % createRClassCmd)
+    if os.system(createRClassCmd) != 0:
+        return 1
+
+    createDexCmd = "%s/dx --dex --output %s/classes.dex %s/gen" % (
+        apk_utils.getSdkToolsPath(), apkPath, apkPath)
+    printlog("createDexCmd:%s" % createDexCmd)
+    if os.system(createDexCmd) != 0:
+        return 1
+
+    dexPath = "%s/classes.dex" %apkPath
+    dex2smaliCmd = "%s/java -jar %s/baksmali-2.1.0.jar -o %s/smali %s" % (
+        apk_utils.getJavaBinPath(), apk_utils.getToolsJarHome(), apkPath, dexPath)
+    printlog("dex2smaliCmd:%s" % dex2smaliCmd)
+
+    if os.system(dex2smaliCmd) != 0:
+        return 1
+
+    File.safeFileDelete(dexPath)
+    printlog("finished compiling resources -----------------------------------")
+    return 0
+
+
+
+def mergeRes(apkPath):
+    allResDir = ['drawable', 'drawable-ldpi', 'drawable-mdpi', 'drawable-hdpi',
+                   'drawable-xhdpi'
+        , 'drawable-xxhdpi', 'drawable-xxxhdpi',
+                   'drawable-xhdpi-v4', 'drawable-xxhdpi-v4', 'drawable-xxxhdpi-v4',
+                   'mipmap-ldpi', 'mipmap-mdpi', 'mipmap-hdpi', 'mipmap-xhdpi',
+                   'mipmap-xxhdpi', 'mipmap-xxxhdpi']
+    for file in allResDir:
+        resdir ="%s/res/%s"%(apkPath,file)
+        print ("resdir :%s" % resdir)
+        v4dir = "%s/res/%s-v4"%(apkPath,file)
+        print ("v4dir :%s" % v4dir)
+        if os.path.exists(v4dir) == True:
+            File.copyAllFile(resdir, v4dir)
+            File.safeFileDelete(resdir)
+    pass

+ 1406 - 0
V1/ChannelReplace.py

@@ -0,0 +1,1406 @@
+# -*-coding:utf-8-*-
+import os
+import xml.etree.ElementTree as ET
+import re
+
+import hashlib
+
+import shutil
+import json
+from V1.PrintLog import printlog
+from V1 import Contants, File, GeneralModifySmali, Replace, Aapt_Util, apk_utils
+from xml.etree.ElementTree import Element
+
+
+# 联想
+def LenovoReplace(prj_path, dir_split, key, value):
+    if (key == "OPENAPPID"):
+        # 替换联想id
+        replaceLeonovoIdShell = 'sed -i "1,\\$s/lenovo_id/%s/g" %s/AndroidManifest.xml ' % (value, prj_path)
+        printlog("replaceLeonovoIdShell: %s" % replaceLeonovoIdShell)
+        os.system(replaceLeonovoIdShell)
+
+        manifestRootExt = r'<application android:networkSecurityConfig="@xml/network_security_config"'
+        replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
+        printlog("LenovoReplace replace add application root point shell: %s" % replacePkgNameShell)
+        os.system(replacePkgNameShell)
+    pass
+
+
+# 豌豆荚
+def WandoujiaReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : wdj")
+    if (key == "APPKEY_ID"):
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        printlog("prj_am_path :%s" % prj_am_path)
+        lines = open(prj_am_path).readlines()
+        fp = open(prj_am_path, 'w')
+        for s in lines:
+            if (s.find("Wandoujia-PaySdk-") != -1):
+                printlog("replace Wandoujia-PaySdk-%s" % value)
+                s = re.sub('Wandoujia-PaySdk-.*\"', 'Wandoujia-PaySdk-' + value + '\"', s)
+            fp.write(s)
+        fp.close()
+    pass
+
+
+# 虫虫
+def ChongchongReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : Chongchong")
+    if (key == "app_id"):
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        printlog("prj_am_path :%s" % prj_am_path)
+        lines = open(prj_am_path).readlines()
+        fp = open(prj_am_path, 'w')
+        for s in lines:
+            if (s.find("qqPay") != -1):
+                printlog("replace qqPay:%s" % value)
+                s = re.sub('qqPay.*\"', 'qqPay' + value + '\"', s);
+            fp.write(s)
+        fp.close()
+
+    # 360
+
+
+def QihuReplace(prj_path, dir_split, key, value):
+    global appkey
+    printlog("specail replace : 360")
+    if (key == "QHOPENSDK_APPKEY"):
+        replacePkgNameShell = 'sed -i "s/qihu_appkey/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
+        printlog("QihuReplace replace qihu_appkey shell: %s" % replacePkgNameShell)
+        os.system(replacePkgNameShell)
+    if (key == "QHOPENSDK_APPSECRET"):
+        prj_param = "%s/assets/YyrhParam.cnf" % prj_path
+        prj_am_path = "%s/AndroidManifest.xml" % prj_path
+        appsecret = value
+        metadatas = ET.parse(prj_am_path).getroot().find("application").findall("meta-data")
+        for meta in metadatas:
+            if (meta.attrib["{http://schemas.android.com/apk/res/android}name"] == "QHOPENSDK_APPKEY"):
+                appkey = meta.attrib["{http://schemas.android.com/apk/res/android}value"]
+        printlog("prj_am_path:%s" % prj_am_path)
+
+        m = hashlib.md5()
+        printlog("appsecret :%s" % appsecret)
+        printlog("appkey: %s" % appkey)
+
+        md5value = "%s#%s" % (appsecret, appkey)
+        printlog("md5value :%s" % md5value)
+
+        m.update(md5value)
+        privatekey = m.hexdigest()
+        printlog("privatekey:%s" % privatekey)
+
+        Replace.replaceAM_Meta_data(prj_am_path, 'QHOPENSDK_PRIVATEKEY', privatekey)
+
+        manifestRootExt = r'<application android:networkSecurityConfig="@xml/network_security_config"'
+        replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
+        printlog("qihu360 replace add application root point shell: %s" % replacePkgNameShell)
+        os.system(replacePkgNameShell)
+    pass
+
+
+def OppoReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : oppo")
+    if (key == "APPKEY"):
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        printlog("prj_am_path: %s" % prj_am_path)
+        # 替换app_key
+        Replace.replaceAM_Meta_data(prj_am_path, 'app_key', value)
+        printlog("appkey: %s" % value)
+        pass
+
+
+def OppoMlReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : oppoml")
+    if (key == "APPKEY"):
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        printlog("prj_am_path: %s" % prj_am_path)
+        # 替换app_key
+        Replace.replaceAM_Meta_data(prj_am_path, 'app_key', value)
+        printlog("appkey: %s" % value)
+        pass
+
+
+def downjoyReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : downjoy")
+    if (key == "APP_ID"):
+        splash_activity = "com.downjoy.activity.SdkLoadActivity"
+        prj_am_path = "%s/AndroidManifest.xml" % prj_path
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, prj_am_path)
+        printlog(game_activity)
+        Replace.replaceAM_Meta_data(prj_am_path, 'CP_ACTIVITY', game_activity)
+        lines = open(prj_am_path).readlines()
+        fp = open(prj_am_path, 'w')
+        for s in lines:
+            if (s.find("dcnngsdk") != -1):
+                printlog("replace dcnngsdk:%s" % value)
+                s = re.sub('dcnngsdk.*\"', 'dcnngsdk' + value + '\"', s)
+            fp.write(s)
+        fp.close()
+        pass
+
+
+def YYBReplace(prj_path, dir_split, key, value):
+    if (key == "QQ_APP_ID"):
+        # 替换qq app id
+        replaceQQAPPIDShell = 'sed -i "s/qq_app_id/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
+        printlog("yingyongbao qq app id shell: %s" % replaceQQAPPIDShell)
+        os.system(replaceQQAPPIDShell)
+
+        # 替换ysdkconf.ini
+        printlog("path ysdkconfig.ini:%s/assets/ysdkconf.ini" % prj_path)
+        Replace.replaceAssets_Param("%s/assets/ysdkconf.ini" % prj_path, key, value)
+        Replace.replaceAssets_Param("%s/assets/ysdkconf.ini" % prj_path, "OFFER_ID", value)
+
+        prj_am_path = "%s/AndroidManifest.xml" % prj_path
+        game_activity = Replace.getLauchActivityName(prj_path)
+        Replace.replaceAM_Meta_data(prj_am_path, 'MAIN_ACTIVITY', game_activity)
+
+    if (key == "WX_APP_ID"):
+        replaceWXAPPIDShell = 'sed -i "s/wx_app_id/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
+        printlog("yingyongbao wx app id shell: %s" % replaceWXAPPIDShell)
+        os.system(replaceWXAPPIDShell)
+
+        # 替换ysdkconf.ini
+        Replace.replaceAssets_Param("%s/assets/ysdkconf.ini" % prj_path, key, value)
+    if (key == "IS_SAND_BOX"):
+        ysdk_sand_url = "https://ysdktest.qq.com"
+        ysdk_online_url = "https://ysdk.qq.com"
+        if value == "1":
+            ysdk_url = ysdk_sand_url
+        else:
+            ysdk_url = ysdk_online_url
+        Replace.replaceAssets_Param("%s/assets/ysdkconf.ini" % prj_path, "YSDK_URL", ysdk_url)
+
+    pass
+
+
+def HuaweiReplace(prj_path, dir_split, key, value):
+    if (key == "APP_ID"):
+        replaceAppidShell = '/bin/sed -i "s/APP_ID/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
+        printlog("huawei replace appid shell: %s" % replaceAppidShell)
+        os.system(replaceAppidShell)
+    if (key == "PAY_ID"):
+        replacePayidShell = '/bin/sed -i "s/PAY_ID/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
+        printlog("huawei replace payid shell: %s" % replacePayidShell)
+        os.system(replacePayidShell)
+    pass
+
+
+def AnzhiReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : anzhi")
+    prj_am_path = "%s/AndroidManifest.xml" % prj_path
+    pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
+    if (key == "APP_KEY"):
+        lines = open(prj_am_path).readlines()
+        fp = open(prj_am_path, 'w')
+        for s in lines:
+            if (s.find("packagename") != -1):
+                s = re.sub('packagename', pkgName, s);
+            fp.write(s)
+        fp.close()
+    pass
+
+
+def GuopanReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : guopan")
+    prj_am_path = "%s/AndroidManifest.xml" % prj_path
+    pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
+    if (key == "APP_ID"):
+        lines = open(prj_am_path).readlines()
+        fp = open(prj_am_path, 'w')
+        for s in lines:
+            if (s.find("gp_packagename") != -1):
+                s = re.sub('gp_packagename', pkgName + ".StubContentProvider", s);
+            fp.write(s)
+        fp.close()
+    pass
+
+
+def LeshiReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : leshi")
+    prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+    if (key == "LEPAY_APPID"):
+        Replace.replaceAM_Meta_data(prj_am_path, 'lepay_appid', value)
+    if (key == "LEPAY_APPKEY"):
+        Replace.replaceAM_Meta_data(prj_am_path, 'lepay_appkey', value)
+    pass
+
+
+def QuickReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : Quick")
+
+    if (key == "PRODUCT_CODE"):
+        splashactivity = "com.yythird.sdk.SplashActivity"
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        prj_param = "%s/assets/YyrhParam.cnf" % prj_path
+
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
+        printlog("GAMEACTIVITY :%s" % game_activity)
+        Replace.replaceAssets_Param(prj_param, "GAMEACTIVITY", game_activity)
+
+    if (key == "SDK_TYPE"):
+        printlog("merge qitian Smali")
+        if value == "qitian":
+            printlog("merge qitian Smali")
+            sdk_root_dir = apk_utils.getCutSdkRootHome()
+            ret = 0
+            ret = ret | File.mergeDir("%s/quick/quick/qitian_smali" % sdk_root_dir, "%s/smali" % prj_path)
+    pass
+
+
+def LjsdkReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : LjsdkReplace")
+
+    if (key == "XMGAME_PRODUCT_CODE"):
+
+        prj_param = "%s/assets/param.cnf" % prj_path
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        splashactivity = "third.sdk.SplashActivity"
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
+        printlog("GAMEACTIVITY :%s" % game_activity)
+        Replace.replaceAssets_Param(prj_param, "GAMEACTIVITY", game_activity)
+
+        pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
+        pkgLine = 'package="' + pkgName + '"'
+        printlog("pkgValue :%s" % pkgLine)
+        addPkgLine = ' xmlns:tools="http://schemas.android.com/tools" '
+        addPerLine = ' tools:ignore="ProtectedPermissions" '
+        permissionName = 'android:name="android.permission.PACKAGE_USAGE_STATS"'
+
+        lines = open(prj_am_path).readlines()
+        fp = open(prj_am_path, 'w')
+        for s in lines:
+            if (s.find(pkgLine) != -1):
+                s = re.sub(pkgLine, pkgLine + addPkgLine, s);
+                printlog("pkgLine :%s" % s)
+            if (s.find(permissionName) != -1):
+                s = re.sub(permissionName, permissionName + addPerLine, s);
+                printlog("permissionName :%s" % s)
+            fp.write(s)
+        fp.close()
+    pass
+
+
+def UcsdkReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : UcsdkReplace")
+    if (key == "GAME_ID"):
+        replaceGidShell = 'sed -i "s/GAME_ID/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
+        printlog("uc replace GAME_ID shell: %s" % replaceGidShell)
+        os.system(replaceGidShell)
+    #        GeneralModifySmali.modifyLauchSmali(prj_path)
+    pass
+
+
+def XiaomisdkReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : XiaomisdkReplace")
+    if (key == "APP_ID"):
+        # 获取包名
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        Replace.modifyRfileSmaliPath("xiaomi", prj_path);
+
+        printlog(" xiaomi begin replace game package v4 smali -------------------------------")
+        pkgV4Path = "%s/smali/android/support/v4" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+        sdkV4Path = "%s/xiaomi/xiaomi/smali/android/support/v4" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+
+        pkgAnnotation = "%s/smali/android/support/annotation" % prj_path
+        printlog("pkgV4Path:%s" % pkgAnnotation)
+        sdkAnnotation = "%s/xiaomi/xiaomi/smali/android/support/annotation" % sdk_root_dir
+        if os.path.exists(pkgAnnotation):
+            File.copyAllFile(sdkAnnotation, pkgAnnotation)
+
+    pass
+
+
+# 百度
+def BaiduReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : baidu")
+    if (key == "APP_ID"):
+        GeneralModifySmali.modifyLauchSmali(prj_path)
+    pass
+
+
+# 圣本
+def ShengbensdkReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : ShengbensdkReplace")
+    if (key == "AGENT"):
+        jsonFilePath = prj_path + dir_split + "assets" + dir_split + "hnsb_config.json"
+        printlog("path hnsb_config.json :%s" % jsonFilePath)
+        with open(jsonFilePath, 'r') as fp:
+            jsonData = json.load(fp)
+            jsonData['sdk']["ver"] = value
+            newJsonData = jsonData
+            fp.close()
+        with open(jsonFilePath, 'w') as fp:
+            json.dump(newJsonData, fp)
+            fp.close()
+
+    if (key == "APP_ID"):
+        jsonFilePath = prj_path + dir_split + "assets" + dir_split + "hnsb_config.json"
+        with open(jsonFilePath, 'r') as fp:
+            jsonData = json.load(fp)
+            jsonData['sdk']["appid"] = value
+            newJsonData = jsonData
+            fp.close()
+        with open(jsonFilePath, 'w') as fp:
+            json.dump(newJsonData, fp)
+            fp.close()
+    pass
+
+
+def JinkuosdkReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : JinkuosdkReplace")
+    printlog("path yy.properties :%s/assets/u8_developer_config.properties" % prj_path)
+    Replace.replaceAssets_Param("%s/assets/u8_developer_config.properties" % prj_path, key, value)
+    pass
+
+
+def HdhdsdkReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : HdhdsdkReplace")
+    if (key == "APP_ID"):
+        GeneralModifySmali.modifyLauchSmali(prj_path)
+    pass
+
+
+def SamsungReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : SamsungReplace")
+    if (key == "APPV_KEY"):
+        ptKey = value[0:99]
+        pvData = value[99:len(value)]
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        printlog("prj_am_path: %s" % prj_am_path)
+        # 替换app_key
+        Replace.replaceAM_Meta_data(prj_am_path, 'ptKey', ptKey)
+        prj_param = "%s/assets/YyrhParam.cnf" % prj_path
+        Replace.replaceAssets_Param(prj_param, "pvData", pvData)
+    pass
+
+
+def TTReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : TTReplace")
+    if (key == "GAME_ID"):
+        Replace.replaceAssets_Param("%s/assets/tt_game_sdk_opt.properties" % prj_path, "gameId", value)
+    if (key == "GAME_KEY"):
+        replaceKeyShell = 'sed -i "s/@WSX3edc/%s/g" %s/assets/TTGameSDKConfig.cfg' % (value, prj_path)
+        printlog("replaceMainLineShell:%s" % replaceKeyShell)
+        os.system(replaceKeyShell)
+    pass
+
+
+def YXFReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : YXFReplace")
+    if (key == "YGAPPID"):
+        replacePkgNameShell = '/bin/sed -i "1,\\$s/YXFAPPID/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
+        printlog("replacePkgNameShell:%s" % replacePkgNameShell)
+        os.system(replacePkgNameShell)
+
+        manifestRootExt = r'<application android:usesCleartextTraffic="true"'
+        replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
+        printlog("youxiFan replace add application root point shell: %s" % replacePkgNameShell)
+        os.system(replacePkgNameShell)
+    if (key == "IS_SPLASH"):
+        if (value == "0"):
+            GeneralModifySmali.modifyYXFLauchSmali(prj_path)
+    if (key == "screenOrientation"):
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        if (value == "screenOrientation:0"):
+            splash = "%s/yxf/yxf/extension/sp_landscape.png" % sdk_root_dir
+            apkres = "%s/res/drawable/crash_screen.png" % prj_path
+            shutil.copy(splash, apkres)
+        if (value == "screenOrientation:1"):
+            splash = "%s/yxf/yxf/extension/sp_portrait.png" % sdk_root_dir
+            apkres = "%s/res/drawable/crash_screen.png" % prj_path
+            shutil.copy(splash, apkres)
+    pass
+
+
+def VivosdkReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : VivosdkReplace")
+    if (key == "APP_ID"):
+        printlog("path supplierconfig.json :%s/assets/supplierconfig.json" % prj_path)
+        replaceConfigShell = '/bin/sed -i "1,\\$s/APP_ID/%s/g" %s/assets/supplierconfig.json' % (value, prj_path)
+        printlog("replaceConfigShell APP_ID:%s" % replaceConfigShell)
+        os.system(replaceConfigShell)
+
+        jsonFilePath = prj_path + dir_split + "assets" + dir_split + "supplierconfig.json"
+        printlog("path supplierconfig.json :%s" % jsonFilePath)
+        with open(jsonFilePath, 'r') as fp:
+            jsonData = json.load(fp)
+            jsonData['supplier']["vivo"]["appid"] = value
+            newJsonData = jsonData
+            fp.close()
+        with open(jsonFilePath, 'w') as fp:
+            json.dump(newJsonData, fp)
+            fp.close()
+    pass
+
+
+def XTsdkReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : Xiantu3011sdkReplace")
+    if (key == "GAME_ID"):
+        # 获取包名
+        Replace.modifyRfileSmaliPath("3011", prj_path);
+    pass
+
+
+def DDTsdkReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : DDTsdkReplace")
+    if (key == "APP_ID"):
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        splashactivity = "com.ddtsdk.ui.activity.MHPerActivity"
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
+        printlog("GAMEACTIVITY :%s" % game_activity)
+        Replace.replaceAM_Meta_data(prj_am_path, "mainAct", game_activity)
+    if (key == "agent"):
+        Replace.replaceAssets_Param("%s/assets/ddt.properties" % prj_path, key, value)
+    pass
+
+
+def QiyuReplace(prj_path, dir_split, key, value):
+    if (key == "APP_ID"):
+        manifestRootExt = r'<application android:usesCleartextTraffic="true"'
+        replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
+        printlog("QiyuReplace add application root point shell: %s" % replacePkgNameShell)
+        os.system(replacePkgNameShell)
+    pass
+
+
+def WankaReplace(prj_path, dir_split, key, value):
+    if (key == "APPID"):
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        namespace = '{http://schemas.android.com/apk/res/android}'
+
+        manifestRootExt = r'<application xmlns:tools="http://schemas.android.com/tools" tools:replace="android:theme,android:name"'
+        replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
+        printlog("WankaReplace replace add application root point shell: %s" % replacePkgNameShell)
+        os.system(replacePkgNameShell)
+
+        tree = ET.parse(prj_am_path)
+
+        activitys = tree.getroot().find("application").findall("activity")
+        for activity in activitys:
+            filters = activity.findall('intent-filter')
+            for filter in filters:
+                categorys = filter.findall('category')
+                for category in categorys:
+                    categoryname = category.attrib[namespace + "name"]
+                    if (categoryname == "android.intent.category.LAUNCHER"):
+                        element = Element('intent-filter')
+                        el1 = Element('action android:name="android.intent.action.VIEW"')
+                        el2 = Element('category android:name="android.intent.category.DEFAULT"')
+                        el3 = Element('category android:name="android.intent.category.BROWSABLE"')
+                        el4_value = 'data android:scheme="app%s"' % value
+                        el4 = Element(el4_value)
+                        element.append(el1)
+                        element.append(el2)
+                        element.append(el3)
+                        element.append(el4)
+                        activity.append(element)
+                        activity.set(namespace + 'launchMode', "singleTask")
+        tree.write(prj_am_path, "UTF-8", xml_declaration=True, method='xml')
+
+        pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
+        Aapt_Util.createRFile(prj_path, False, pkgName)
+        sdkRpath = "android/support/v7/appcompat"
+        pkgRpath = pkgName.replace(".", "/")
+        sdkAbsoluteRpath = "%s/smali/%s" % (prj_path, sdkRpath)
+        pkgAbsoluteRpath = "%s/smali/%s" % (prj_path, pkgRpath)
+
+        Replace.createRFile2Sdk(pkgAbsoluteRpath, sdkAbsoluteRpath, pkgRpath, sdkRpath)
+    pass
+
+
+def DDDReplace(prj_path, dir_split, key, value):
+    if (key == "channelId"):
+        Replace.replaceAssets_Param("%s/assets/dingdd.properties" % prj_path, 'channelId', value)
+    if (key == "adId"):
+        Replace.replaceAssets_Param("%s/assets/dingdd.properties" % prj_path, 'adId', value)
+    if (key == "adFlag"):
+        Replace.replaceAssets_Param("%s/assets/dingdd.properties" % prj_path, 'adFlag', value)
+    pass
+
+
+def LZYXReplace(prj_path, dir_split, key, value):
+    if (key == "ML_Channel"):
+        Replace.replaceAssets_Param("%s/assets/mlgame_developer_config.properties" % prj_path, 'ML_Channel', value)
+    if (key == "ML_APPKEY"):
+        Replace.replaceAssets_Param("%s/assets/mlgame_developer_config.properties" % prj_path, 'ML_APPKEY', value)
+    pass
+
+
+def WSReplace(prj_path, dir_split, key, value):
+    if (key == "HS_APPID"):
+        manifestRootExt = r'<application android:networkSecurityConfig="@xml/huosdk_network_security_config"'
+        replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
+        printlog("qihu360 replace add application root point shell: %s" % replacePkgNameShell)
+        os.system(replacePkgNameShell)
+    pass
+
+
+def XBReplace(prj_path, dir_split, key, value):
+    if (key == "GID"):
+        printlog("path gameshaiApp.ini :%s/assets/gameshaiApp.ini" % prj_path)
+        Replace.replaceAssets_Param("%s/assets/gameshaiApp.ini" % prj_path, 'gid', value)
+    if (key == "PID"):
+        printlog("path gameshaiApp.ini :%s/assets/gameshaiApp.ini" % prj_path)
+        Replace.replaceAssets_Param("%s/assets/gameshaiApp.ini" % prj_path, 'pid', value)
+    pass
+
+
+def YoudianReplace(prj_path, dir_split, key, value):
+    if (key == "APPID"):
+        apkPkgDir = ET.parse("%s/AndroidManifest.xml" % prj_path).getroot().attrib["package"].replace(".", "/")
+        apkRfilePath = "%s/smali/%s" % (prj_path, apkPkgDir)
+
+        Replace.modifyRfileSmaliPath("youdian", prj_path);
+
+        publicXml = "%s/res/values/public.xml" % prj_path
+        sdk_jar_dir = apk_utils.getToolsJarHome()
+        jarPath = "%s/MergeSamli.jar" % sdk_jar_dir
+        javaMerCm = 'java -jar %s %s %s' % (jarPath, publicXml, apkRfilePath)
+        printlog("javaMerCm:%s" % javaMerCm)
+        os.system(javaMerCm)
+    pass
+
+
+def Xiao7Replace(prj_path, dir_split, key, value):
+    if (key == "APPKEY"):
+        apkRfilePath = "%s/smali_classes2/com/smwl/smsdk" % prj_path
+        publicXml = "%s/res/values/public.xml" % prj_path
+        sdk_jar_dir = apk_utils.getToolsJarHome()
+        jarPath = "%s/MergeSamli.jar" % sdk_jar_dir
+        javaMerCm = 'java -jar %s %s %s' % (jarPath, publicXml, apkRfilePath)
+        printlog("javaMerCm:%s" % javaMerCm)
+        os.system(javaMerCm)
+
+        printlog(" Xiao7Replace begin replace game package v4 smali -------------------------------")
+
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        pkgV4Path = "%s/smali/android/support/v4" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+        sdkV4Path = "%s/x7sy/x7sy/smali/android/support/v4" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+
+        pkgName = ET.parse("%s/AndroidManifest.xml" % prj_path).getroot().attrib["package"]
+        Aapt_Util.createRFile(prj_path, False, pkgName)
+
+        pkgName = "android.support.constraint"
+        Aapt_Util.createRFile(prj_path, False, pkgName)
+
+
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        prj_param = "%s/assets/YyrhParam.cnf" % prj_path
+
+        splashactivity = "com.yythird.sdk.SplashActivity"
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
+        Replace.replaceAssets_Param(prj_param, "GAME_ACTIVITY", game_activity)
+        printlog("xiaoqi GAME_ACTIVITY :%s" % game_activity)
+
+    pass
+
+
+def NwanKaReplace(prj_path, dir_split, key, value):
+    if (key == "channelId"):
+        Replace.replaceAssets_Param("%s/assets/wk.properties" % prj_path, 'channelId', value)
+    if (key == "adId"):
+        Replace.replaceAssets_Param("%s/assets/wk.properties" % prj_path, 'adId', value)
+    if (key == "adFlag"):
+        Replace.replaceAssets_Param("%s/assets/wk.properties" % prj_path, 'adFlag', value)
+
+        manifestRootExt = r'<application xmlns:tools="http://schemas.android.com/tools" tools:replace="android:theme,android:name"'
+        replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
+        printlog("WankaReplace replace add application root point shell: %s" % replacePkgNameShell)
+        os.system(replacePkgNameShell)
+    pass
+
+
+def MBaiduReplace(prj_path, dir_split, key, value):
+    if (key == "APP_ID"):
+        manifestRootExt = r'<application android:networkSecurityConfig="@xml/network_security_config"'
+        replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
+        printlog("MbaiduReplace replace add application root point shell: %s" % replacePkgNameShell)
+        os.system(replacePkgNameShell)
+
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/com/baidu/passport/sapi2")
+    pass
+
+
+def ShenshouReplace(prj_path, dir_split, key, value):
+    if (key == "BALANCENAME"):
+        prj_style_path = prj_path + dir_split + "res/values-v28/styles.xml"
+        printlog("prj_style_path: %s" % prj_style_path)
+        File.safeFileDelete(prj_style_path)
+    pass
+
+
+def DaYanReplace(prj_path, dir_split, key, value):
+    if (key == "GD"):
+        filepath = "%s/assets/sdkchannel.txt" % prj_path
+        replacePdShell = 'sed -i "s#%s#%s#g" %s' % ("PD", value, filepath)
+        printlog(replacePdShell)
+        os.system(replacePdShell)
+    pass
+
+
+def DaLanReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : DaLanReplace")
+    prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+
+    if (key == "DL_APPID"):
+        splashactivity = "com.dalan.dl_assembly.SplashScreenActivity"
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
+        printlog("GAMEACTIVITY :%s" % game_activity)
+        Replace.replaceAM_Meta_data(prj_am_path, "dalan_union_main_activity", game_activity)
+    pass
+
+
+def KSyxReplace(prj_path, dir_split, key, value):
+    if (key == "kwai_app_id"):
+        Replace.replaceAssets_Param("%s/assets/allin_developer_config.properties" % prj_path, 'kwai_app_id', value)
+        printlog(" KSyxReplace begin replace game package v4 smali -------------------------------")
+
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        pkgV4Path = "%s/smali/android/support/v4" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+
+        sdkV4Path = "%s/ksyx/ksyx/smali/android/support/v4" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        Replace.replaceAM_AllowBackup(prj_am_path)
+    pass
+
+
+def LlhyReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : LlhyReplace")
+    if (key == "LLHY_APP_ID"):
+        metaKey = "unityplayer.SkipPermissionsDialog"
+        Replace.replaceAM_Meta_data("%s/AndroidManifest.xml" % prj_path, metaKey,
+                                    "true")
+    pass
+
+
+def HnqsReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : HnqsReplace")
+    if (key == "agent"):
+        Replace.replaceAssets_Param("%s/assets/jmhy.properties" % prj_path, 'agent', value)
+        metaKey = "unityplayer.SkipPermissionsDialog"
+        Replace.replaceAM_Meta_data("%s/AndroidManifest.xml" % prj_path, metaKey,
+                                    "true")
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        sdk_smali_dir = "%s/hnqs/hnqs/extension/yyrh" % sdk_root_dir
+        temp_old_smali_dir = "%s/smali/com/yyrh" % prj_path
+        if os.path.exists(sdk_smali_dir):
+            File.copyAllFile(sdk_smali_dir, temp_old_smali_dir)
+    pass
+
+
+def SogouReplace(prj_path, dir_split, key, value):
+    if (key == "GID"):
+
+        printlog(" SogouReplace begin replace game package v4 smali -------------------------------")
+
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        pkgV4Path = "%s/smali/android/support/v4" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+
+        sdkV4Path = "%s/sogou/sogou/smali/android/support/v4" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        Replace.replaceAM_AllowBackup(prj_am_path)
+    pass
+
+
+def JinRiTouTiaoReplace(prj_path, dir_split, key, value):
+    jsonFilePath = prj_path + dir_split + "assets" + dir_split + "config.json"
+    if key == 'APP_ID':
+        with open(jsonFilePath, 'r') as fp:
+            jsonData = json.load(fp)
+            jsonData['app']["app_id"] = value
+            jsonData['app']['main_activity'] = GeneralModifySmali.getLauchActivityName(prj_path)
+            orientation = GeneralModifySmali.getLauchActivityScreenOrientation(prj_path)
+            if orientation == "landscape" or orientation == "sensorLandscape":
+                screen_orientation = "sensorLandscape"
+            else:
+                screen_orientation = "sensorPortrait"
+
+            jsonData['app']['screen_orientation'] = screen_orientation
+            newJsonData = jsonData
+            fp.close()
+
+        with open(jsonFilePath, 'w') as fp:
+            json.dump(newJsonData, fp)
+            fp.close()
+
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/game_sdk/packers/rocket_sdk")
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali_classes2/game_sdk/packers/rocket_sdk")
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/androidx/navigation/ui")
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali_classes3/android/support/design")
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali_classes3/android/support/v7/appcompat")
+
+        #        GeneralModifySmali.replaceSdkV4Smali(prj_path,"jrtt/jrtt/smali/android/support/v4")
+
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        pkgV4Path = "%s/smali/android/support/v4" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+
+        sdkV4Path = "%s/jrtt/jrtt/smali_classes3/android/support/v4" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+
+        GeneralModifySmali.modifyJrttV7ResIdSmali(prj_path)
+    else:
+        Replace.replaceJsonValue(jsonFilePath, "app", key, value)
+    pass
+
+
+def FengQiReplace(prj_path, dir_split, key, value):
+    if (key == "channelId") or (key == "adId") or (key == "adFlag"):
+        # 替换fq.properties
+        printlog("path fq.properties:%s/assets/fq.properties" % prj_path)
+        Replace.replaceAssets_Param("%s/assets/fq.properties" % prj_path, key, value)
+        pass
+    pass
+
+
+def BlueStackReplace(prj_path, dir_split, key, value):
+    if key == "APP_ID":
+        replaceBlueStackIdShell = 'sed -i "1,\\$s/APP_ID/%s/g" %s/assets/BSSDKConfig.xml ' % (value, prj_path)
+        printlog("replaceBlueStackIdShell: %s" % replaceBlueStackIdShell)
+        os.system(replaceBlueStackIdShell)
+
+    pass
+
+
+# 司墨
+def SiMoReplace(prj_path, dir_split, key, value):
+    if key == "APP_ID":
+        config_path = prj_path + '/assets/SIMgame_config.xml'
+        tree = ET.parse(config_path)
+        root = tree.getroot()
+        for elem in root.iter('appid'):
+            elem.text = value
+        tree.write(config_path, "UTF-8", xml_declaration=True, method='xml')
+
+    pass
+
+
+# 乘龙
+def ChenLongReplace(prj_path, dir_split, key, value):
+    if key == "CL_PID":
+        Replace.replaceAssets_Param("%s/assets/_cl_developer_config.properties" % prj_path, 'CL_PID', value)
+    if key == "CL_KEY":
+        Replace.replaceAssets_Param("%s/assets/_cl_developer_config.properties" % prj_path, 'CL_KEY', value)
+    if key == "CL_DEBUG_GD":
+        Replace.replaceAssets_Param("%s/assets/_cl_developer_config.properties" % prj_path, 'CL_DEBUG_GD', value)
+    pass
+
+
+def JiuZiReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : JiuZiReplace")
+
+    if (key == "gid"):
+        prj_param = "%s/assets/YyrhParam.cnf" % prj_path
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        splash_activity = "com.yythird.sdk.SplashActivity"
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, prj_am_path)
+        printlog("GAMEACTIVITY :%s" % game_activity)
+        Replace.replaceAssets_Param(prj_param, "GAMEACTIVITY", game_activity)
+
+        pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
+        Aapt_Util.createRFile(prj_path, False, pkgName)
+
+        apkRfilePath = "%s/smali/com/jzyx/sdk" % prj_path
+        printlog("apkRfilePath:%s" % apkRfilePath)
+        publicXml = "%s/res/values/public.xml" % prj_path
+        sdk_jar_dir = apk_utils.getToolsJarHome()
+        jarPath = "%s/MergeSamli.jar" % sdk_jar_dir
+        javaMerCm = 'java -jar %s %s %s' % (jarPath, publicXml, apkRfilePath)
+        printlog("javaMerCm:%s" % javaMerCm)
+        os.system(javaMerCm)
+
+        pass
+
+
+def BingNiaoReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : DaLanReplace")
+
+    if (key == "YH_GAME_ID"):
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        splashactivity = "prj.iyinghun.platform.sdk.SplashScreenActivity"
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
+        printlog("GAMEACTIVITY :%s" % game_activity)
+        Replace.replaceAM_Meta_data(prj_am_path, "prj.chameleon.intent.main", game_activity)
+    pass
+
+
+def BingChengReplace(prj_path, dir_split, key, value):
+    prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', "http://schemas.android.com/apk/res/android")
+    if (key == "BC_GAME_ID"):
+        tree = ET.parse(prj_am_path)
+        pkgName = tree.getroot().attrib["package"]
+        activitys = tree.getroot().find("application").findall("activity")
+        for activity in activitys:
+            filters = activity.findall('intent-filter')
+            for filter in filters:
+                categorys = filter.findall('category')
+                for category in categorys:
+                    categoryname = category.attrib[namespace + "name"]
+                    if (categoryname == "android.intent.category.LAUNCHER"):
+                        element = Element('intent-filter')
+                        el1 = Element('action android:name="android.intent.action.VIEW"')
+                        el2 = Element('category android:name="android.intent.category.DEFAULT"')
+                        el3 = Element('category android:name="android.intent.category.BROWSABLE"')
+                        el4_value = 'data android:host="%s" android:scheme="%s"' % (value, pkgName)
+                        el4 = Element(el4_value)
+                        element.append(el1)
+                        element.append(el2)
+                        element.append(el3)
+                        element.append(el4)
+                        activity.append(element)
+        tree.write(prj_am_path, "UTF-8", xml_declaration=True, method='xml')
+
+
+def SuixingHuYuReplace(prj_path, dir_split, key, value):
+    if (key == "game_id"):
+        Replace.replaceAssets_Param("%s/assets/suixin/suixin_sdk.ini" % prj_path, key, value)
+    if (key == "pid"):
+        Replace.replaceAssets_Param("%s/assets/suixin/suixin_sdk.ini" % prj_path, key, value)
+    if (key == "is_land"):
+        Replace.replaceAssets_Param("%s/assets/suixin/suixin_sdk.ini" % prj_path, key, value)
+    pass
+
+
+def ShouQuReplace(prj_path, dir_split, key, value):
+    config_path = "%s/assets/sqsdk_config" % prj_path
+    with open(config_path, "r") as f:
+        content = f.read()
+    json_data = json.loads(content)
+    json_data[key] = value
+    with open(config_path, "w") as f:
+        f.write(json.dumps(json_data))
+
+    if key == "app_key":
+        manifest_path = prj_path + dir_split + "AndroidManifest.xml"
+        param_cnf = "%s/assets/YyrhParam.cnf" % prj_path
+        splash_activity = "com.yythird.sdk.SplashActivity"
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, manifest_path)
+        Replace.replaceAssets_Param(param_cnf, "GAMEACTIVITY", game_activity)
+        printlog("GAMEACTIVITY :%s" % game_activity)
+
+
+def HaiNanQiJingReplace(prj_path, dir_split, key, value):
+    if key == "PACKAGE_TAG":
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        sdkSmaliPath = "%s/hnqj/hnqj/smali/com" % sdk_root_dir
+        pkgSmaliPath = "%s/smali/com" % prj_path
+
+        printlog("sdkSmaliPath :%s" % sdkSmaliPath)
+        printlog("pkgSmaliPath :%s" % pkgSmaliPath)
+        if os.path.exists(pkgSmaliPath):
+            File.copyAllFile(sdkSmaliPath, pkgSmaliPath)
+        if Contants.isTestEnvironment():
+            key = "https://fxsy.qijinghao.com"
+            value = "http://testsdkapi.yyxxgame.com"
+            file = "%s/smali/com/yyrh/c/a.smali" % prj_path
+            Replace.replaceKeyword(key, value, file)
+
+            file = "%s/smali/com/yyrh/ui/a.smali" % prj_path
+            Replace.replaceKeyword(key, value, file)
+
+            file = "%s/smali/com/yyrh/a/d.smali" % prj_path
+            Replace.replaceKeyword(key, value, file)
+
+            file = "%s/smali/com/yyrh/sdk/SDKEntry.smali" % prj_path
+            Replace.replaceKeyword(key, value, file)
+    pass
+
+
+def HongGuoReplace(prj_path, dir_split, key, value):
+    config_path = "%s/assets/gameInfo.json" % prj_path
+    with open(config_path, "r") as f:
+        content = f.read()
+    json_data = json.loads(content)
+    json_data[key] = value
+    with open(config_path, "w") as f:
+        f.write(json.dumps(json_data))
+
+    if key == "game_id":
+        manifest_path = prj_path + dir_split + "AndroidManifest.xml"
+        param_cnf = "%s/assets/YyrhParam.cnf" % prj_path
+        splash_activity = "com.yythird.sdk.SplashActivity"
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, manifest_path)
+        Replace.replaceAssets_Param(param_cnf, "GAMEACTIVITY", game_activity)
+
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        printlog(" HongGuoReplace begin replace game package v4 smali -------------------------------")
+        pkgV4Path = "%s/smali/android/support/v4" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+        sdkV4Path = "%s/hg/hg/smali/android/support/v4" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+    pass
+
+
+def BaizeReplace(prj_path, dir_split, key, value):
+    if key == "APP_ID":
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        param_cnf = "%s/assets/YyrhParam.cnf" % prj_path
+        splashactivity = "com.yythird.sdk.SplashActivity"
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
+        printlog("GAMEACTIVITY :%s" % game_activity)
+        Replace.replaceAssets_Param(param_cnf, "GAMEACTIVITY", game_activity)
+    pass
+
+
+def YanXinReplace(prj_path, dir_split, key, value):
+    if key == "ProductCode":
+        Replace.modifyRfileSmaliPath("yx", prj_path)
+    pass
+
+
+def ZhangShangHuYuReplace(prj_path, dir_split, key, value):
+    Replace.replaceAssets_Param("%s/assets/yy.properties" % prj_path, key, value)
+    if key == "channelId":
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        printlog(" ZhangShangHuYuReplace begin replace game package v4 smali -------------------------------")
+        pkgV4Path = "%s/smali/android/support/v7" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+        sdkV4Path = "%s/zshy/zshy/smali/android/support/v7" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/android/support/v7/cardview")
+
+        printlog(" HongGuoReplace begin replace game package v4 smali -------------------------------")
+        pkgV4Path = "%s/smali/android/support/v4" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+        sdkV4Path = "%s/zshy/zshy/smali/android/support/v4" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+
+        apkRfilePath = "%s/smali/com/zshy/zshysdk" % prj_path
+        printlog("apkRfilePath:%s" % apkRfilePath)
+        publicXml = "%s/res/values/public.xml" % prj_path
+        sdk_jar_dir = apk_utils.getToolsJarHome()
+        jarPath = "%s/MergeSamli.jar" % sdk_jar_dir
+        javaMerCm = 'java -jar %s %s %s' % (jarPath, publicXml, apkRfilePath)
+        printlog("javaMerCm:%s" % javaMerCm)
+        os.system(javaMerCm)
+
+        Replace.modifyRfileSmaliPath("zshy", prj_path);
+
+    pass
+
+
+def XiYouWangReplace(prj_path, dir_split, key, value):
+    Replace.replaceAssets_Param("%s/assets/xy_developer_config.properties" % prj_path, key, value)
+    if key == "XY_APP_ID":
+        splash_activity = "com.xiyou.sdk.XiYouSplashActivity"
+        manifest_path = prj_path + dir_split + "AndroidManifest.xml"
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, manifest_path)
+        Replace.replaceAM_Meta_data(manifest_path, 'XY_GAME_MAIN_ACTIVITY_NAME', game_activity)
+
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+
+        printlog(" xiyouwang begin replace game package v4 smali -------------------------------")
+        pkgV4Path = "%s/smali/android/support/v4" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+        sdkV4Path = "%s/xiyou/xiyou/smali/android/support/v4" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+        prj_am_path = "%s/AndroidManifest.xml" % prj_path
+        pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
+        Aapt_Util.createRFile(prj_path, False, pkgName)
+
+    pass
+
+
+def XunLeiReplace(prj_path, dir_split, key, value):
+    prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', "http://schemas.android.com/apk/res/android")
+    if (key == "schemeCallback"):
+        tree = ET.parse(prj_am_path)
+        activitys = tree.getroot().find("application").findall("activity")
+        for activity in activitys:
+            activityName = activity.attrib[namespace + "name"]
+            printlog("activityName:%s" % activityName)
+            if (activityName == "com.xovs.common.auth.processor.XLAuthBackActivity"):
+                filters = activity.findall('intent-filter')
+                for filter in filters:
+                    datas = filter.findall('data')
+                    for data in datas:
+                        printlog("data:%s" % data)
+                        data.set(namespace + "scheme", value)
+        tree.write(prj_am_path, "UTF-8", xml_declaration=True, method='xml')
+    pass
+
+
+def CanLongReplace(prj_path, dir_split, key, value):
+    if key == "PRODUCT_CODE":
+        Replace.modifyRfileSmaliPath("canlong", prj_path);
+    pass
+
+
+def ShangHaiXiYuanReplace(prj_path, dir_split, key, value):
+    if key == "PACKAGE_TAG":
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        sdkSmaliPath = "%s/shxy/shxy/smali/com/yyrh" % sdk_root_dir
+        pkgSmaliPath = "%s/smali/com/yyrh" % prj_path
+
+        printlog("sdkSmaliPath :%s" % sdkSmaliPath)
+        printlog("pkgSmaliPath :%s" % pkgSmaliPath)
+        if os.path.exists(pkgSmaliPath):
+            File.copyAllFile(sdkSmaliPath, pkgSmaliPath)
+        if Contants.isTestEnvironment():
+            key = "https://sdkapi.bklinok.com"
+            value = "http://testsdkapi.yyxxgame.com"
+            file = "%s/smali/com/yyrh/c/a.smali" % prj_path
+            Replace.replaceKeyword(key, value, file)
+            file = "%s/smali/com/yyrh/a/d.smali" % prj_path
+            Replace.replaceKeyword(key, value, file)
+            file = "%s/smali/com/yyrh/sdk/SDKEntry.smali" % prj_path
+            Replace.replaceKeyword(key, value, file)
+    pass
+
+
+def YuanYouRongHeReplace(prj_path, dir_split, key, value):
+    if key == "PACKAGE_TAG":
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        sdkSmaliPath = "%s/mixsdk/mixsdk/smali/com/yyrh" % sdk_root_dir
+        pkgSmaliPath = "%s/smali/com/yyrh" % prj_path
+
+        printlog("sdkSmaliPath :%s" % sdkSmaliPath)
+        printlog("pkgSmaliPath :%s" % pkgSmaliPath)
+        if os.path.exists(pkgSmaliPath):
+            File.copyAllFile(sdkSmaliPath, pkgSmaliPath)
+
+        sdkSmaliPath = "%s/mixsdk/mixsdk/smali/com/yythird/base" % sdk_root_dir
+        pkgSmaliPath = "%s/smali/com/yythird/base" % prj_path
+
+        printlog("sdkSmaliPath :%s" % sdkSmaliPath)
+        printlog("pkgSmaliPath :%s" % pkgSmaliPath)
+        if os.path.exists(pkgSmaliPath):
+            File.copyAllFile(sdkSmaliPath, pkgSmaliPath)
+
+        if Contants.isTestEnvironment():
+            key = "https://sdkapi.yyxxgame.com"
+            value = "http://testsdkapi.yyxxgame.com"
+            file = "%s/smali/com/yyrh/c/a.smali" % prj_path
+            Replace.replaceKeyword(key, value, file)
+            file = "%s/smali/com/yyrh/sdk/SDKEntry.smali" % prj_path
+            Replace.replaceKeyword(key, value, file)
+    pass
+
+
+def BaLeReplace(prj_path, dir_split, key, value):
+    if key == "CHANNEL_ID":
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/com/sdk/douyou")
+    pass
+
+
+def QiPaReplace(prj_path, dir_split, key, value):
+    if key == "Super_Game_ID":
+        splash_activity = "com.supersdk.application.MySplashActivity"
+        prj_am_path = "%s/AndroidManifest.xml" % prj_path
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, prj_am_path)
+        tree = ET.parse(prj_am_path)
+
+        activitys = tree.getroot().find("application").findall("activity")
+        for activity in activitys:
+            namespace = '{http://schemas.android.com/apk/res/android}'
+            xml_activity_name = activity.attrib[namespace + "name"]
+            if xml_activity_name == game_activity:
+                filter = activity.find('intent-filter')
+                el1 = Element('action android:name="com.super.sdk.MAIN"')
+                filter.append(el1)
+        tree.write(prj_am_path, "UTF-8", xml_declaration=True, method='xml')
+    pass
+
+
+def DouyinReplace(prj_path, dir_split, key, value):
+    jsonFilePath = prj_path + dir_split + "assets" + dir_split + "config.json"
+    if key == 'app_id':
+        with open(jsonFilePath, 'r') as fp:
+            jsonData = json.load(fp)
+            jsonData["app_id"] = value
+            jsonData['screen_orientation'] = GeneralModifySmali.getLauchActivityName(prj_path)
+            orientation = GeneralModifySmali.getLauchActivityScreenOrientation(prj_path)
+            if orientation == "landscape" or orientation == "sensorLandscape":
+                screen_orientation = "sensorLandscape"
+            else:
+                screen_orientation = "sensorPortrait"
+
+            jsonData['screen_orientation'] = screen_orientation
+            newJsonData = jsonData
+            fp.close()
+
+        with open(jsonFilePath, 'w') as fp:
+            json.dump(newJsonData, fp)
+            fp.close()
+
+        printlog(" douyin begin replace game package v4 smali -------------------------------")
+        pkgV4Path = "%s/smali/android/support/v4" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+        File.del_file(pkgV4Path)
+
+        prj_am_path = "%s/AndroidManifest.xml" % prj_path
+        pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
+        Aapt_Util.createRFile(prj_path, False, pkgName)
+
+        sdkRpath = "android/support/v7/appcompat"
+        pkgRpath = pkgName.replace(".", "/")
+        sdkAbsoluteRpath = "%s/smali_classes3/%s" % (prj_path, sdkRpath)
+        pkgAbsoluteRpath = "%s/smali/%s" % (prj_path, pkgRpath)
+
+        Replace.createRFile2Sdk(pkgAbsoluteRpath, sdkAbsoluteRpath, pkgRpath, sdkRpath)
+
+    pass
+
+
+def MoMoYuReplace(prj_path, dir_split, key, value):
+    xml_path = "%s/res/values/strings.xml" % prj_path
+    Replace.replaceXmlValue(xml_path, key, value)
+    pass
+
+
+def QuxuanReplace(prj_path, dir_split, key, value):
+    if key == "app_id":
+        prj_am_path = "%s/AndroidManifest.xml" % prj_path
+        value = "Qdazzle_%s" % value
+        Replace.replaceAM_Meta_data(prj_am_path, "CommonSDK_AppID", value)
+
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/com/qdazzle/sdk")
+
+    if key == "app_key":
+        prj_am_path = "%s/AndroidManifest.xml" % prj_path
+        value = "Qdazzle_%s" % value
+        Replace.replaceAM_Meta_data(prj_am_path, "CommonSDK_AppKey", value)
+    pass
+
+
+def MuMuReplace(prj_path, dir_split, key, value):
+    if key == "YOFUN_APP_ID":
+        printlog("specail replace : MuMuReplace")
+
+        splashactivity = "com.yythird.sdk.SplashActivity"
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        prj_param = "%s/assets/YyrhParam.cnf" % prj_path
+
+        game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
+        printlog("GAMEACTIVITY :%s" % game_activity)
+        Replace.replaceAssets_Param(prj_param, "GAMEACTIVITY", game_activity)
+    pass
+
+
+def HeFengReplace(prj_path, dir_split, key, value):
+    if key == "ver":
+        printlog("specail replace : HeFengReplace")
+        printlog("path hf.properties :%s/assets/hf.properties" % prj_path)
+        Replace.replaceAssets_Param("%s/assets/hf.properties" % prj_path, "agent", value)
+
+    pass
+
+
+def ShengBenFuliReplace(prj_path, dir_split, key, value):
+    if key == "appid":
+        printlog("specail replace : ShengBenFuliReplace")
+        splash_activity = "com.fysdk.activity.FyGuideActivity"
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+
+        namespace = '{http://schemas.android.com/apk/res/android}'
+        ET.register_namespace('android', "http://schemas.android.com/apk/res/android")
+        tree = ET.parse(prj_am_path)
+
+        activitys = tree.getroot().find("application").findall("activity")
+        for activity in activitys:
+            filters = activity.findall('intent-filter')
+            for filter in filters:
+                categorys = filter.findall('category')
+                actions = filter.findall('action')
+                for category in categorys:
+                    category_name = category.attrib[namespace + "name"]
+                    if category_name == "android.intent.category.LAUNCHER":
+                        action_name = activity.attrib[namespace + "name"]
+                        if action_name != splash_activity:
+                            printlog("delete :%s" % category_name)
+                            category.attrib[namespace + "name"] = "android.intent.category.DEFAULT"
+                            printlog("LAUNCHER replace DEFAULT :%s" % category.attrib[namespace + "name"])
+                            for action in actions:
+                                action_name = action.attrib[namespace + "name"]
+                                if action_name == "android.intent.action.MAIN":
+                                    printlog("delete :%s" % action_name)
+                                    action.attrib[namespace + "name"] = "game.MAIN"
+        tree.write(prj_am_path, "UTF-8", xml_declaration=True, method='xml')
+    pass
+
+
+def MuXueReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : MuXueReplace")
+    Replace.replaceAssets_Param("%s/assets/gs.properties" % prj_path, key, value)
+    pass
+
+
+def QiYouReplace(prj_path, dir_split, key, value):
+    if (key == "blgame_gameid"):
+        prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
+        pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
+
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        pkgV4Path = "%s/smali/android/support/design" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+        sdkV4Path = "%s/7you/7you/smali/android/support/design" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+
+        Aapt_Util.createRFile(prj_path, False, pkgName)
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/android/support/v7/appcompat")
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/android/support/design")
+        GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/android/support/v7/cardview")
+
+    pass
+
+
+def YueWanReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : YueWanReplace")
+    if (key == "J_GAME_ID"):
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        printlog(" YueWanReplace begin replace game package v4 smali -------------------------------")
+        pkgV4Path = "%s/smali/android/support/v4" % prj_path
+        printlog("pkgV4Path:%s" % pkgV4Path)
+        sdkV4Path = "%s/yuewan/yuewan/smali/android/support/v4" % sdk_root_dir
+        printlog("sdkV4Path:%s" % sdkV4Path)
+        if os.path.exists(pkgV4Path):
+            File.copyAllFile(sdkV4Path, pkgV4Path)
+
+    pass
+
+
+def ShengYueReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : ShengYueReplace")
+    jsonFilePath = prj_path + dir_split + "assets" + dir_split + "UUConfig.json"
+    Replace.replaceJsonValue(jsonFilePath, "", key, value)
+    pass
+
+
+def JiZhiHuiReplace(prj_path, dir_split, key, value):
+    printlog("specail replace : JiZhiHuiReplace")
+
+    config_path = "%s/assets/xggameinfo.txt" % prj_path
+    with open(config_path, "r") as f:
+        content = f.read()
+    json_data = json.loads(content)
+    json_data[key] = value
+    with open(config_path, "w") as f:
+        f.write(json.dumps(json_data))
+
+
+def JiMiReplace(prj_path, dir_split, key, value):
+    Replace.replaceAssets_Param("%s/assets/jmhy.properties" % prj_path, key, value)
+
+
+specialReplace = {
+    "lenovo": LenovoReplace,
+    "baidu": BaiduReplace,
+    "wandoujia": WandoujiaReplace,
+    "qh360": QihuReplace,
+    "oppo": OppoReplace,
+    "oppoml": OppoMlReplace,
+    "chongchong": ChongchongReplace,
+    "yingyongbao": YYBReplace,
+    "downjoy": downjoyReplace,
+    "huawei": HuaweiReplace,
+    "anzhi": AnzhiReplace,
+    "leshi": LeshiReplace,
+    "quick": QuickReplace,
+    "guopan": GuopanReplace,
+    "ljsdk": LjsdkReplace,
+    "uc": UcsdkReplace,
+    "xiaomi": XiaomisdkReplace,
+    "hnshengben": ShengbensdkReplace,
+    "jk": JinkuosdkReplace,
+    "hd": HdhdsdkReplace,
+    "samsung": SamsungReplace,
+    "ttyy": TTReplace,
+    "yxf": YXFReplace,
+    "vivo": VivosdkReplace,
+    "3011": XTsdkReplace,
+    "ddt": DDTsdkReplace,
+    "wanka": WankaReplace,
+    "ddd": DDDReplace,
+    "lzyx": LZYXReplace,
+    "ws": WSReplace,
+    "xb": XBReplace,
+    "youdian": YoudianReplace,
+    "x7sy": Xiao7Replace,
+    "nwanka": NwanKaReplace,
+    "mbaidu": MBaiduReplace,
+    "shenshou": ShenshouReplace,
+    "dyyx": DaYanReplace,
+    "dl": DaLanReplace,
+    "ksyx": KSyxReplace,
+    "llhy": LlhyReplace,
+    "hnqs": HnqsReplace,
+    "sogou": SogouReplace,
+    "jrtt": JinRiTouTiaoReplace,
+    "fq": FengQiReplace,
+    "bs": BlueStackReplace,
+    "simo": SiMoReplace,
+    "cl": ChenLongReplace,
+    "qianmian": JinRiTouTiaoReplace,
+    "jiuzi": JiuZiReplace,
+    "bingniao": BingNiaoReplace,
+    "bingcheng": BingChengReplace,
+    "sxhy": SuixingHuYuReplace,
+    "shouqu": ShouQuReplace,
+    "hnqj": HaiNanQiJingReplace,
+    "hg": HongGuoReplace,
+    "baize": BaizeReplace,
+    "yx": YanXinReplace,
+    "zshy": ZhangShangHuYuReplace,
+    "xiyou": XiYouWangReplace,
+    "xunlei": XunLeiReplace,
+    "canlong": CanLongReplace,
+    "shxy": ShangHaiXiYuanReplace,
+    "mixsdk": YuanYouRongHeReplace,
+    "bale": BaLeReplace,
+    "7pa": QiPaReplace,
+    "dymmy": MoMoYuReplace,
+    "dyly": DouyinReplace,
+    "qx": QuxuanReplace,
+    "wymumu": MuMuReplace,
+    "hf": HeFengReplace,
+    "sbfl": ShengBenFuliReplace,
+    "muxue": MuXueReplace,
+    "7you": QiYouReplace,
+    "yuewan": YueWanReplace,
+    "shengyue": ShengYueReplace,
+    "jzh": JiZhiHuiReplace,
+    "jmhy": JiMiReplace
+}
+
+
+def getSpecilReplace(sdk_name):
+    if sdk_name in specialReplace:
+        return specialReplace[sdk_name]
+    else:
+        return None
+    pass

+ 23 - 0
V1/CommonUtils.py

@@ -0,0 +1,23 @@
+# -*- coding:utf-8 -*-
+import re
+
+def IsChineseCharInside(sentence):
+        for uchar in sentence:
+                if uchar >= u'\u4e00' and uchar<=u'\u9fa5':
+                        return True
+        return False
+
+def isMatchRegExp(param,rule):
+    if param == None or param == "":
+        return True
+    isRegular = False
+    try:
+        for word in  param:
+            matchObj = re.search(word,rule, re.M | re.I | re.S)
+            if matchObj:
+                isRegular = True
+            else:
+                return False
+        return isRegular
+    except Exception as err:
+        return False

+ 68 - 0
V1/Contants.py

@@ -0,0 +1,68 @@
+# -*- coding:utf-8 -*-
+import os
+
+SDK_MAIN = "/opt/mixsdk"
+SDK_CONFIG = "%s/sdk_config"%SDK_MAIN
+SDK_LOG = "/opt/package_log"
+SDK_SCRIPT = "%s/script2.0"%SDK_MAIN
+
+#socket常量
+CONNECTFILE = '%s/cutsdk'%SDK_SCRIPT
+LOCKFILE = '%s/lockFile'%SDK_SCRIPT
+
+IGNORE_PACKAGE_PATH = "com/yyrh"
+SDK_CHANNEL_ID = "channel_id"
+
+SDK_NOTIFY_URL = "gamesdk.yyxxgame.com:9001/api/update_gcp_resource_msg/run"
+
+SDK_SP_NOTIFY_URL = "gamesdk.yyxxgame.com:9001/api/update_sp_resource_msg/run"
+
+
+SDK_NOTIFY_TEST_URL = "testgamesdk.yyxxgame.com/api/update_gcp_resource_msg/run"
+SDK_SP_NOTIFY_TEST_URL = "testgamesdk.yyxxgame.com/api/update_sp_resource_msg/run"
+
+def getSdkMain():
+    return SDK_MAIN
+
+def getSdkConfig():
+    return SDK_CONFIG
+
+def getSdkScript():
+    return SDK_SCRIPT
+
+def getSdkLog():
+    return SDK_LOG
+
+def getConnectFile():
+    return CONNECTFILE
+
+def getLockFilePath():
+    return LOCKFILE
+
+def getIgnorePackagePath():
+    return IGNORE_PACKAGE_PATH
+
+def getSdkChannelid():
+    return SDK_CHANNEL_ID
+
+def getAapt2ToolPath():
+    return  "%s/tool/Android/Sdk/build-tools/28.0.3/aapt2"%SDK_MAIN
+def getSdkNotifyUrl():
+    if(getIp() == "10.255.3.8"):
+        return SDK_NOTIFY_TEST_URL
+    else:
+        return SDK_NOTIFY_URL
+def getSdkSpNotifyUrl():
+    if(getIp() == "10.255.3.8"):
+        return SDK_SP_NOTIFY_TEST_URL
+    else:
+        return SDK_SP_NOTIFY_URL
+def getIp():
+    ip = os.popen("/sbin/ifconfig | grep 'inet addr' | awk '{print $2}'").read()
+    ip = ip[ip.find(':') + 1:ip.find('\n')]
+    return ip
+def isTestEnvironment():
+    if(getIp() == "10.255.3.8"):
+        return True
+    else:
+        return False

+ 22 - 0
V1/Exec_Cmd_Utils.py

@@ -0,0 +1,22 @@
+import subprocess
+from V1.PrintLog import printlog
+
+
+def exeCommonCmd(cmd, cd=None):
+    try:
+        s = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, cwd=cd,encoding='utf-8')
+
+        std_output, error_output = s.communicate()
+
+        ret = s.returncode
+        if ret:
+            printlog("cmd: %s   \nexec Fail!" % cmd)
+        else:
+            printlog("cmd: %s   \nexec Success!" % cmd)
+        printlog(std_output)
+        printlog(error_output)
+    except Exception as e:
+        print(e)
+        return 1, e
+
+    return ret, std_output

+ 393 - 0
V1/File.py

@@ -0,0 +1,393 @@
+# -*- coding:utf-8 -*-
+
+import os
+import shutil
+import xml.etree.ElementTree as ET
+import re
+
+import platform
+
+from V1.PrintLog import printlog
+from V1 import Contants
+
+SEPARATOR = ""
+if platform.system() == "Windows":
+    SEPARATOR = "\\"
+else:
+    SEPARATOR = "/"
+
+def copyFiles(fromDir,toDir):
+    #必须合并的列表
+    mergeList = ["attrs.xml","colors.xml","dimens.xml","drawables.xml","ids.xml","public.xml","strings.xml","style.xml"]
+
+    printlog(">>>>>>>>>>>>>>>>>>>>>>>>fromDir:<<<<<<<<<<<<<<<<<<<<<<<<<< %s" % fromDir)
+    if os.path.exists(fromDir) == False:
+        printlog("fromDir or toDir is not exists!")
+        return 1
+    #value文件夹下的xml如果有同名必须合并
+    valuePattern = re.compile(r".*/values.*")
+    for parent, dirs,files in os.walk(fromDir):
+        toFileParent = parent.replace(fromDir, toDir)
+        for fileName in files:
+            oriFile = "%s/%s"%(parent, fileName)
+            toFile = "%s/%s"%(toFileParent, fileName)
+#            PrintLog("oriFile: %s"%oriFile)
+#            PrintLog("toFile: %s"%toFile)
+#            PrintLog("parent:%s"%parent)
+            #是value文件夹 and 渠道资源与包有相同的文件
+            if valuePattern.match(parent) and os.path.exists(toFile):
+#                PrintLog("merge file %s to file %s-------------------------"%(oriFile, toFile))
+                mergeResFile(oriFile, toFile)
+            #当包里没有与渠道相同的文件
+            elif os.path.exists(toFile) == False:
+#                PrintLog("copy file %s to file %s--------------------------"%(oriFile, toFile))
+                os.system("mkdir -p %s"%(os.path.dirname(toFile)))
+                shutil.copyfile(oriFile, toFile)
+        pass
+
+    return 0
+
+def mergeResFile(fromFile,toFile):
+    if not os.path.exists(fromFile):
+        printlog("fromFile or toFile is not exists")
+        return 1
+
+#    PrintLog("start to merge %s and %s "%(fromFile,toFile))
+
+    sourceTree = ET.parse(fromFile)
+    desTree = ET.parse(toFile)
+
+    # 临时打包目录
+    sourceRoot = sourceTree.getroot()
+    desRoot = desTree.getroot()
+
+    #SDK
+    sourceChildren = list(sourceRoot)
+    desChildren = list(desRoot)
+
+    #获取原文件attrib,用于排重
+    desNames = []
+    publicDict = {}
+    prefixDict = {}
+    for child in desChildren:
+#        PrintLog(child.attrib)
+        desNames.append(child.attrib["name"])
+        
+        #保存每个属性的最大id值
+        if fromFile.find("public.xml") > 0:
+            if child.attrib["type"] not in publicDict.keys():
+                publicDict[child.attrib["type"]] = int(child.attrib["id"],16)
+                if child.attrib["type"] not in prefixDict.keys():
+                    prefixDict[child.attrib["type"]] = child.attrib["id"][0:6]
+                
+#                PrintLog("prefixDict ---- ")
+#                PrintLog(prefixDict)
+            else:
+                newPublicId = int(child.attrib["id"],16)
+                oldPublicId = publicDict[child.attrib["type"]]
+                #publicDict[child.attrib["type"]] = newPublicId if newPublicId > oldPublicId else oldPublicId
+                if newPublicId > oldPublicId:
+                    publicDict[child.attrib["type"]] = newPublicId
+#                    PrintLog("replace type:%s"%publicDict[child.attrib["type"]])
+#                    PrintLog("replace oldPublicId:%d with newPublicId:%d"%(oldPublicId,newPublicId))
+
+    #打印测试信息
+#    PrintLog("print publicDict ----------------------------")
+#    PrintLog(publicDict)
+#    PrintLog("print publicDict ----------------------------")
+
+    for child in sourceChildren:
+        if child.attrib["name"] in desNames:
+            #若有重复,使用原包里的的
+            index = desNames.index(child.attrib["name"])
+#            PrintLog("confilct child:%s"%desChildren[index].attrib["name"])
+            continue
+#        PrintLog("append child name:%s"%child.attrib["name"])
+
+        #public.xml需要特殊合并
+        if fromFile.find("public.xml") > 0:
+            if child.attrib["type"] in publicDict:
+#                PrintLog("old id:%s --------------- type:%s"%(child.attrib["id"],child.attrib["type"]))
+                publicDict[child.attrib["type"]] = publicDict[child.attrib["type"]] + 1
+                child.attrib["id"] = hex(publicDict[child.attrib["type"]])
+#                PrintLog("new id:%s ---------------"%child.attrib["id"])
+            #如果ID不存在,则直接清0
+            elif child.attrib["type"] not in publicDict:
+
+#                PrintLog("reset id to 00")
+#                PrintLog("old id:%s ---------------"%child.attrib["id"])
+                    
+                last_preffix = sorted(prefixDict.values())[-1]        
+#                PrintLog("last object:%s"%last_preffix[-2:])
+                preffixNum = hex(int(last_preffix[-2:],16)+1)[last_preffix.index("x")+1:]
+                if len(preffixNum) < 2:
+                    preffixNum = "0"+preffixNum
+                preffix = "0x7f"+preffixNum
+#                PrintLog("preffix_suffix:%s"%preffix)
+                prefixDict[child.attrib["type"]] = preffix
+
+                publicDict[child.attrib["type"]] = int(preffix+"0000",16)
+#                PrintLog("publicDict with type:%s and value:%s"%(child.attrib["type"],publicDict[child.attrib["type"]]))
+                child.attrib["id"] = hex(publicDict[child.attrib["type"]])
+#                PrintLog("publicDict[child.attrib['type']:%s"%publicDict[child.attrib["type"]])
+#                PrintLog("new id:%s ---------------"%child.attrib["id"])
+
+        desRoot.append(child)
+
+    #PrintLog("print prefixDict ----------------------------")
+    #PrintLog(prefixDict)
+    #PrintLog("print prefixDict ----------------------------")
+
+#    if fromFile.find("public.xml") > 0:
+#        desRoot.getchildren().sort()
+
+#    PrintLog("start to write xml")
+    desTree.write(toFile,"utf-8",xml_declaration=True)
+#    PrintLog("finished writing xml")
+#    PrintLog("merging files finished")
+    return 0
+
+#比较函数,用于etree排序
+def cmp(x,y):
+    if x.attrib["type"] > y.attrib["type"]:
+        return 1
+    elif x.attrib["type"] < y.attrib["type"]:
+        return -1
+    else:
+        return 0
+    
+
+def mergeManifest(targetM,sdkConfig,debug = False):
+    #注册命名空间
+    ET.register_namespace('android',"http://schemas.android.com/apk/res/android")
+
+    printlog("targetM:%s" % targetM)
+    printlog("sdkConfig:%s" % sdkConfig)
+
+    if os.path.exists(targetM) == False or os.path.exists(sdkConfig) == False:
+        printlog("targetM or sdkConfig is not exists!")
+        return 1
+    sdkRoot = ET.parse(sdkConfig).getroot()
+    if sdkRoot == None:
+        printlog("cant parse sdkConfig!")
+        return 1
+    targetTree = ET.parse(targetM)
+    targetRoot = targetTree.getroot()
+    if targetRoot == None:
+        printlog("cant parse targetTree")
+        return 1
+
+    targetApplicationRoot = targetRoot.find("application")
+
+    #合并activity和service
+    sdkActivities = sdkRoot.find("sdk_activity").iter("activity")
+    sdkActivities_alicas = sdkRoot.find("sdk_activity").iter("activity-alias")
+    sdkServices = sdkRoot.find("sdk_activity").iter("service")
+    sdkReceiver = sdkRoot.find("sdk_activity").iter("receiver")
+    sdkProvider = sdkRoot.find("sdk_activity").iter("provider")
+    sdkQueries =  sdkRoot.find("sdk_activity").iter("queries")
+    for activity in sdkActivities:
+        targetApplicationRoot.append(activity)
+    for service in sdkServices:
+        targetApplicationRoot.append(service)
+    for receiver in sdkReceiver:
+        targetApplicationRoot.append(receiver)
+    for provider in sdkProvider:
+        targetApplicationRoot.append(provider)
+    for alicas in sdkActivities_alicas:
+        targetApplicationRoot.append(alicas)
+    for queries in sdkQueries:
+        targetApplicationRoot.append(queries)
+    printlog("merging activity and service completed!")
+
+    #合并meta-data
+    sdkMetas = sdkRoot.find("sdk_meta").iter("meta-data")
+    for meta in sdkMetas:
+        targetApplicationRoot.append(meta)
+    printlog("merging meta-data completed!")
+
+    #合并permission
+    sdkPermissions = []
+    for per in sdkRoot.find("sdk_permission").findall("uses-permission"):
+        sdkPermissions.append(list(per.attrib.values())[0])
+
+    targetPermissions = []
+    for per in targetRoot.findall("uses-permission"):
+        targetPermissions.append(list(per.attrib.values())[0])
+        targetRoot.remove(per)
+
+    #利用set排重
+    mergePermissions = list(set(sdkPermissions) | set(targetPermissions))
+    for per in mergePermissions:
+        element = ET.Element("uses-permission")
+        element.attrib = {"android:name":per}
+        element.tail = "\n\t"
+        targetRoot.append(element)
+
+    printlog("merging permission completed!")
+
+    if debug:
+        targetTree.write("test.xml","utf-8",xml_declaration=True)
+    else:
+        targetTree.write("%s"%targetM,"utf-8",xml_declaration=True)
+    printlog("writing AndroidManifest.xml completed!")
+    return 0
+    #fromDir SDK  toDir game
+def mergeDir(fromDir, toDir):
+    if os.path.exists(fromDir) == False:
+        return 1
+    
+    compareFile(fromDir, toDir)
+    return 0
+
+    pass
+
+def compareFile(cmpFile, oriFile):
+    exceptList = [ ]
+    for parent, dirName, fileNames in os.walk(cmpFile):
+        oriParent = parent.replace(cmpFile, oriFile)
+        shouldRewrite = parent.rfind("third/sdk")
+        for fileName in fileNames:
+            if shouldRewrite >= 0 or (os.path.exists("%s/%s"%(oriParent, fileName)) == False
+                                      and parent.find(Contants.getIgnorePackagePath()) < 0):
+                fromDir = "%s/%s"%(parent , fileName)
+#                PrintLog("fromDir :%s"%fromDir)
+                toDir = "%s/%s"%(oriParent, fileName)
+#                PrintLog("toDir: %s"%toDir)
+                copyFileForCompareFile(fromDir, toDir)
+
+    pass
+
+def copyAllFile(fromFile,toFile):
+    for parent, dirName, fileNames in os.walk(fromFile):
+        oriParent = parent.replace(fromFile, toFile)
+        for fileName in fileNames:
+            fromDir = "%s/%s"%(parent , fileName)
+#            PrintLog("fromDir :%s"%fromDir)
+            toDir = "%s/%s"%(oriParent, fileName)
+#            PrintLog("toDir: %s"%toDir)
+            copyFileForCompareFile(fromDir, toDir)
+    pass
+def copyFileForCompareFile(fromFile, toFile):
+    if os.path.exists(fromFile) == False:
+        printlog("file %s is not exists" % fromFile)
+        return 
+    
+    filePattern = re.compile(r".*\..*")
+    toDir = toFile
+    if filePattern.match(toFile):
+        toDir = os.path.dirname(toFile)
+    
+    if os.path.exists(toDir) == False:
+        os.makedirs(toDir)
+    shutil.copy(fromFile, toFile)
+    pass
+
+#文件修改时间比较 
+#file1 > file2 return 1
+#file1 == file2 return 0
+#file1 < file2 return -1
+#任意一个文件不存在则返回None
+def compareFileModifyTime(file1, file2):
+    result = 0
+    if not os.path.exists(file1):
+        err = "file %s is not exists"%file1
+        printlog(err)
+        return None
+    if not os.path.exists(file2):
+        err = "file %s is not exists"%file2
+        printlog(err)
+        return None
+    file1MTime = os.stat(file1).st_mtime
+    file2MTime = os.stat(file2).st_mtime
+
+    printlog("[file1MTime]: %s" % file1MTime)
+    printlog("[file2MTime]: %s" % file2MTime)
+    if file1MTime > file2MTime:
+        return 1
+    elif file1MTime < file2MTime:
+        return -1
+    else:
+        return 0
+    pass
+
+#合并apktool.yml中的unkown内容
+def mergeYmlContent(fromFilePath, toFilePath):
+    printlog("----------------------start mergeYmlContent --------------")
+    if os.path.exists(fromFilePath) == False:
+       return 0 
+    if os.path.exists(toFilePath) == False:
+       shutil.copy(fromFile, toFilePath)
+       return 1
+
+    unknownFiles = "unknownFiles:"
+
+    toFileLines = open(toFilePath).readlines()
+    toFile = open(toFilePath, "w")
+    toFileHasUnknowFilesMark = False #目标文件是否存在unknownFiles属性
+    for line in toFileLines:
+        if line.find(unknownFiles) >= 0:
+            toFileHasUnknowFilesMark = True
+            #当存在unknownFiles属性但为空时去掉{}重新写入
+            if line.find("{}") >= 0:
+                line = line.replace("{}", "")
+            toFile.write(line)
+            writeYmlContent(fromFilePath, toFile)
+            continue
+            pass
+        toFile.write(line)
+        pass
+
+    if toFileHasUnknowFilesMark == False:
+        toFile.write(unknownFiles)
+        toFile.write("\n")
+        writeYmlContent(fromFilePath, toFile)
+    return 1
+    pass
+
+def writeYmlContent(fromFilePath, toFile):
+    unknownFiles = "unknownFiles:"
+    lines = open(fromFilePath).readlines()
+    unknowFilesMarkFound = False
+    for line in lines:
+        if unknowFilesMarkFound:
+            if line.find(" ") == 0:
+                toFile.write(line)
+            else:
+                break
+        if line.find(unknownFiles) >= 0:
+            if line.find("{}") >= 0:
+                break
+            else:
+                unknowFilesMarkFound = True
+        pass
+    pass
+
+#文件安全删除
+def safeFileDelete(filePath):
+    if os.path.exists(filePath):
+            if os.path.isdir(filePath):
+                shutil.rmtree(filePath)
+                printlog(">>>>>>>>>>>>>>>>>>>>>>>>delete isdir filePath:<<<<<<<<<<<<<<<<<<<<<<<<<< %s" % filePath)
+            elif os.path.isfile(filePath):
+                printlog(">>>>>>>>>>>>>>>>>>>>>>>>delete isfile filePath:<<<<<<<<<<<<<<<<<<<<<<<<<< %s" % filePath)
+                os.remove(filePath)
+    return 
+#删除文件但不删除文件夹
+def del_file(path_data):
+    for i in os.listdir(path_data) :# os.listdir(path_data)#返回一个列表,里面是当前目录下面的所有东西的相对路径
+        file_data = path_data + "/" + i#当前文件夹的下面的所有东西的绝对路径
+        if os.path.isfile(file_data) == True:#os.path.isfile判断是否为文件,如果是文件,就删除.如果是文件夹.递归给del_file.
+            os.remove(file_data)
+        else:
+            del_file(file_data)
+
+
+if __name__ == "__main__":
+    #mergeManifest("AndroidManifest.xml","test_sdk_config.xml",True)
+    #copyFiles("test","toDir")
+    fromFile ="apktool.yml"
+    toFile = "des_apktool.yml"
+    mergeYmlContent(fromFile, toFile)
+
+    pass

+ 185 - 0
V1/GeneralModifySmali.py

@@ -0,0 +1,185 @@
+import xml.etree.ElementTree as ET
+from V1 import File, apk_utils
+import os
+import re
+from V1.PrintLog import printlog
+def getLauchActivityName(apkPath):
+    sdkAM = "%s/AndroidManifest.xml" % apkPath
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', "http://schemas.android.com/apk/res/android")
+    tree = ET.parse(sdkAM)
+    activitys = tree.getroot().find("application").findall("activity");
+    for activity in activitys:
+        filters = activity.findall('intent-filter')
+        for filter in filters:
+            categorys = filter.findall('category')
+            for category in categorys:
+                categoryname = category.attrib[namespace + "name"]
+                if (categoryname == "android.intent.category.LAUNCHER"):
+                    actname = activity.attrib[namespace + "name"]
+                    return actname
+
+def getLauchActivityScreenOrientation(apkPath):
+    sdkAM = "%s/AndroidManifest.xml" % apkPath
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', "http://schemas.android.com/apk/res/android")
+    tree = ET.parse(sdkAM)
+    activitys = tree.getroot().find("application").findall("activity");
+    for activity in activitys:
+        filters = activity.findall('intent-filter')
+        for filter in filters:
+            categorys = filter.findall('category')
+            for category in categorys:
+                categoryname = category.attrib[namespace + "name"]
+                if (categoryname == "android.intent.category.LAUNCHER"):
+                    screenOrientation = activity.attrib[namespace + "screenOrientation"]
+                    return screenOrientation
+
+
+
+def modifyLauchSmali(apkPath):
+    TAG = "Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V"
+    fc = "invoke-static {p0}, Lcom/yythird/sdk/BDInitAct;->initBD(Landroid/app/Activity;)V"
+    smalipath = getLauchSmaliPath(apkPath)
+    printlog("baidu smalipath: %s" % smalipath)
+    lines = open(smalipath, "r").readlines()
+    f = open(smalipath, "w")
+    for line in lines:
+        if line.find(TAG) != -1:
+          line = line + '\n' + fc + '\n';   
+        f.write(line)
+    f.close()
+def getLauchSmaliPath(apkPath):
+    sdkAM = "%s/AndroidManifest.xml"%apkPath
+    tree  = ET.parse(sdkAM)
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android',"http://schemas.android.com/apk/res/android")
+    activitys = tree.getroot().find("application").findall("activity");
+    for activity in activitys:
+                filters = activity.findall('intent-filter')
+                for filter in filters:
+                    categorys = filter.findall('category')
+                    actions = filter.findall('action')
+                    for category in categorys:          
+                        categoryname  = category.attrib[namespace + "name"]     
+                        if(categoryname =="android.intent.category.LAUNCHER"):              
+                            actname =  activity.attrib[namespace + "name"].replace(".", "/")
+                            return "%s/smali/%s.smali"%(apkPath,actname)
+    pass
+def modifyTTLauchSmali(apkPath):
+    TAG = "invoke-super {p0, p1, p2, p3}, Landroid/app/Activity;->onRequestPermissionsResult(I[Ljava/lang/String;[I)V"
+    TTSmali = "invoke-static {}, Lcom/wett/cooperation/container/TTSDKV2;->getInstance()Lcom/wett/cooperation/container/TTSDKV2;"
+    smalipath = getLauchSmaliPath(apkPath)
+    printlog("TT smalipath: %s" % smalipath)
+    lines = open(smalipath, "r").readlines()
+    if lines.find(TTSmali) != -1:
+        f = open(smalipath, "w")
+        for line in lines:
+            if line.find(TTSmali) != -1:
+              line = line + '\n' + TTSmali + '\n';   
+            f.write(line)
+        f.close()
+    pass
+def modifyYXFLauchSmali(apkPath):
+    oldText = ".super Landroid/app/Activity;"
+    newText = ".super Lcom/yaoyue/release/YYSplashActivity;"
+    oldActPkg = "Landroid/app/Activity;"
+    newActPkg = "Lcom/yaoyue/release/YYSplashActivity;"
+    smalipath = getLauchSmaliPath(apkPath)
+    printlog("YXF smalipath: %s" % smalipath)
+    lines = open(smalipath, "r").readlines()
+    f = open(smalipath, "w")
+    for line in lines:
+        if line.find(oldText) != -1:
+            line = re.sub(oldText,newText, line)
+        if line.find(oldActPkg) != -1:
+            line = re.sub(oldActPkg,newActPkg, line)
+        f.write(line)
+    f.close()
+    pass
+def modifyQuickLauchSmali(apkPath):
+    oldText = ".super Landroid/app/Activity;"
+    newText = ".super Lcom/quicksdk/QuickSdkSplashActivity;"
+    oldActPkg = "Landroid/app/Activity;"
+    newActPkg = "Lcom/quicksdk/QuickSdkSplashActivity;"
+    smalipath = getLauchSmaliPath(apkPath)
+    printlog("Quick smalipath: %s" % smalipath)
+    lines = open(smalipath, "r").readlines()
+    f = open(smalipath, "w")
+    for line in lines:
+        if line.find(oldText) != -1:
+            line = re.sub(oldText,newText, line)
+        if line.find(oldActPkg) != -1:
+            line = re.sub(oldActPkg,newActPkg, line)
+        f.write(line)
+    f.close()
+    pass
+
+def modifyRfileIdSmali(prj_path,r_path):
+    apkRfilePath = "%s%s" %(prj_path,r_path)
+    publicXml = "%s/res/values/public.xml" % prj_path
+    sdk_jar_dir = apk_utils.getToolsJarHome()
+    jarPath = "%s/MergeSamli.jar" % sdk_jar_dir
+    javaMerCm = 'java -jar %s %s %s' % (jarPath, publicXml, apkRfilePath)
+    printlog("javaMerCm:%s" % javaMerCm)
+    os.system(javaMerCm)
+    pass
+def replaceSdkV4Smali(prj_path,v4_path):
+    sdk_root_dir = apk_utils.getCutSdkRootHome()
+    pkgV4Path = "%s/smali/android/support/v4" % prj_path
+    printlog("pkgV4Path:%s" % pkgV4Path)
+    sdkV4Path = "%s/%s" % (sdk_root_dir,v4_path)
+    printlog("sdkV4Path:%s" % sdkV4Path)
+    if os.path.exists(pkgV4Path):
+        File.copyAllFile(sdkV4Path, pkgV4Path)
+    pass
+def modifyJrttV7ResIdSmali(prj_path):
+    pkgV7AttrPath = "%s/smali_classes3/android/support/v7/appcompat/R$attr.smali" % prj_path
+    if os.path.exists(pkgV7AttrPath):
+        pkgV7StyleablePath = r"%s/smali_classes3/android/support/v7/appcompat/R\$styleable.smali" % prj_path
+        data = ["windowActionBar:I", "windowActionBarOverlay:I", "windowActionModeOverlay:I",
+                "windowFixedHeightMajor:I", "windowFixedHeightMinor:I", "windowFixedWidthMajor:I",
+                "windowFixedWidthMinor:I", "windowMinWidthMajor:I", "windowMinWidthMinor:I", "windowNoTitle:I"]
+        with open(pkgV7AttrPath, "r") as f:
+            for line in f.readlines():
+                if data[0] in line:
+                    value = line.split("=")
+                    replaceShell = 'sed -i "s/0x7f040245/%s/g" %s' % (value[1].strip(), pkgV7StyleablePath)
+                    os.system(replaceShell)
+                elif data[1] in line:
+                    value = line.split("=")
+                    replaceShell = 'sed -i "s/0x7f040246/%s/g" %s' % (value[1].strip(), pkgV7StyleablePath)
+                    os.system(replaceShell)
+                elif data[2] in line:
+                    value = line.split("=")
+                    replaceShell = 'sed -i "s/0x7f040247/%s/g" %s' % (value[1].strip(), pkgV7StyleablePath)
+                    os.system(replaceShell)
+                elif data[3] in line:
+                    value = line.split("=")
+                    replaceShell = 'sed -i "s/0x7f040248/%s/g" %s' % (value[1].strip(), pkgV7StyleablePath)
+                    os.system(replaceShell)
+                elif data[4] in line:
+                    value = line.split("=")
+                    replaceShell = 'sed -i "s/0x7f040249/%s/g" %s' % (value[1].strip(), pkgV7StyleablePath)
+                    os.system(replaceShell)
+                elif data[5] in line:
+                    value = line.split("=")
+                    replaceShell = 'sed -i "s/0x7f04024a/%s/g" %s' % (value[1].strip(), pkgV7StyleablePath)
+                    os.system(replaceShell)
+                elif data[6] in line:
+                    value = line.split("=")
+                    replaceShell = 'sed -i "s/0x7f04024b/%s/g" %s' % (value[1].strip(), pkgV7StyleablePath)
+                    os.system(replaceShell)
+                elif data[7] in line:
+                    value = line.split("=")
+                    replaceShell = 'sed -i "s/0x7f04024c/%s/g" %s' % (value[1].strip(), pkgV7StyleablePath)
+                    os.system(replaceShell)
+                elif data[8] in line:
+                    value = line.split("=")
+                    replaceShell = 'sed -i "s/0x7f04024d/%s/g" %s' % (value[1].strip(), pkgV7StyleablePath)
+                    os.system(replaceShell)
+                elif data[9] in line:
+                    value = line.split("=")
+                    replaceShell = 'sed -i "s/0x7f04024e/%s/g" %s' % (value[1].strip(), pkgV7StyleablePath)
+                    os.system(replaceShell)
+        pass

+ 70 - 0
V1/HttpUtils.py

@@ -0,0 +1,70 @@
+# -*- coding:UTF-8 -*-
+import requests
+import json
+from V1 import Contants
+from V1.PrintLog import printlog
+
+def notify_sp_cut_state(sp_code, progress, msg, ad_code_list):
+    url = Contants.getSdkSpNotifyUrl()
+    if ad_code_list != 'null':
+        data = {"sp_code": sp_code, "msg": msg, "progress": progress, "ad_code_list": ad_code_list}
+    else:
+        data = {"sp_code": sp_code, "msg": msg, "progress": progress}
+    printlog(str(data))
+    content = http_request(url, data, False, 'get', False)
+    printlog(content)
+
+
+def notify_cut_state(gcp_code, progress, msg):
+    url = Contants.getSdkNotifyUrl()
+    data = {"gcp_code": gcp_code, "msg": msg, "progress": progress}
+    printlog(str(data))
+    content = http_request(url, data, False, 'get', False)
+    printlog(content)
+
+
+def http_request(url, data, is_https=False, method='post', is_json_type=False):
+    try:
+        headers = dict()
+        if is_json_type is True:
+            content_type = 'application/json; charset=UTF-8'
+        else:
+            content_type = 'application/x-www-form-urlencoded; charset=UTF-8'
+        if is_https is True:
+            url = 'https://%s' % url
+        else:
+            url = 'http://%s' % url
+        headers['Content-Type'] = content_type
+        post_data = set_params(data) if is_json_type is False else json.dumps(data)
+        if method == 'post':
+            result = requests.post(url, data=post_data, headers=headers, verify=False)
+        else:
+            result = requests.get(url + '?' + post_data, headers=headers, verify=False)
+        content = result.text
+        if not content:
+            return False
+        return content
+    except Exception as e:
+        return False
+
+
+def set_params(params={}):
+    """
+    生成参数
+    """
+    import urllib
+    if not isinstance(params, dict):
+        raise Exception("You must pass in a dictionary!")
+    params_list = []
+    for k, v in params.items():
+        if isinstance(v, list) and v:
+            if isinstance(v[0], dict):
+                params_list.append((k, json.dumps(v)))
+            else:
+                params_list.extend([(k, x) for x in v])
+        elif isinstance(v, dict):
+            params_list.append((k, json.dumps(v)))
+        else:
+            params_list.append((k, v))
+
+    return urllib.parse.urlencode(params_list)

+ 87 - 0
V1/Icon_Util.py

@@ -0,0 +1,87 @@
+# -*- coding:utf-8 -*-
+from V1 import Exec_Cmd_Utils
+import os
+import xml.etree.ElementTree as ET
+from V1.PrintLog import printlog
+
+
+def ResizeIcon(icon, toPath, width, height, saveName, uname):
+    if not os.path.exists(icon):
+        return False, "no such icon:%s" % icon
+    if width == 0 or height == 0:
+        return False, "width or height is 0"
+    if saveName == "":
+        return False, "icon save name is empty"
+    if not os.path.exists(toPath):
+        printlog("package icon path is empty:%s" % toPath)
+        return False, "package icon path is empty"
+    copyToPathShell = "/bin/cp %s %s/%s" % (icon, toPath, saveName)
+    ret, output = Exec_Cmd_Utils.exeCommonCmd(copyToPathShell)
+    if ret != 0:
+        return False, output
+
+    resizeShell = ''
+    if uname.strip() == "Darwin":
+        resizeShell = "/usr/bin/sips %s -z %s %s --out %s/%s" % (icon, width, height, toPath, saveName)
+    elif uname.strip() == "Linux":
+        resizeShell = "/usr/bin/convert -resize %sx%s  %s/%s  %s/%s" % (
+            width, height, toPath, saveName, toPath, saveName)
+
+    ret, output = Exec_Cmd_Utils.exeCommonCmd(resizeShell)
+    if ret != 0:
+        return False, output
+
+    return True, None
+
+
+pass
+
+
+def replaceIcon(icon_path, apk_decompile_tmp_dir):
+    temp_xml_path = os.path.join(apk_decompile_tmp_dir,'AndroidManifest.xml')
+    tem_res_dir ="%s/res/"%apk_decompile_tmp_dir
+    ret,icon_name = GetIconName(temp_xml_path)
+    if ret:
+        if os.path.exists(icon_path):
+            printlog("begin copy and resize icon:%s" % icon_name)
+
+            status, uname = Exec_Cmd_Utils.exeCommonCmd("uname")
+
+            allIconSize = {'drawable': '512', 'drawable-ldpi': '72', 'drawable-mdpi': '96', 'drawable-hdpi': '192',
+                           'drawable-xhdpi': '256'
+                , 'drawable-xxhdpi': '384', 'drawable-xxxhdpi': '512',
+                           'drawable-xhdpi-v4': '256', 'drawable-xxhdpi-v4': '384', 'drawable-xxxhdpi-v4': '512',
+                           'mipmap-ldpi': '36', 'mipmap-mdpi': '96', 'mipmap-hdpi': '192', 'mipmap-xhdpi': '256',
+                           'mipmap-xxhdpi': '384', 'mipmap-xxxhdpi': '512'
+                           }
+            roundIconSize = {'mipmap-ldpi': '36', 'mipmap-mdpi': '96', 'mipmap-hdpi': '192', 'mipmap-xhdpi': '256',
+                             'mipmap-xxhdpi-v4': '384', 'mipmap-xxxhdpi': '512'}
+            for iconDir, iconSize in allIconSize.items():
+                drawablePath = tem_res_dir + iconDir
+                ResizeIcon(icon_path, drawablePath, iconSize, iconSize,
+                           "%s.png" % icon_name, uname)
+            for iconDir, iconSize in roundIconSize.items():
+                drawablePath = tem_res_dir + iconDir
+                ResizeIcon(icon_path, drawablePath, iconSize, iconSize,
+                           "%s_round.png" % icon_name, uname)
+            return True
+        else:
+            return False
+
+
+
+
+def GetIconName(am_path):
+    if not os.path.exists(am_path):
+        return False, "AndroidManifest.xml is not exists!"
+    namespace = "http://schemas.android.com/apk/res/android"
+    amTree = ET.parse(am_path)
+    amRoot = amTree.getroot()
+    applicationNode = amRoot.find("application")
+    iconName = applicationNode.attrib.get("{%s}icon" % namespace)
+    if iconName is None:
+        return False, "cant find icon name"
+    iconName = iconName.split("/")[1]
+    return True, iconName
+
+    pass

+ 19 - 0
V1/Json_Util.py

@@ -0,0 +1,19 @@
+import json
+
+
+def ReadJson(json_file_path, key):
+    with open(json_file_path, 'r', encoding='UTF-8') as f:
+        s = json.load(f)
+        if not key in s:
+            return None
+        return s[key]
+
+
+def getJsonKeys(json_str):
+    return json_str.keys()
+
+
+if __name__ == "__main__":
+    # keystore = ReadJson("/Users/guweibing/921sdk/demo/config.json", "keystore")
+    # print keystore
+    pass

+ 21 - 0
V1/PrintLog.py

@@ -0,0 +1,21 @@
+import time
+
+
+TIMESTAMP = str(int(time.time()))
+
+LOGFILE = ""
+
+
+def printlog(content):
+    print(content)
+    with open(LOGFILE, 'a+', encoding='utf-8') as f:
+            f.write(content + '\n')
+    pass
+
+
+
+if __name__ == "__main__":
+    DEBUG = False
+
+    printlog("test")
+    printlog("test1")

+ 325 - 0
V1/Replace.py

@@ -0,0 +1,325 @@
+# -*-coding:utf-8-*-
+import json
+import os
+import re
+import xml.etree.ElementTree as ET
+
+from V1 import Exec_Cmd_Utils, ChannelReplace, File, apk_utils
+from V1.PrintLog import printlog
+
+
+def replaceAM_Meta_data(am_path, key, value):
+    lines = open(am_path).readlines()
+    fp = open(am_path, 'w')
+    for s in lines:
+        if (s.find('android:name=\"' + key + '\"') != -1):
+            printlog("Before replaceAM: %s" % s)
+            s = re.sub('android:name=\"' + key + '\" android:value=\".*\"',
+                       'android:name=\"' + key + '\" android:value=\"' + value + '\"', s)
+            printlog("After replaceAM: %s" % s)
+        fp.write(s)
+    fp.close()
+    pass
+
+
+def replaceAM_VersionCode(yml_path, value):
+    if not os.path.exists(yml_path):
+        return False, "yml is not exists in :%s" % yml_path
+    replaceVersionCodeShell = "/bin/sed -i -E \"s/(versionCode: ).*/\\1'%s'/\" %s" % (value, yml_path)
+    printlog("replace version code shell:%s" % replaceVersionCodeShell)
+    ret, msg = Exec_Cmd_Utils.exeCommonCmd(replaceVersionCodeShell)
+    if ret != 0:
+        return False, msg
+    return True, ""
+    pass
+
+
+def replaceAM_VersionName(yml_path, value):
+    if not os.path.exists(yml_path):
+        return False, "yml is not exists in :%s" % yml_path
+
+    replaceVersionNameShell = "/bin/sed -i -E \"s/(versionName:).*/\\1 %s/\" %s" % (value, yml_path)
+
+    ret, msg = Exec_Cmd_Utils.exeCommonCmd(replaceVersionNameShell)
+    if ret != 0:
+        return False, msg
+    return True, ""
+
+    pass
+
+
+def replaceLP_AppVersion(localproperties_path, value):
+    lines = open(localproperties_path).readlines()
+    fp = open(localproperties_path, 'w')
+    for s in lines:
+        s = re.sub('app.version=.*', 'app.version=' + value, s)
+        fp.write(s)
+    fp.close()
+    pass
+
+
+def replaceAM_ScreenOrientation(am_path, value):
+    lines = open(am_path).readlines()
+    fp = open(am_path, 'w')
+    for s in lines:
+        if (s.find("<!-- replace screenOrientation -->") != -1):
+            s = re.sub('android:screenOrientation=\".*\"', 'android:screenOrientation=\"' + value + '\"', s)
+        fp.write(s)
+    fp.close()
+    pass
+
+
+def replaceAssets_Param(assets_param_path, key, value):
+    lines = open(assets_param_path).readlines()
+    fp = open(assets_param_path, 'w')
+    for s in lines:
+        s = re.sub(key + '=.*', key + '=' + value, s)
+        fp.write(s)
+    fp.close()
+    pass
+
+
+def replaceAM_Debuggable(am_path):
+    lines = open(am_path).readlines()
+    fp = open(am_path, "w")
+
+    isReplaced = False
+    for l in lines:
+        if isReplaced == False and l.find("android:debuggable=") >= 0:
+            l = re.sub("android:debuggable=\"true\"", "android:debuggable=\"false\"", l)
+        fp.write(l)
+    fp.close()
+    pass
+
+
+def replaceAM_AllowBackup(am_path):
+    lines = open(am_path).readlines()
+    fp = open(am_path, "w")
+
+    isReplaced = False
+    for l in lines:
+        if isReplaced == False and l.find("android:allowBackup=") >= 0:
+            l = re.sub("android:allowBackup=\"true\"", "android:allowBackup=\"false\"", l)
+        fp.write(l)
+    fp.close()
+    pass
+
+
+def replaceString_Appname(prj_path, key, value):
+    if value == None or value == "":
+        return
+
+    # 命名空间,用于获取对应的值
+    namespace = "http://schemas.android.com/apk/res/android"
+    amTree = ET.parse("%s/AndroidManifest.xml" % prj_path)
+    if amTree == None:
+        return
+    amRoot = amTree.getroot()
+    applicationNode = amRoot.find("application")
+    nameLabelAttrib = applicationNode.attrib.get("{%s}label" % namespace)[1:]
+    nameLabelArr = nameLabelAttrib.split("/")
+    nameLabelFile = nameLabelArr[0]
+    nameLabel = nameLabelArr[1]
+
+    modifyFileTree = ET.parse("%s/res/values/%ss.xml" % (prj_path, nameLabelFile))
+    if modifyFileTree == None:
+        return False, "cant not parse manifest.xml"
+    modifyFileRoot = modifyFileTree.getroot()
+    for child in modifyFileRoot.getchildren():
+        if child.attrib["name"] == nameLabel:
+            child.text = value
+
+    modifyFileTree.write("%s/res/values/%ss.xml" % (prj_path, nameLabelFile), "utf-8", xml_declaration=True)
+    return True, ""
+    pass
+
+
+def replaceXmlValue(xml_path, name, value):
+    tree = ET.parse(xml_path)
+    if tree == None:
+        return
+    for child in list(tree.getroot()):
+        if child.attrib["name"] == name:
+            child.text = value
+    tree.write(xml_path, "utf-8", xml_declaration=True)
+    pass
+
+
+def replaceAM_package_name(temp_xml_path):
+    printlog("begin replace AndroidManifest.xml key : package_name")
+    manifestRoot = ET.parse(temp_xml_path).getroot()
+    pkgName = manifestRoot.attrib["package"]
+    replacePkgNameShell = '/bin/sed -i "1,\\$s/package_name/%s/g" %s' % (pkgName, temp_xml_path)
+    printlog("replacePkgNameShell:%s" % replacePkgNameShell)
+    os.system(replacePkgNameShell)
+    pass
+
+
+def special_replace(sdk_name, prj_path, dir_split, key, value):
+    # 获取特殊替换
+
+    replaceFun = ChannelReplace.getSpecilReplace(sdk_name)
+    if replaceFun is None:
+        printlog("no such channel: %s" % sdk_name)
+    else:
+        printlog("begin special replace: %s" % sdk_name)
+        replaceFun(prj_path, dir_split, key, value)
+        pass
+
+
+def replaceYml_targetSdkVersion(apkYmlPath, code):
+    lines = open(apkYmlPath).readlines()
+    fp = open(apkYmlPath, 'w')
+    for s in lines:
+        if 'targetSdkVersion' in s:
+            newTargetVersion = "  targetSdkVersion: '%s'" % code + '\n'
+            printlog("oldTargetVersion:%snewTargetVersion:%s" % (s, newTargetVersion))
+            s = re.sub(s, newTargetVersion, s)
+        fp.write(s)
+    fp.close()
+    pass
+
+
+def replaceYml_minSdkVersion(apkYmlPath):
+    lines = open(apkYmlPath).readlines()
+    fp = open(apkYmlPath, 'w')
+    code = "19"
+    for s in lines:
+        if 'minSdkVersion' in s:
+            versionCode = s.split(":")[1].replace("'", "").strip()
+            if versionCode < code:
+                newMinSdkVersion = "  minSdkVersion: '%s'" % code + '\n'
+                printlog("oldMinSdkVersion:%snewMinSdkVersion:%s" % (s, newMinSdkVersion))
+                s = re.sub(s, newMinSdkVersion, s)
+        fp.write(s)
+    fp.close()
+    pass
+
+
+def replaceJsonValue(path, root, key, value):
+    if root == "":
+        with open(path, 'r') as fp:
+            jsonData = json.load(fp)
+            jsonData[key] = value
+            newJsonData = jsonData
+            fp.close()
+
+        with open(path, 'w') as fp:
+            json.dump(newJsonData, fp)
+            fp.close()
+
+    else:
+        with open(path, 'r') as fp:
+            jsonData = json.load(fp)
+            jsonData[root][key] = value
+            newJsonData = jsonData
+            fp.close()
+
+        with open(path, 'w') as fp:
+            json.dump(newJsonData, fp)
+            fp.close()
+
+    pass
+
+
+def replaceGameActivityLaunchAttribute(splash_activity, manifest_path):
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', "http://schemas.android.com/apk/res/android")
+    tree = ET.parse(manifest_path)
+    game_activity = ""
+    activitys = tree.getroot().find("application").findall("activity")
+    for activity in activitys:
+        filters = activity.findall('intent-filter')
+        for filter in filters:
+            categorys = filter.findall('category')
+            actions = filter.findall('action')
+            for category in categorys:
+                category_name = category.attrib[namespace + "name"]
+                if category_name == "android.intent.category.LAUNCHER":
+                    action_name = activity.attrib[namespace + "name"]
+                    if action_name != splash_activity:
+                        game_activity = activity.attrib[namespace + "name"]
+                        printlog("delete :%s" % category_name)
+                        category.attrib[namespace + "name"] = "android.intent.category.DEFAULT"
+                        printlog("LAUNCHER replace DEFAULT :%s" % category.attrib[namespace + "name"])
+                        for action in actions:
+                            action_name = action.attrib[namespace + "name"]
+                            if action_name == "android.intent.action.MAIN":
+                                printlog("delete :%s" % action_name)
+                                filter.remove(action)
+    tree.write(manifest_path, "UTF-8", xml_declaration=True, method='xml')
+    return game_activity
+    pass
+
+
+def getLauchActivityName(apkPath):
+    sdkAM = "%s/AndroidManifest.xml" % apkPath
+    tree = ET.parse(sdkAM)
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', "http://schemas.android.com/apk/res/android")
+    activitys = tree.getroot().find("application").findall("activity");
+    for activity in activitys:
+        filters = activity.findall('intent-filter')
+        for filter in filters:
+            categorys = filter.findall('category')
+            for category in categorys:
+                categoryname = category.attrib[namespace + "name"]
+                if (categoryname == "android.intent.category.LAUNCHER"):
+                    actname = activity.attrib[namespace + "name"]
+                    return actname
+    pass
+
+
+def modifyRfileSmaliPath(channel, prj_path):
+    printlog("start copy and modify  R.smali-------")
+    manifestRoot = ET.parse("%s/AndroidManifest.xml" % prj_path).getroot()
+    pkgName = manifestRoot.attrib["package"]
+    sdk_root_dir = apk_utils.getCutSdkRootHome()
+    sdkRfilePath = "%s/%s/%s/extension/smali" % (sdk_root_dir, channel, channel)
+    printlog("sdkRfilePath:%s" % sdkRfilePath)
+    if os.path.exists(sdkRfilePath):
+        printlog("begin copy R.smali to apkpath---------")
+        apkPkgDir = ET.parse("%s/AndroidManifest.xml" % prj_path).getroot().attrib["package"].replace(".", "/")
+        apkRfilePath = "%s/smali/%s" % (prj_path, apkPkgDir)
+        if not os.path.exists(apkRfilePath):
+            os.makedirs(apkRfilePath)
+        os.system("/bin/cp -r %s/* %s" % (sdkRfilePath, apkRfilePath))
+        for parent, dirnames, filenames in os.walk(apkRfilePath):
+            printlog("replace apkRfile dirnames:%s" % dirnames)
+            for filename in filenames:
+                filepath = "'%s/%s'" % (apkRfilePath, filename)
+                replacePkgShell = 'sed -i "s#%s#%s#g" %s' % ("package_path", apkPkgDir, filepath)
+                os.system(replacePkgShell)
+                replacePkgShell = 'sed -i "s#%s#%s#g" %s' % ("package_name", pkgName, filepath)
+                os.system(replacePkgShell)
+    printlog("end copy R.smali file -------------------------------")
+
+
+def createRFile2Sdk(pkgAbsoluteRpath, sdkAbsoluteRpath, pkgRpath, sdkRpath):
+    if os.path.exists(sdkAbsoluteRpath):
+        File.del_file(sdkAbsoluteRpath)
+    else:
+        os.mkdir(sdkAbsoluteRpath)
+    File.copyAllFile(pkgAbsoluteRpath, sdkAbsoluteRpath)
+    printlog("pkgRpath: -------------%s" % pkgRpath)
+    printlog("sdkRpath: -------------%s" % sdkRpath)
+    for root, dirs, files in os.walk(sdkAbsoluteRpath):
+        for file in files:
+            if "$" in file:
+                file = file.split('$', 1)[0] + "\$" + file.split('$', 1)[1]
+            replaceKeyword(pkgRpath, sdkRpath, os.path.join(root, file).decode('gbk').encode('utf-8'))
+
+
+def replaceKeyword(key, value, file):
+    replaceShell = 'sed -i "s#%s#%s#g" %s' % (key, value, file)
+    printlog("replaceShell:%s" % replaceShell)
+    os.system(replaceShell)
+    pass
+
+
+if __name__ == "__main__":
+    # replaceAM_Meta_data("/sdk/develop/921sdk_cut/sdk_config/P0000001/anzhi/P0000004/AndroidManifest.xml", "QHOPENSDK_APPKEY", "20151219")
+    # replaceLP_AppVersion(sys.argv[1], sys.argv[2])
+    # replaceAssets_Param("/var/root/shortcuts/921sdkcut/tools/param.cnf", "SECRET_KEY", "20151226")
+    # special_replace("wdj", "/sdk/develop/tools/outputs/mxd/package/0.01.150608/360/test", "/", "APPKEY_ID", "20151228")
+    pass

+ 36 - 0
V1/Replace_GameRes_Utils.py

@@ -0,0 +1,36 @@
+# -*- coding:utf-8 -*-
+from V1 import Json_Util
+import os
+import shutil
+from V1.PrintLog import printlog
+def ReplaceGameResource(apk_decompile_tmp_dir,resourcepaths):
+
+    for resourcepath in resourcepaths:  
+#        PrintLog("resourcepaths:%s"%resourcepaths)
+        resource = resourcepath[0]
+        path = resourcepath[1]
+        if resource != None and resource != "" and path != None and path != "": 
+#                PrintLog("game resource: %s"%resource)
+                if not os.path.exists(path):
+                    printlog("game resource is not exists in:%s" % path)
+                    return False, "game resource is not exists in:%s"%resource
+                apkrespath = "%s/%s"%(apk_decompile_tmp_dir, resource)
+#                PrintLog("game apkrespath: %s"%apkrespath)
+            # dislogopath = "%s/assets/shansu/%s"%(decompilepath, QuickPackContants.getQuickPackLogoName())
+                if not os.path.exists(os.path.dirname(apkrespath)):
+                    os.makedirs(os.path.dirname(apkrespath))
+                shutil.copy(path, apkrespath)
+    pass
+def replaceAdGameResource(apk_decompile_tmp_dir,resourcepaths,resourceconfigs):
+    pathkeys = Json_Util.getJsonKeys(resourcepaths)
+    for key in pathkeys:
+        path = resourcepaths[key]
+        printlog("GameResourcePath:%s" % path)
+        if path != None and path != "":
+            print(resourceconfigs[key]["default"])
+            apkrespath = "%s/%s"%(apk_decompile_tmp_dir,resourceconfigs[key]["default"])
+            if not os.path.exists(os.path.dirname(apkrespath)):
+                os.makedirs(os.path.dirname(apkrespath))
+            shutil.copy(path, apkrespath)
+
+    pass    

+ 64 - 0
V1/apk_utils.py

@@ -0,0 +1,64 @@
+# -*- coding:utf-8 -*-
+
+
+JAVA_HOME = "/usr/java/jdk-12.0.1"
+
+
+JAVA_BIN = "%s/bin"%JAVA_HOME
+
+SDK_HOME = "/opt/mixsdk/tool/Android/Sdk/build-tools"
+
+SDK_BUILD_TOOL = "%s/build-tools/android-5.1"%SDK_HOME
+
+SDK_TOOLS = "%s/28.0.3"%SDK_HOME
+
+TOOLS_JAR_HOME = "/opt/mixsdk/tool/tool_jar"
+
+COMPILE_TOOLS_HOME = "/opt/mixsdk/tool/apktools"
+
+CUT_SDK_ROOT_HOME = "/opt/mixsdk/channelsdk"
+
+CUT_AD_SDK_ROOT_HOME = "/opt/mixsdk/adsdk"
+
+
+OUT_PUT_DIR = "/opt/new_packing_tool/output"
+
+SP_OUT_PUT_DIR = "/opt/new_packing_tool/sp_output"
+
+
+
+SIGNER_V2_JAR = "%s/apksigner-25.0.0.jar"%TOOLS_JAR_HOME
+
+
+def getJavaPath():
+    return JAVA_HOME
+
+def getJavaBinPath():
+    return JAVA_BIN
+
+def getSdkBuildToolPath():
+    return SDK_BUILD_TOOL
+def getSdkToolsPath():
+    return SDK_TOOLS
+
+def getToolsJarHome():
+    return TOOLS_JAR_HOME
+
+def getComplieToolsHome():
+    return COMPILE_TOOLS_HOME
+
+def getCutSdkRootHome():
+    return CUT_SDK_ROOT_HOME
+
+def getCutAdSdkRootHome():
+    return CUT_AD_SDK_ROOT_HOME
+
+def getOutPutDir():
+    return OUT_PUT_DIR
+
+def getSpOutPutDir():
+    return SP_OUT_PUT_DIR
+    
+def getSignV2Jar():
+    return SIGNER_V2_JAR    
+

+ 568 - 0
V1/merge_ad_pkg.py

@@ -0,0 +1,568 @@
+# -*- coding:utf-8 -*-
+import sys
+import os
+import xml.etree.ElementTree as ET
+
+from V1 import Contants, Exec_Cmd_Utils, HttpUtils, Replace_GameRes_Utils, PrintLog, Json_Util, File, Replace, \
+    apk_utils, Icon_Util
+from V1.PrintLog import printlog
+
+import random
+
+import shutil
+
+import yaml
+import json
+import traceback
+import time
+
+SUFFIX_BAT = ""
+DIR_SPLIT = "/"
+keystorepath = "/opt/packing_tool/keystore/yyrh.jks"
+storepass = "yyrh123456"
+keypass = "yyrh123456"
+alias = "yyrh"
+
+
+def startMerge(config_json_path):
+    global ad_code_list, sp_code, apk_decompile_tmp_dir
+    isSuccess = True
+
+    errorMsg = "切包失败,请联系开发人员"
+    time_start = time.time()
+    try:
+
+        sp_code = Json_Util.ReadJson(config_json_path, "sp_code")
+        PrintLog.LOGFILE = "%s/%s.txt" % (Contants.SDK_LOG, sp_code)
+
+        if os.path.exists(PrintLog.LOGFILE):
+            os.remove(PrintLog.LOGFILE)
+
+        printlog("[LOGFILE] : %s" % PrintLog.LOGFILE)
+
+        printlog("[sp_code] : %s" % sp_code)
+
+        origin_apk_full_path = Json_Util.ReadJson(config_json_path, "sub_apk_path")
+        printlog("[origin_apk_full_path] : %s" % origin_apk_full_path)
+        origin_apk_dir = os.path.dirname(origin_apk_full_path)
+        origin_apk_full_name = os.path.basename(origin_apk_full_path)
+        printlog("[origin_apk_dir] %s" % origin_apk_dir)
+        randomNumber = getRamdomNumber(6)
+        origin_apk_name = os.path.splitext(origin_apk_full_name)[0]
+        apk_decompile_tmp_dir = origin_apk_dir + DIR_SPLIT + randomNumber + DIR_SPLIT + origin_apk_name
+
+        ad_sdk_type = Json_Util.ReadJson(config_json_path, "ad_sdk_type")
+        printlog("[ad_sdk_type] : %s" % ad_sdk_type)
+
+        ad_allow_pt = Json_Util.ReadJson(config_json_path, "ad_allow_pt")
+        printlog("[ad_allow_pt] : %s" % ad_allow_pt)
+
+        ad_code_list = json.dumps(Json_Util.ReadJson(config_json_path, "ad_code_list"))
+        printlog("[ad_code_list] : %s" % ad_code_list)
+
+        sdk_code = Json_Util.ReadJson(config_json_path, "sdk_code")
+        printlog("[sdk_code] : %s" % sdk_code)
+
+        channel_map_id = Json_Util.ReadJson(config_json_path, "channel_map_id")
+        printlog("[channel_map_id] : %s" % channel_map_id)
+
+        # 包名
+        package_name = Json_Util.ReadJson(config_json_path, "package_name")  # sys.argv[3]
+        printlog("[package_name] : %s" % package_name)
+
+        # 版本号
+        version = Json_Util.ReadJson(config_json_path, "version")
+        vCode = Json_Util.ReadJson(config_json_path, "v_code")
+
+        # targetSdkVersion
+        targetSdkVersion = Json_Util.ReadJson(config_json_path, "targetSdkVersion")
+
+        # icon路径
+        icon_path = Json_Util.ReadJson(config_json_path, "icon_path")
+        printlog("[icon_path]: %s" % icon_path)
+
+        unsignedApkPath = "%s_unsigned.apk" % apk_decompile_tmp_dir
+        printlog("unsignedApkPath: %s" % unsignedApkPath)
+        signedApkPath = "%s_signed.apk" % apk_decompile_tmp_dir
+        printlog("signedApkPath: %s" % signedApkPath)
+        zipalignApkPath = "%s_zipaligned.apk" % apk_decompile_tmp_dir
+        printlog("zipalignApkPath: %s" % zipalignApkPath)
+
+        HttpUtils.notify_sp_cut_state(sp_code, "10", "正在反编译文件", ad_code_list)
+        printlog("----- begin  decompile -----")
+        ret = decompile(origin_apk_full_path, apk_decompile_tmp_dir)
+        if ret == 1:
+            errorMsg = "找不到游戏母包,请检查"
+            isSuccess = False
+            printlog(errorMsg)
+            HttpUtils.notify_sp_cut_state(sp_code, "99", errorMsg, ad_code_list)
+            return
+        printlog("----- begin  replace params -----")
+        temp_xml_path = apk_decompile_tmp_dir + DIR_SPLIT + "AndroidManifest.xml"
+        printlog("temp_xml_path %s" % temp_xml_path)
+        HttpUtils.notify_sp_cut_state(sp_code, "30", "正在修改SP_CODE", ad_code_list)
+        if ad_allow_pt != 0:
+            add_andriod_node(temp_xml_path, "yyrh_sp_code", sp_code)
+        HttpUtils.notify_sp_cut_state(sp_code, "40", "正在修改合并渠道", ad_code_list)
+        if ad_sdk_type == 2:
+            sdk_name = Json_Util.ReadJson(config_json_path, "sdk_code")
+            printlog("[sdk_name] : %s" % sdk_name)
+            sdk_root_dir = apk_utils.getCutAdSdkRootHome()
+
+            mergeManifest(sdk_root_dir + DIR_SPLIT + sdk_name + DIR_SPLIT + sdk_name + "_sdk_config.xml",
+                          temp_xml_path)
+            mergeResources(sdk_root_dir + DIR_SPLIT + sdk_name + DIR_SPLIT + sdk_name, apk_decompile_tmp_dir)
+            sdkParam = Json_Util.ReadJson(config_json_path, "sdk_param_conf")
+            printlog("channel sdk_param_conf: %s" % str(sdkParam))
+
+            # 替换Androidmanifest.xml中的 package_name值为包名
+            Replace.replaceAM_package_name(temp_xml_path)
+
+            if sdkParam != None and sdkParam != "":
+                keys = Json_Util.getJsonKeys(sdkParam)
+                for key in keys:
+                    printlog(key)
+
+                    # 替换AndroidManifest.xml中的meta-data字段
+                    Replace.replaceAM_Meta_data(temp_xml_path, key,
+                                                sdkParam[key])
+                    # 替换assets/YyrhAdParam.cnf中的关键字
+                    Replace.replaceAssets_Param(
+                        apk_decompile_tmp_dir + DIR_SPLIT + "assets" + DIR_SPLIT + "YyrhAdParam.cnf", key,
+                        sdkParam[key])
+                    # 特殊渠道需要特殊处理
+                    # Replace.special_replace(sdk_name, apk_decompile_tmp_dir, DIR_SPLIT, key, sdkParam[key])
+            pass
+        # 修改包Apk文件名
+
+        # 修改包名
+        if package_name:
+            oldPkgName = getOldPkgName(temp_xml_path)
+            origin_apk_name = origin_apk_name.replace(oldPkgName, package_name)
+            modifyPkgName(temp_xml_path, package_name)
+        pass
+        # 替换Icon
+        printlog("----- begin  replace resource -----")
+        HttpUtils.notify_sp_cut_state(sp_code, "50", "正在替换资源", ad_code_list)
+        if icon_path:
+            ret = Icon_Util.replaceIcon(icon_path, apk_decompile_tmp_dir)
+            if not ret:
+                errorMsg = "找不到icon,请检查"
+                printlog(errorMsg)
+                HttpUtils.notify_cut_state(sp_code, "99", errorMsg)
+        # 替换启动页
+        splash_path = Json_Util.ReadJson(config_json_path, "splash_path")
+        printlog("splash_path:%s" % splash_path)
+        if splash_path is not None:
+            if os.path.exists(splash_path):
+                shutil.copy(splash_path, "%s/assets/yyrh_start_image.jpg" % apk_decompile_tmp_dir)
+            else:
+                errorMsg = "找不到闪屏文件,请检查"
+                isSuccess = False
+                printlog(errorMsg)
+                HttpUtils.notify_sp_cut_state(sp_code, "99", errorMsg, ad_code_list)
+                return
+        # 获取游戏名,版本号,版本名,targetSdkVersion,屏幕方向关键字
+        gameParam = Json_Util.ReadJson(config_json_path, "meta_config_value")
+        printlog("gameParam:%s" % str(gameParam))
+        if gameParam:
+            keys = Json_Util.getJsonKeys(gameParam)
+            for key in keys:
+                if key == "APP_NAME":
+                    Replace.replaceString_Appname(apk_decompile_tmp_dir, key, gameParam[key])
+                elif key == "version":
+                    version = gameParam[key]
+                elif key == "v_code":
+                    vCode = gameParam[key]
+                elif key == "targetSdkVersion":
+                    targetSdkVersion = gameParam[key]
+                # 替换方向
+                elif key == "SDK_ORIENTATION":
+                    replaceOrientation = '/bin/sed -i "1,\\$s/sdk_orientation/%s/g" %s' % (
+                        gameParam[key], temp_xml_path)
+                    printlog("replaceOrientation: %s" % replaceOrientation)
+                    os.system(replaceOrientation)
+                    Replace.replaceAssets_Param(
+                        apk_decompile_tmp_dir + DIR_SPLIT + "assets" + DIR_SPLIT + "YyrhParam.cnf", "SDK_ORIENTATION",
+                        gameParam[key])
+            pass
+        # 修改版本号  targetSdkVersion
+        printlog("version: %s  vCode : %s" % (version, vCode))
+        printlog("targetSdkVersion: %s" % targetSdkVersion)
+        yml = "%s/apktool.yml" % apk_decompile_tmp_dir
+        if version != None and version != "":
+            Replace.replaceAM_VersionName(yml, version)
+        if vCode != None and vCode != "":
+            Replace.replaceAM_VersionCode(yml, vCode)
+        if targetSdkVersion != None and targetSdkVersion != "":
+            Replace.replaceYml_targetSdkVersion(yml, targetSdkVersion)
+        HttpUtils.notify_sp_cut_state(sp_code, "70", "正在替换游戏资源", ad_code_list)
+        # 替换游戏资源
+        resourcepaths = Json_Util.ReadJson(config_json_path, "game_resource_replace_path")
+        printlog(str(resourcepaths))
+        resourceconfigs = Json_Util.ReadJson(config_json_path, "game_resource_config")
+        if resourcepaths is not None:
+            keys = Json_Util.getJsonKeys(resourcepaths)
+            for key in keys:
+                path = resourcepaths[key]
+                printlog(path)
+                if not os.path.exists(path) and path != "":
+                    errorMsg = "游戏资源不存在:%s" % path
+                    printlog(errorMsg)
+                    isSuccess = False
+                    HttpUtils.notify_sp_cut_state(sp_code, "99", errorMsg, ad_code_list)
+                    return
+            printlog("replace game resource.")
+            Replace_GameRes_Utils.replaceAdGameResource(apk_decompile_tmp_dir, resourcepaths, resourceconfigs)
+        printlog("----- begin  recompile apk -----")
+        HttpUtils.notify_sp_cut_state(sp_code, "80", "正在回编译APK", ad_code_list)
+        recompile(apk_decompile_tmp_dir, unsignedApkPath)
+        printlog("unsignedApkPath: %s" % unsignedApkPath)
+
+        printlog("----- begin  resign apk -----")
+
+        HttpUtils.notify_sp_cut_state(sp_code, "90", "正在重签名,对齐APK", ad_code_list)
+        resignApk(unsignedApkPath, keystorepath, storepass, alias, keypass, signedApkPath)
+        printlog("signedApkPath %s" % signedApkPath)
+        printlog("----- begin  zipalign apk -----")
+        zipalignApk(signedApkPath, zipalignApkPath)
+        printlog("zipalignApkPath %s" % zipalignApkPath)
+        dst_dir = "%s%s" % (apk_utils.getSpOutPutDir(), DIR_SPLIT)
+        apkDstPath = "%s%s_%s.apk" % (dst_dir, origin_apk_name, sp_code)
+        printlog("origin_apk_name %s" % origin_apk_name)
+
+        if ad_allow_pt == 0 and ad_sdk_type == 2:
+            apkDstPath = "%s%s_%s_%s.apk" % (dst_dir, origin_apk_name, sdk_code, channel_map_id)
+        if ad_allow_pt == 0 and ad_sdk_type == 1:
+            apkDstPath = "%s%s_%s_%s.apk" % (dst_dir, origin_apk_name, sdk_code, channel_map_id)
+
+        if not os.path.exists(dst_dir):
+            os.makedirs(dst_dir)
+        printlog("apkDstPath %s" % apkDstPath)
+        shutil.copyfile(zipalignApkPath, apkDstPath)
+
+        time_end = time.time()
+        time_c = time_end - time_start
+        printlog("切包总用时:%s秒" % time_c)
+
+        HttpUtils.notify_sp_cut_state(sp_code, "100", "切包成功(点击复制链接)", ad_code_list)
+
+    except Exception as err:
+        HttpUtils.notify_sp_cut_state(sp_code, "99", errorMsg, ad_code_list)
+        printlog("cut error occur:%s" % err)
+        isSuccess = False
+        printlog(traceback.format_exc())
+    finally:
+        if apk_decompile_tmp_dir:
+            File.safeFileDelete(os.path.dirname(apk_decompile_tmp_dir))
+        return isSuccess
+
+
+def decompile(apkPath, desPath):
+    printlog("start to apkPath  %s" % apkPath)
+
+    global SUFFIX_BAT
+    if os.path.exists(apkPath) == False:
+        printlog("no such apk:%s" % apkPath)
+        return 1
+
+    home = apk_utils.getComplieToolsHome()
+    decompileCmd = "%s/apktool%s d -f %s -o  %s" % (home, SUFFIX_BAT, apkPath, desPath)
+    printlog("decompileCmd:%s" % decompileCmd)
+    ret = os.system(decompileCmd)
+
+    printlog("finished decompiling -------------------------")
+    return ret
+
+
+# recompile fileset to apk
+def recompile(apkPath, outputApkPath):
+    global SUFFIX_BAT
+    printlog("------------------------------ start to recompile ------------------------------ ")
+
+    global SUFFIX_BAT
+    recompileCmd = "%s/apktool%s -q b %s -o %s" % (apk_utils.getComplieToolsHome(), SUFFIX_BAT, apkPath, outputApkPath)
+    status, output = Exec_Cmd_Utils.exeCommonCmd(recompileCmd)
+    printlog(output)
+    if status != 0:
+        return 1
+
+    printlog("------------------------------ finished recompiling ------------------------------ ")
+
+    return 0
+
+
+def zipalignApk(unZipalignApk, outputPath=""):
+    printlog("start to zipalign apk ----------------------------")
+
+    if outputPath == "":
+        point = unZipalignApk.rfind(".")
+        outputPath = unZipalignApk[0:point] + "_zipaligned" + unZipalignApk[point:]
+        printlog("outputPath:%s" % outputPath)
+
+    zipalignCmd = "%s/zipalign -f 4 %s %s" % (apk_utils.getSdkToolsPath(), unZipalignApk, outputPath)
+    printlog("zipalignCmd:%s" % zipalignCmd)
+    status, output = Exec_Cmd_Utils.exeCommonCmd(zipalignCmd)
+    printlog(output)
+    if status != 0:
+        return 1
+
+    printlog("finished zipaligning apk -----------------------------")
+    return 0
+
+
+def add_andriod_node(xmlpath, key, value):
+    global child
+    ET.register_namespace('android', 'http://schemas.android.com/apk/res/android')
+    tree = ET.parse(xmlpath)
+    root = tree.getroot()
+    node = ET.Element("meta-data")
+    node.set("android:name", key)
+    node.set("android:value", value)
+    node.tail = "\n\t"
+
+    for i in root.iter("application"):
+        for child in i:
+            pass
+    child.tail = '\n\t\t'
+    for a in root.iter("application"):
+        a.append(node)
+        break
+    tree.write(xmlpath, encoding="utf-8", xml_declaration=True)
+
+
+def getRamdomNumber(size):
+    str = ""
+    for i in range(size):
+        ch = chr(random.randrange(ord('0'), ord('9') + 1))
+        str += ch
+    return str
+
+
+def resignApk(unsignedApkPath, keystorepath, storepass, alias, keypass, outputPath=""):
+    printlog("start to resign apk -----------------------")
+
+    if outputPath == "":
+        point = unsignedApkPath.rfind(".")
+        outputPath = unsignedApkPath[0:point] + "_signed" + unsignedApkPath[point:]
+        printlog("signedName:%s" % outputPath)
+
+    # 获取签名算法
+    getKeystoreAlgorithmShell = "%s/keytool -list -v -keystore %s -alias %s -storepass %s | /bin/sed -n \"13p\" | /usr/bin/awk -F ': ' '{print $2}'" % (
+        apk_utils.getJavaBinPath(), keystorepath, alias, storepass)
+    printlog("getKeystoreAlgorithmShell: %s" % getKeystoreAlgorithmShell)
+    ret, algorithm = Exec_Cmd_Utils.exeCommonCmd(getKeystoreAlgorithmShell)
+    algorithmMethod = algorithm.strip()
+    printlog("algorithmMethod: %s" % algorithmMethod)
+    resignCmd = "%s/jarsigner -sigalg %s -digestalg SHA1 -storepass %s -keypass %s -keystore %s -signedjar %s %s %s" % (
+        apk_utils.getJavaBinPath(), algorithmMethod, storepass, keypass, keystorepath, outputPath, unsignedApkPath,
+        alias)
+    printlog("resignCmd:%s" % resignCmd)
+
+    status, output = Exec_Cmd_Utils.exeCommonCmd(resignCmd)
+    printlog(output)
+
+    if status != 0:
+        return 1
+
+    printlog("finished resigning apk --------------------------")
+    return 0
+
+
+def modifyPkgName(temp_xml_path, pkgName):
+    # 修改包名
+    manifestRoot = ET.parse(temp_xml_path).getroot()
+    if manifestRoot == None:
+        return 1
+
+    if pkgName == "":
+        pkgName = manifestRoot.attrib["package"]
+        printlog("get pkg name:%s" % pkgName)
+    else:
+        oldPkgName = manifestRoot.attrib["package"]
+        content = open(temp_xml_path, "r").read()
+        content = content.replace(oldPkgName, pkgName)
+        open(temp_xml_path, "w").write(content)
+        printlog("old pkg name:%s" % oldPkgName)
+        printlog("new pkg name:%s" % pkgName)
+
+
+def getOldPkgName(temp_xml_path):
+    # 修改包名
+    manifestRoot = ET.parse(temp_xml_path).getroot()
+    if manifestRoot is None:
+        return ""
+    else:
+        oldPkgName = manifestRoot.attrib["package"]
+    return oldPkgName
+
+
+def mergeLibs(sdkPath, apkPath):
+    printlog("start to merge lib --------------------------------")
+
+    apkLib = "%s/lib" % apkPath
+    sdkLib = "%s/lib" % sdkPath
+    ret = 0
+
+    if not os.path.exists(apkLib) and os.path.exists(sdkLib):
+        shutil.copytree(sdkLib, apkLib)
+        printlog("finished merging lib --------------------------------")
+        return ret
+
+    apkFiles = os.listdir(apkLib)
+    sdkFiles = os.listdir(sdkLib)
+    for cpFile in sdkFiles:
+        if os.path.isfile(cpFile) == False and cpFile not in apkFiles:
+            continue
+        ret = ret | File.copyFiles("%s/lib/%s" % (sdkPath, cpFile), "%s/lib/%s" % (apkPath, cpFile))
+    printlog("finished merging lib --------------------------------")
+    return ret
+
+
+# sdk resources + apk resources
+def mergeResources(sdkPath, apkPath):
+    printlog("mergeResources  apkPath : %s" % apkPath)
+    printlog("start to merge resources ---------------------------")
+    ret = 0
+    # merge res
+    printlog("start to merge copyFiles ---------------------------")
+    ret = ret | File.copyFiles("%s/res" % sdkPath, "%s/res" % apkPath)
+    printlog("start to merge mergeLibs ---------------------------")
+    # copy lib and assets
+    ret = ret | mergeLibs(sdkPath, apkPath)
+    printlog("start to merge assets ---------------------------")
+    ret = ret | File.copyFiles("%s/assets" % sdkPath, "%s/assets" % apkPath)
+    printlog("start to merge smali ---------------------------")
+    ret = ret | File.mergeDir("%s/smali" % sdkPath, "%s/smali" % apkPath)
+    printlog("start to merge unknown ---------------------------")
+    ret = ret | File.mergeDir("%s/unknown" % sdkPath, "%s/unknown" % apkPath)
+    # 暂时的方案是用sdk的apktool.yml覆盖原包apktool.yml 后期需要做apktool.yml合并
+    if os.path.exists("%s/apktool.yml" % sdkPath):
+        printlog("start to merge apktool.yml ---------------------------")
+        mergeYml("%s/apktool.yml" % sdkPath, "%s/apktool.yml" % apkPath)
+    #    shutil.copy("%s/apktool.yml"%sdkPath, "%s/apktool.yml"%apkPath)
+
+    # 修改微信支付
+    # ret = ret | File.copyFiles("%s/smali"%sdkPath,"%s/smali"%apkPath)
+    printlog("finished merging resources ---------------------------")
+    return ret
+
+
+def mergeManifest(sdkConfigPath, temp_xml_path):
+    printlog("start to merge AndroidManifest.xml -------------------------")
+    ret = 0
+    ret = ret | File.mergeManifest(temp_xml_path, sdkConfigPath)
+    # 根据配置修改游戏名,包名等
+    printlog("finished merging AndroidManifest.xml -------------------------")
+    return ret
+
+
+def compileResources(apkPath, tempDir, pkgName=""):
+    printlog("[start to compile resources] -----------------------------------")
+
+    global SUFFIX_EXE
+    global SUFFIX_BAT
+
+    if File.copyFiles("%s/res" % apkPath, "%s/res" % tempDir) != 0:
+        printlog("no such files")
+        return 1
+    if not os.path.exists("%s/gen" % tempDir):
+        os.mkdir("%s/gen" % tempDir)
+
+    # 修改包名
+    manifestRoot = ET.parse("%s/AndroidManifest.xml" % apkPath).getroot()
+    if manifestRoot is None:
+        return 1
+
+    if pkgName == "":
+        pkgName = manifestRoot.attrib["package"]
+        printlog("get pkg name:%s ----------------------------" % pkgName)
+    else:
+        oldPkgName = manifestRoot.attrib["package"]
+        content = open("%s/AndroidManifest.xml" % apkPath, "r").read()
+        content = content.replace(oldPkgName, pkgName)
+        printlog("content ---------------------------------")
+        printlog(content)
+        open("%s/AndroidManifest.xml" % apkPath, "w").write(content)
+        printlog("old pkg name:%s ----------------------------" % oldPkgName)
+        printlog("new pkg name:%s ----------------------------" % pkgName)
+        # open("tmp/AndroidManifest.xml","w").write(content)
+        # manifestRoot.attrib["package"] = pkgName
+
+    createRFileCmd = "%s/aapt%s p -m -J %s/gen -M %s/AndroidManifest.xml -I %s/android.jar -S %s/res " % (
+        apk_utils.getComplieToolsHome(), SUFFIX_EXE, tempDir, apkPath, apk_utils.getToolsJarHome(), tempDir)
+    printlog("createRFileCmd:%s" % createRFileCmd)
+    if os.system(createRFileCmd) != 0:
+        return 1
+
+    sourcePath = pkgName.replace(".", "/")
+    createRClassCmd = "%s/javac -encoding utf-8 %s/gen/%s/R.java" % (apk_utils.getJavaBinPath(), tempDir, sourcePath)
+    printlog("createRClassCmd:%s" % createRClassCmd)
+    if os.system(createRClassCmd) != 0:
+        return 1
+
+    createDexCmd = "%s/dx%s --dex --output %s/classes.dex %s/gen" % (
+        apk_utils.getSdkBuildToolPath(), SUFFIX_BAT, tempDir, tempDir)
+    printlog("createDexCmd:%s" % createDexCmd)
+    if os.system(createDexCmd) != 0:
+        return 1
+
+    dex2smaliCmd = "%s/java -jar %s/baksmali-2.1.0.jar -o %s/smali %s/classes.dex" % (
+        apk_utils.getJavaBinPath(), apk_utils.getToolsJarHome(), apkPath, tempDir)
+    printlog("dex2smaliCmd:%s" % dex2smaliCmd)
+    if os.system(dex2smaliCmd) != 0:
+        return 1
+
+    printlog("finished compiling resources -----------------------------------")
+    return 0
+
+
+def mergeYml(fromfile, tofile):
+    if not os.path.exists(fromfile):
+        return False, "origin yaml file is not exists"
+
+    if not os.path.exists(tofile):
+        return False, "destination yaml file is not exists"
+
+    header = "!!brut.androlib.meta.MetaInfo\n"
+    fromcontent = open(fromfile, "r").read()
+    fromcontent = fromcontent.replace(header, "")
+
+    tocontent = open(tofile, "r").read()
+    tocontent = tocontent.replace(header, "")
+
+    fromroot = yaml.safe_load(fromcontent)
+    toroot = yaml.safe_load(tocontent)
+
+    if fromroot == None:
+        printlog("from root is empty")
+        return False, "orgin yaml file cant not be parsed or empty"
+    if toroot == None:
+        printlog("to root is empty")
+        return False, "destination yaml file cant not be parsed or is empty"
+
+    donotcompresskey = "doNotCompress"
+    if donotcompresskey in fromroot:
+        arr = fromroot[donotcompresskey]
+        if not donotcompresskey in toroot:
+            toroot[donotcompresskey] = arr
+        else:
+            toarr = toroot[donotcompresskey]
+            toroot[donotcompresskey] = list(set(toarr + arr))
+
+    unknownfileskey = "unknownFiles"
+    if unknownfileskey in fromroot:
+        fromunknownfilesarr = fromroot[unknownfileskey]
+    else:
+        fromunknownfilesarr = {}
+    tounknownfilesarr = toroot[unknownfileskey]
+
+    toroot[unknownfileskey] = dict(fromunknownfilesarr.items()).update(tounknownfilesarr.items())
+
+    desfile = open(tofile, "w")
+    desfile.writelines(header)
+    yaml.safe_dump(toroot, desfile, default_flow_style=False)
+    return True, ""
+
+    pass
+

+ 669 - 0
V1/merge_apk.py

@@ -0,0 +1,669 @@
+# -*- coding:utf-8 -*-
+
+import os
+import platform
+import shutil
+import xml.etree.ElementTree as ET
+
+import traceback
+
+import yaml
+
+import random
+
+from V1 import Contants, Exec_Cmd_Utils, HttpUtils, Replace_GameRes_Utils, PrintLog, CommonUtils, Json_Util, File, \
+    Replace, apk_utils, Icon_Util
+from V1.PrintLog import printlog
+import time
+
+SUFFIX_BAT = ""
+SUFFIX_EXE = ""
+DIR_SPLIT = "/"
+
+# Windows下使用.bat,unix无后缀
+if platform.system() == "Windows":
+    SUFFIX_BAT = ".bat"
+    SUFFIX_EXE = ".exe"
+    DIR_SPLIT = "\\"
+
+
+# decompile apk
+def decompile(apkPath, desPath):
+    printlog("start to apkPath -- %s" % apkPath)
+
+    global SUFFIX_BAT
+    if os.path.exists(apkPath) == False:
+        printlog("no such apk:%s" % apkPath)
+        return 1
+
+    home = apk_utils.getComplieToolsHome()
+    decompileCmd = "%s/apktool%s d -f -o %s/ %s" % (home, SUFFIX_BAT, desPath, apkPath)
+    printlog("decompileCmd:%s" % decompileCmd)
+    ret = os.system(decompileCmd)
+
+    printlog("finished decompiling -------------------------")
+    return ret
+
+
+# recompile fileset to apk
+def recompile(apkPath, outputApkPath):
+    global SUFFIX_BAT
+    printlog("------------------------------ start to recompile ------------------------------ ")
+
+    global SUFFIX_BAT
+    recompileCmd = "%s/apktool%s -q b %s -o %s" % (apk_utils.getComplieToolsHome(), SUFFIX_BAT, apkPath, outputApkPath)
+    status, output = Exec_Cmd_Utils.exeCommonCmd(recompileCmd)
+    printlog(output)
+    if status != 0:
+        return 1
+
+    printlog("------------------------------ finished recompiling ------------------------------ ")
+
+    return 0
+
+
+def mergeYml(fromfile, tofile):
+    if not os.path.exists(fromfile):
+        return False, "origin yaml file is not exists"
+
+    if not os.path.exists(tofile):
+        return False, "destination yaml file is not exists"
+
+    header = "!!brut.androlib.meta.MetaInfo\n"
+    fromcontent = open(fromfile, "r").read()
+    fromcontent = fromcontent.replace(header, "")
+
+    tocontent = open(tofile, "r").read()
+    tocontent = tocontent.replace(header, "")
+
+    fromroot = yaml.safe_load(fromcontent)
+    toroot = yaml.safe_load(tocontent)
+
+    if fromroot == None:
+        printlog("from root is empty")
+        return False, "orgin yaml file cant not be parsed or empty"
+    if toroot == None:
+        printlog("to root is empty")
+        return False, "destination yaml file cant not be parsed or is empty"
+
+    donotcompresskey = "doNotCompress"
+    if donotcompresskey in fromroot:
+        arr = fromroot[donotcompresskey]
+        if not donotcompresskey in toroot:
+            toroot[donotcompresskey] = arr
+        else:
+            toarr = toroot[donotcompresskey]
+            toroot[donotcompresskey] = list(set(toarr + arr))
+
+    unknownfileskey = "unknownFiles"
+    if unknownfileskey in fromroot:
+        fromunknownfilesarr = fromroot[unknownfileskey]
+    else:
+        fromunknownfilesarr = {}
+    tounknownfilesarr = toroot[unknownfileskey]
+
+    toroot[unknownfileskey] = dict(fromunknownfilesarr.items()).update(tounknownfilesarr.items())
+
+    desfile = open(tofile, "w")
+    desfile.writelines(header)
+    yaml.safe_dump(toroot, desfile, default_flow_style=False)
+    return True, ""
+
+    pass
+
+
+# sdk resources + apk resources
+def mergeResources(sdkPath, apkPath):
+    printlog("--------------------------- start to merge resources ---------------------------")
+    ret = 0
+    # merge res
+    # sdk_root_dir = apk_utils.getCutSdkRootHome() + "/" + os.path.basename(sdkPath)
+
+    ret = ret | File.copyFiles("%s/res" % sdkPath, "%s/res" % apkPath)
+    # copy lib and assets
+    # 避免由于架构导致复制无用架构
+    ret = ret | mergeLibs(sdkPath, apkPath)
+    ret = ret | File.copyFiles("%s/assets" % sdkPath, "%s/assets" % apkPath)
+    ret = ret | File.mergeDir("%s/smali" % sdkPath, "%s/smali" % apkPath)
+
+    ret = ret | File.mergeDir("%s/smali_classes2" % sdkPath, "%s/smali_classes2" % apkPath)
+    ret = ret | File.mergeDir("%s/smali_classes3" % sdkPath, "%s/smali_classes3" % apkPath)
+    ret = ret | File.mergeDir("%s/smali_classes4" % sdkPath, "%s/smali_classes4" % apkPath)
+    ret = ret | File.mergeDir("%s/smali_classes5" % sdkPath, "%s/smali_classes5" % apkPath)
+    ret = ret | File.mergeDir("%s/smali_classes6" % sdkPath, "%s/smali_classes6" % apkPath)
+
+    ret = ret | File.mergeDir("%s/unknown" % sdkPath, "%s/unknown" % apkPath)
+    # 暂时的方案是用sdk的apktool.yml覆盖原包apktool.yml 后期需要做apktool.yml合并
+    if os.path.exists("%s/apktool.yml" % sdkPath):
+        mergeYml("%s/apktool.yml" % sdkPath, "%s/apktool.yml" % apkPath)
+    #    shutil.copy("%s/apktool.yml"%sdkPath, "%s/apktool.yml"%apkPath)
+
+    # 修改微信支付
+    # ret = ret | File.copyFiles("%s/smali"%sdkPath,"%s/smali"%apkPath)
+    printlog("--------------------------- finished merging resources ---------------------------")
+    return ret
+
+
+# add 合并lib文件
+def mergeLibs(sdkPath, apkPath):
+    printlog("--------------------------- start to merge lib --------------------------------")
+
+    apkLib = "%s/lib" % apkPath
+    sdkLib = "%s/lib" % sdkPath
+    ret = 0
+
+    if not os.path.exists(apkLib) and os.path.exists(sdkLib):
+        shutil.copytree(sdkLib, apkLib)
+        printlog("finished merging lib --------------------------------")
+        return ret
+
+    apkFiles = os.listdir(apkLib)
+    sdkFiles = os.listdir(sdkLib)
+    for cpFile in sdkFiles:
+        if os.path.isfile(cpFile) == False and cpFile not in apkFiles:
+            continue
+        ret = ret | File.copyFiles("%s/lib/%s" % (sdkPath, cpFile), "%s/lib/%s" % (apkPath, cpFile))
+    printlog("--------------------------- finished merging lib --------------------------------")
+    return ret
+
+
+# 修改微信支付
+def mergeWXPay(sdkPath, apkPath):
+    printlog("--------------------------- start merge wechat pay ---------------------------")
+    sdkAM = "%s/AndroidManifest.xml" % sdkPath
+    sdkAMRoot = ET.parse(sdkAM).getroot()
+    sdkPkgName = sdkAMRoot.attrib["package"].replace(".", "/")
+    sdkWxApiFilePath = "%s/smali/%s/wxapi" % (sdkPath, sdkPkgName)
+    printlog("wx api file path:%s" % sdkWxApiFilePath)
+    if os.path.exists(sdkWxApiFilePath):
+        printlog("begin copy wxapi file")
+        apkWxApi = ET.parse("%s/AndroidManifest.xml" % apkPath).getroot().attrib["package"].replace(".", "/")
+        apkWxApiFilePath = "%s/smali/%s/wxapi" % (apkPath, apkWxApi)
+        printlog("wxapi path:%s" % apkWxApiFilePath)
+        if not os.path.exists(apkWxApiFilePath):
+            os.makedirs(apkWxApiFilePath)
+        # shutil.copy("%s/*"%wxApiFilePath, apkWxApiFilePath)
+        os.system("/bin/cp -r %s/* %s" % (sdkWxApiFilePath, apkWxApiFilePath))
+        for parent, dirnames, filenames in os.walk(apkWxApiFilePath):
+            printlog("replace pgk ---------")
+            for filename in filenames:
+                printlog("start to replace: %s" % filename)
+                formatFname = "'%s'" % filename
+                replacePkgShell = 'sed -i "s#%s#%s#g" %s/%s' % (sdkPkgName, apkWxApi, apkWxApiFilePath, formatFname)
+                printlog("replace package name shell: %s" % replacePkgShell)
+                os.system(replacePkgShell)
+        printlog("end copy wxapi file -------------------------------")
+    pass
+
+
+# sdkConfig.xml + AndroidManifest.xml
+# sdkConfigPath: 渠道配置路径
+# apkPath:解包后AndroidManifest.xml路径
+def mergeManifest(sdkConfigPath, apkPath):
+    printlog("start to merge AndroidManifest.xml -------------------------")
+    ret = 0
+    ret = ret | File.mergeManifest("%s/AndroidManifest.xml" % apkPath, sdkConfigPath)
+    # 根据配置修改游戏名,包名等
+    printlog("--------------------------- finished merging AndroidManifest.xml -------------------------")
+    return ret
+
+
+def replacePkgName(manifestPath, pkgName):
+    if not os.path.exists(manifestPath):
+        return False, "manifest path is not exists"
+    if pkgName == None or pkgName == "":
+        return False, "package name is empty"
+
+    pkgName = pkgName.strip()
+
+    root = ET.parse(manifestPath).getroot()
+
+    if root == None:
+        return False, "can's parse manifest"
+
+    oldpkgname = root.attrib["package"]
+    lines = open(manifestPath, "r").readlines()
+    f = open(manifestPath, "w")
+    for line in lines:
+        line = line.replace(oldpkgname, pkgName)
+        f.write(line)
+    f.close()
+
+    return True, ""
+    pass
+
+
+# @Description -- 对apk进行重新签名.若未提供对齐后的路径或名字,则以当前的命令在.apk前添加_signed
+# unsignedApkPath: 未签名的包
+# keyConfig: 签名配置(暂时未使用)
+# outputPath: 签名完成后的包路径
+def resignApk(unsignedApkPath, keystorepath, storepass, alias, keypass, outputPath=""):
+    printlog("start to resign apk -----------------------")
+
+    if outputPath == "":
+        point = unsignedApkPath.rfind(".")
+        outputPath = unsignedApkPath[0:point] + "_signed" + unsignedApkPath[point:]
+        printlog("signedName:%s" % outputPath)
+
+    # 获取签名算法
+    getKeystoreAlgorithmShell = "%s/keytool -list -v -keystore %s -alias %s -storepass %s | /bin/sed -n \"13p\" | /usr/bin/awk -F ': ' '{print $2}'" % (
+        apk_utils.getJavaBinPath(), keystorepath, alias, storepass)
+
+    ret, algorithm = Exec_Cmd_Utils.exeCommonCmd(getKeystoreAlgorithmShell)
+    algorithmMethod = algorithm.strip()
+    printlog("algorithmMethod: %s" % algorithmMethod)
+    resignCmd = "%s/jarsigner -sigalg %s -digestalg SHA1 -storepass %s -keypass %s -keystore %s -signedjar %s %s %s" % (
+        apk_utils.getJavaBinPath(), algorithmMethod, storepass, keypass, keystorepath, outputPath, unsignedApkPath,
+        alias)
+
+    status, output = Exec_Cmd_Utils.exeCommonCmd(resignCmd)
+
+    if status != 0:
+        return 1
+
+    printlog("--------------------------- finished resigning apk --------------------------")
+    return 0
+
+
+# @Description -- 对apk进行V2重新签名.若未提供对齐后的路径或名字,则以当前的命令在.apk前添加_signed
+# unsignedApkPath: 未签名已对齐的包
+# keyConfig: 签名配置(暂时未使用)
+# outputPath: 签名完成后的包路径
+def resignV2Apk(unsignedApkPath, keystorepath, storepass, alias, keypass, outputPath=""):
+    printlog("--------------------------- start to resign apk by  V2 -----------------------")
+    if outputPath == "":
+        point = unsignedApkPath.rfind(".")
+        outputPath = unsignedApkPath[0:point] + "_signed" + unsignedApkPath[point:]
+        printlog("signedName:%s" % outputPath)
+
+    resignCmd = "/usr/bin/java -jar %s sign --ks %s --ks-key-alias %s --ks-pass pass:%s --key-pass pass:%s  --out %s %s" % (
+        apk_utils.getSignV2Jar(), keystorepath, alias, storepass, keypass, outputPath, unsignedApkPath)
+    printlog(resignCmd)
+    status, output = Exec_Cmd_Utils.exeCommonCmd(resignCmd)
+    if status != 0:
+        return 1
+    printlog("--------------------------- finished resigning  V2  apk --------------------------")
+    return 0
+
+
+# @Description -- 把重新签名的包做4字节对齐,若未提供对齐后的路径或名字,则以当前的命令在.apk前添加_zipaligned
+# unZipalignApk: 未对齐的apk路径
+# outputPath: 对齐后的文件名
+# @return 0为成功 1为失败
+def zipalignApk(unZipalignApk, outputPath=""):
+    if outputPath == "":
+        point = unZipalignApk.rfind(".")
+        outputPath = unZipalignApk[0:point] + "_zipaligned" + unZipalignApk[point:]
+        printlog("outputPath:%s" % outputPath)
+
+    zipalignCmd = "%s/zipalign -f 4 %s %s" % (apk_utils.getSdkToolsPath(), unZipalignApk, outputPath)
+    printlog("zipalignCmd:%s" % zipalignCmd)
+    status, output = Exec_Cmd_Utils.exeCommonCmd(zipalignCmd)
+    printlog(output)
+    if status != 0:
+        return 1
+
+    printlog("--------------------------- finished zipaligning apk -----------------------------")
+    return 0
+
+
+def getRamdomNumber(size):
+    str = ""
+    for i in range(size):
+        ch = chr(random.randrange(ord('0'), ord('9') + 1))
+        str += ch
+    return str
+
+
+def modifyPkgName(apkPath, pkgName):
+    # 修改包名
+    manifestRoot = ET.parse("%s/AndroidManifest.xml" % apkPath).getroot()
+    if manifestRoot == None:
+        return 1
+
+    if pkgName == "":
+        pkgName = manifestRoot.attrib["package"]
+        printlog("get pkg name:%s ----------------------------" % pkgName)
+    else:
+        oldPkgName = manifestRoot.attrib["package"]
+        content = open("%s/AndroidManifest.xml" % apkPath, "r").read()
+        content = content.replace(oldPkgName, pkgName)
+        open("%s/AndroidManifest.xml" % apkPath, "w").write(content)
+        printlog("old pkg name:%s ----------------------------" % oldPkgName)
+        printlog("new pkg name:%s ----------------------------" % pkgName)
+
+
+def getOldPkgName(apkPath):
+    # 修改包名
+    manifestRoot = ET.parse("%s/AndroidManifest.xml" % apkPath).getroot()
+    if manifestRoot == None:
+        return ""
+    else:
+        oldPkgName = manifestRoot.attrib["package"]
+    return oldPkgName
+
+
+def startMerge(config_json_path):
+    global gcp_code
+    isSuccess = True
+
+    errorMsg = "切包失败,请联系开发人员"
+
+    apk_decompile_tmp_dir = ""
+    try:
+        # 当前脚本路径
+        # PrintLog "[current_py_path]: %s"%sys.argv[0]
+        # py_dir = sys.path[0]
+        # PrintLog "[py_dir] : %s"%py_dir
+
+        # 更新svn库,1脚本文件;2sdk内容;3sdk_config;4tools;5doc etc
+        # os.system("svn up " + py_dir + DIR_SPLIT + ".." + DIR_SPLIT)
+
+        # 第一个参数json文件路径
+        # config_json_path = sys.argv[1]
+        # 包编号
+
+        time_start = time.time()
+        gcp_code = Json_Util.ReadJson(config_json_path, "gcp_code")
+
+        PrintLog.LOGFILE = "%s/%s.txt" % (Contants.SDK_LOG, gcp_code)
+        if os.path.exists(PrintLog.LOGFILE):
+            os.remove(PrintLog.LOGFILE)
+
+        HttpUtils.notify_cut_state(gcp_code, "5", "正在读取配置")
+
+        printlog("[LOGFILE] : %s" % PrintLog.LOGFILE)
+
+        printlog("[gcp_code] : %s" % gcp_code)
+
+        printlog("[config_json_path] : %s" % config_json_path)
+
+        # apk文件的全路径(eg: /sdk/develop/tools/outputs/mxd/package/0.01.150608/360/360_0.01.150608_high_all.apk )
+        origin_apk_full_path = Json_Util.ReadJson(config_json_path, "apk_path")  # sys.argv[1]
+        printlog("[origin_apk_full_path] : %s" % origin_apk_full_path)
+        if not os.path.exists(origin_apk_full_path):
+            errorMsg = "找不到游戏母包,请检查"
+            printlog(errorMsg)
+            HttpUtils.notify_cut_state(gcp_code, "99", errorMsg)
+            return
+
+        # apk文件全名(eg: 360_0.01.150608_high_all.apk )
+        origin_apk_full_name = os.path.basename(origin_apk_full_path)
+        printlog("[origin_apk_full_name] : %s" % origin_apk_full_name)
+        # apk文件名(eg: 360_0.01.150608_high_all)
+        origin_apk_name = os.path.splitext(origin_apk_full_name)[0]
+        printlog("[origin_apk_name] : %s" % origin_apk_name)
+        # apk文件路径(eg: /sdk/develop/tools/outputs/mxd/package/0.01.150608/360 )
+        origin_apk_dir = os.path.dirname(origin_apk_full_path)
+        printlog("[origin_apk_dir] : %s" % origin_apk_dir)
+
+        # 渠道名
+        sdk_name = Json_Util.ReadJson(config_json_path, "channel_key")  # sys.argv[2]
+        printlog("[sdk_name] : %s" % sdk_name)
+        # 包名
+        package_name = Json_Util.ReadJson(config_json_path, "package_name")  # sys.argv[3]
+        printlog("[package_name] : %s" % package_name)
+        result = CommonUtils.isMatchRegExp(package_name, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.")
+        if result == False:
+            errorMsg = "包名包含特殊字符,不允许切包"
+            printlog(errorMsg)
+            HttpUtils.notify_cut_state(gcp_code, "99", errorMsg)
+            return
+        # 游戏编号
+        g_id = Json_Util.ReadJson(config_json_path, "gid")
+        printlog("[gid] : %s" % g_id)
+        # 游戏c_id
+        c_id = Json_Util.ReadJson(config_json_path, "cid")
+        printlog("[cid] : %s" % c_id)
+        # 渠道文件的根目录
+        sdk_root_dir = apk_utils.getCutSdkRootHome()
+        printlog("[sdk_root_dir] : %s" % sdk_root_dir)
+        # 打包渠道SDK的目录
+        channel_sdk_root_dir = sdk_root_dir + DIR_SPLIT + sdk_name
+        printlog("[channel_sdk_root_dir] : %s" % channel_sdk_root_dir)
+        if not os.path.exists(channel_sdk_root_dir):
+            errorMsg = "该渠道尚未接入完成"
+            printlog(errorMsg)
+
+            HttpUtils.notify_cut_state(gcp_code, "99", errorMsg)
+            return
+
+        # keystore配置文件
+        keystorepath = Json_Util.ReadJson(config_json_path, "keystore_path")
+        printlog("[keystorepath] : %s" % keystorepath)
+
+        if not os.path.exists(keystorepath):
+            errorMsg = "找不到签名文件,请检查"
+            printlog(errorMsg)
+
+            HttpUtils.notify_cut_state(gcp_code, "99", errorMsg)
+            return
+
+        storepass = Json_Util.ReadJson(config_json_path, "storepass")
+        printlog("[storepass] : %s" % storepass)
+        keypass = Json_Util.ReadJson(config_json_path, "keypass")
+        printlog("[keypass] : %s" % keypass)
+        alias = Json_Util.ReadJson(config_json_path, "alias")
+        printlog("[alias] : %s" % alias)
+        # 反编译原apk文件的输出路径
+        apk_decompile_out_dir = origin_apk_dir + DIR_SPLIT + origin_apk_name
+        printlog("[apk_decompile_out_dir] : %s" % apk_decompile_out_dir)
+
+        # icon路径
+        icon_path = Json_Util.ReadJson(config_json_path, "icon")
+        printlog("[icon_path]: %s" % icon_path)
+
+        # 版本号
+        version = Json_Util.ReadJson(config_json_path, "version")
+        vCode = Json_Util.ReadJson(config_json_path, "v_code")
+
+        # targetSdkVersion
+        targetSdkVersion = Json_Util.ReadJson(config_json_path, "targetSdkVersion")
+
+        HttpUtils.notify_cut_state(gcp_code, "10", "正在反编译文件")
+        # 判断反编译出的文件修改时间与apk修改时间比较,若比apk最则重新反编译
+        ret = File.compareFileModifyTime(origin_apk_full_path, apk_decompile_out_dir)
+        if ret != None:
+            printlog("母包未更新,无需重新反编译")
+        if ret == None or ret > 0:
+            # 反编译原apk文件
+            decompile(origin_apk_full_path, apk_decompile_out_dir)
+        HttpUtils.notify_cut_state(gcp_code, "20", "正在复制文件")
+        randomNumber = getRamdomNumber(6)
+        apk_decompile_tmp_dir = origin_apk_dir + DIR_SPLIT + randomNumber + DIR_SPLIT + "dcm_tmp" + sdk_name
+        printlog("[apk_decompile_tmp_dir] : %s" % apk_decompile_tmp_dir)
+        shutil.copytree(apk_decompile_out_dir, apk_decompile_tmp_dir)
+
+        HttpUtils.notify_cut_state(gcp_code, "30", "正在合并资源")
+        #        compileResources(apk_decompile_tmp_dir, tmp_dir, package_name)
+
+        if package_name != "" and package_name != None:
+            printlog("modifyPkgName %s" % package_name)
+            modifyPkgName(apk_decompile_tmp_dir, package_name)
+        pass
+
+        # 合并Manifest文件
+        mergeManifest(sdk_root_dir + DIR_SPLIT + sdk_name + DIR_SPLIT + sdk_name + "_sdk_config.xml",
+                      apk_decompile_tmp_dir)
+        # 合并资源
+        mergeResources(sdk_root_dir + DIR_SPLIT + sdk_name + DIR_SPLIT + sdk_name, apk_decompile_tmp_dir)
+
+        # 生成R文件
+
+        #       Aapt_Util.createRFile(apk_decompile_tmp_dir,True, package_name)
+
+        # 替换YyrhParam中的gcp_code
+        printlog(apk_decompile_tmp_dir + DIR_SPLIT + "assets" + DIR_SPLIT + "YyrhParam.cnf")
+        Replace.replaceAssets_Param(apk_decompile_tmp_dir + DIR_SPLIT + "assets" + DIR_SPLIT + "YyrhParam.cnf",
+                                    "GCP_CODE", gcp_code)
+        # 替换Androidmanifest.xml中的yyrh_gameChannelID为gcp_code   yyrh_game_channel_id
+
+        Replace.replaceAM_Meta_data(apk_decompile_tmp_dir + DIR_SPLIT + "AndroidManifest.xml", "yyrh_gameChannelID",
+                                    gcp_code)
+        # 修改debuggable为false
+        # Replace.replaceAM_Debuggable("%s/AndroidManifest.xml"%apk_decompile_out_dir)
+        # 替换Icon
+        HttpUtils.notify_cut_state(gcp_code, "40", "正在修改资源")
+        # 替换Icon
+        printlog("----- begin  replace resource -----")
+
+        if icon_path:
+            ret = Icon_Util.replaceIcon(icon_path, apk_decompile_tmp_dir)
+            if not ret:
+                errorMsg = "找不到icon,请检查"
+                printlog(errorMsg)
+                HttpUtils.notify_cut_state(gcp_code, "99", errorMsg)
+
+        # 替换启动页
+        splash_path = Json_Util.ReadJson(config_json_path, "splash")
+        if splash_path:
+            if os.path.exists(splash_path):
+                shutil.copy(splash_path, "%s/assets/yyrh_start_image.jpg" % apk_decompile_tmp_dir)
+            else:
+                errorMsg = "找不到闪屏文件,请检查"
+
+                printlog(errorMsg)
+                HttpUtils.notify_cut_state(gcp_code, "99", errorMsg)
+                return
+
+        ###########       #sdk 关键字
+        HttpUtils.notify_cut_state(gcp_code, "50", "正在替换渠道参数")
+        sdkParam = Json_Util.ReadJson(config_json_path, "sdk_client_config")
+        printlog(str(sdkParam))
+        # 替换Androidmanifest.xml中的 package_name值为包名
+        Replace.replaceAM_package_name(apk_decompile_tmp_dir + DIR_SPLIT + "AndroidManifest.xml")
+        if len(sdkParam):
+            keys = Json_Util.getJsonKeys(sdkParam)
+            for key in keys:
+                # 替换AndroidManifest.xml中的meta-data字段
+                Replace.replaceAM_Meta_data(apk_decompile_tmp_dir + DIR_SPLIT + "AndroidManifest.xml", key,
+                                            sdkParam[key])
+                # 替换assets/YyrhParam.cnf中的关键字
+                Replace.replaceAssets_Param(apk_decompile_tmp_dir + DIR_SPLIT + "assets" + DIR_SPLIT + "YyrhParam.cnf",
+                                            key, sdkParam[key])
+
+                # 特殊渠道需要特殊处理
+                Replace.special_replace(sdk_name, apk_decompile_tmp_dir, DIR_SPLIT, key, sdkParam[key])
+
+                pass
+            pass
+        ##########       #game 关键字
+        gameParam = Json_Util.ReadJson(config_json_path, "meta_config")
+        printlog("meta_config:%s" % gameParam)
+        if len(gameParam):
+            keys = Json_Util.getJsonKeys(gameParam)
+            for key in keys:
+                if key == "APP_NAME":
+                    Replace.replaceString_Appname(apk_decompile_tmp_dir, key, gameParam[key])
+                elif (key == "version"):
+                    version = gameParam[key]
+                elif (key == "v_code"):
+                    vCode = gameParam[key]
+                elif (key == "targetSdkVersion"):
+
+                    targetSdkVersion = gameParam[key]
+                # 替换方向
+                elif (key == "SDK_ORIENTATION"):
+                    replaceOrientation = '/bin/sed -i "1,\\$s/sdk_orientation/%s/g" %s/AndroidManifest.xml' % (
+                        gameParam[key], apk_decompile_tmp_dir)
+                    printlog("replaceOrientationCmd: %s" % replaceOrientation)
+                    os.system(replaceOrientation)
+                    Replace.replaceAssets_Param(
+                        apk_decompile_tmp_dir + DIR_SPLIT + "assets" + DIR_SPLIT + "YyrhParam.cnf", "SDK_ORIENTATION",
+                        gameParam[key])
+        pass
+
+        # 修改版本号
+        HttpUtils.notify_cut_state(gcp_code, "60", "正在修改版本号")
+        yml = "%s/apktool.yml" % apk_decompile_tmp_dir
+        if version != None and version != "":
+            Replace.replaceAM_VersionName(yml, version)
+        if vCode != None and vCode != "":
+            ret = CommonUtils.isMatchRegExp(vCode, "0123456789")
+            if ret == False:
+                errorMsg = "游戏版本号,需为纯数字"
+                printlog(errorMsg)
+
+                HttpUtils.notify_cut_state(gcp_code, "99", errorMsg)
+                return
+            Replace.replaceAM_VersionCode(yml, vCode)
+        if targetSdkVersion != None and targetSdkVersion != "":
+            ret = CommonUtils.isMatchRegExp(targetSdkVersion, "0123456789")
+            if ret == False:
+                errorMsg = "游戏targetSdkVersion,需为纯数字"
+                printlog(errorMsg)
+
+                HttpUtils.notify_cut_state(gcp_code, "99", errorMsg)
+                return
+            Replace.replaceYml_targetSdkVersion(yml, targetSdkVersion)
+
+        Replace.replaceYml_minSdkVersion(yml)
+        mergeWXPay(sdk_root_dir + DIR_SPLIT + sdk_name + DIR_SPLIT + sdk_name, apk_decompile_tmp_dir)
+
+        HttpUtils.notify_cut_state(gcp_code, "70", "正在替换游戏资源")
+        # 替换游戏资源
+        resourcepaths = Json_Util.ReadJson(config_json_path, "game_resource_replace")
+        printlog(("游戏替换资源预路径:%s" % resourcepaths))
+        if resourcepaths != None and resourcepaths != "":
+            for resourcepath in resourcepaths:
+                path = resourcepath[1]
+                if not os.path.exists(path) and path != "":
+                    errorMsg = "游戏资源不存在:%s" % path
+                    printlog(errorMsg)
+                    HttpUtils.notify_cut_state(gcp_code, "99", errorMsg)
+                    return
+            Replace_GameRes_Utils.ReplaceGameResource(apk_decompile_tmp_dir, resourcepaths)
+
+        dst_dir = "%s%s" % (apk_utils.getOutPutDir(), DIR_SPLIT)
+        channels = Json_Util.ReadJson(config_json_path, "channels")
+        Replace.replaceAM_Meta_data("%s/AndroidManifest.xml" % apk_decompile_tmp_dir, Contants.getSdkChannelid(),
+                                    channels)
+        outputApkPath = "%s_unsigned.apk" % apk_decompile_tmp_dir
+        signedApkPath = "%s_signed.apk" % apk_decompile_tmp_dir
+        zipalignApkPath = "%s_zipaligned.apk" % apk_decompile_tmp_dir
+
+        # 再编译
+        HttpUtils.notify_cut_state(gcp_code, "80", "正在回编译APK")
+
+        recompile(apk_decompile_tmp_dir, outputApkPath)
+
+        HttpUtils.notify_cut_state(gcp_code, "90", "正在重签名,对齐APK")
+        # 重签名
+        resignApk(outputApkPath, keystorepath, storepass, alias, keypass, signedApkPath)
+        # 对齐
+        zipalignApk(signedApkPath, zipalignApkPath)
+        apkDstPath = "%sg%s_%s_%s_%s.apk" % (dst_dir, g_id, sdk_name, package_name, gcp_code)
+        apkDstDir = os.path.dirname(apkDstPath)
+        if not os.path.exists(apkDstDir):
+            os.makedirs(apkDstDir)
+        shutil.copyfile(zipalignApkPath, apkDstPath)
+
+        HttpUtils.notify_cut_state(gcp_code, "100", "切包成功(点击复制链接)")
+        time_end = time.time()
+        time_c = time_end - time_start
+        printlog("APK路径:%s" % apkDstPath)
+
+        printlog("切包总用时:%s秒" % time_c)
+
+    except Exception as err:
+        printlog(errorMsg)
+        HttpUtils.notify_cut_state(gcp_code, "99", errorMsg)
+        isSuccess = False
+        printlog("cut error occur:%s" % err)
+        printlog(traceback.format_exc())
+    finally:
+        printlog("clear temp dir")
+        # 删除中间生成的目录和文件
+        if apk_decompile_tmp_dir:
+            File.safeFileDelete(os.path.dirname(apk_decompile_tmp_dir))
+
+    return isSuccess
+
+
+if __name__ == "__main__":
+    ret, msg = mergeYml("sdk.yml", "/Volumes/forsdk/sdk/develop/921sdk_cut/script/P0000005/apktool.yml")
+    if not ret:
+        print(msg)
+# 
+# eg. python merge_apk_v2.py config.json
+#

+ 0 - 0
README.md → V2/README.md


+ 0 - 0
apk_tool.py → V2/apk_tool.py


+ 0 - 0
channel/huawei/assets/agconnect-services.json → V2/channel/huawei/assets/agconnect-services.json


+ 0 - 0
channel/huawei/assets/grs_sdk_global_route_config_apptouchupdatesdk.json → V2/channel/huawei/assets/grs_sdk_global_route_config_apptouchupdatesdk.json


+ 0 - 0
channel/huawei/assets/grs_sdk_global_route_config_opendevicesdk.json → V2/channel/huawei/assets/grs_sdk_global_route_config_opendevicesdk.json


+ 0 - 0
channel/huawei/assets/grs_sdk_global_route_config_opensdkService.json → V2/channel/huawei/assets/grs_sdk_global_route_config_opensdkService.json


+ 0 - 0
channel/huawei/assets/grs_sdk_global_route_config_updatesdk.json → V2/channel/huawei/assets/grs_sdk_global_route_config_updatesdk.json


+ 0 - 0
channel/huawei/assets/grs_sdk_server_config.json → V2/channel/huawei/assets/grs_sdk_server_config.json


+ 0 - 0
channel/huawei/assets/grs_sp.bks → V2/channel/huawei/assets/grs_sp.bks


+ 0 - 0
channel/huawei/assets/hmsincas.bks → V2/channel/huawei/assets/hmsincas.bks


+ 0 - 0
channel/huawei/assets/hmsrootcas.bks → V2/channel/huawei/assets/hmsrootcas.bks


+ 0 - 0
channel/huawei/assets/updatesdkcas.bks → V2/channel/huawei/assets/updatesdkcas.bks


+ 0 - 0
channel/huawei/assets/yyxx_game/yyxx_cfg.properties → V2/channel/huawei/assets/yyxx_game/yyxx_cfg.properties


+ 0 - 0
channel/huawei/huawei_sdk_config.xml → V2/channel/huawei/huawei_sdk_config.xml


+ 0 - 0
channel/huawei/res/drawable-hdpi-1208x720-v4/c_buoycircle_icon_normal.png → V2/channel/huawei/res/drawable-hdpi-1208x720-v4/c_buoycircle_icon_normal.png


+ 0 - 0
channel/huawei/res/drawable-hdpi-v4/c_buoycircle_hide_float_eye_off_gray.png → V2/channel/huawei/res/drawable-hdpi-v4/c_buoycircle_hide_float_eye_off_gray.png


+ 0 - 0
channel/huawei/res/drawable-hdpi-v4/c_buoycircle_icon.png → V2/channel/huawei/res/drawable-hdpi-v4/c_buoycircle_icon.png


+ 0 - 0
channel/huawei/res/drawable-hdpi-v4/c_buoycircle_icon_normal.png → V2/channel/huawei/res/drawable-hdpi-v4/c_buoycircle_icon_normal.png


+ 0 - 0
channel/huawei/res/drawable-hdpi-v4/c_buoycircle_red_dot.png → V2/channel/huawei/res/drawable-hdpi-v4/c_buoycircle_red_dot.png


+ 0 - 0
channel/huawei/res/drawable-hdpi-v4/hms_game_achievement_finish.png → V2/channel/huawei/res/drawable-hdpi-v4/hms_game_achievement_finish.png


+ 0 - 0
channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_hide_float_eye_off_gray.png → V2/channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_hide_float_eye_off_gray.png


+ 0 - 0
channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_icon.png → V2/channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_icon.png


+ 0 - 0
channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_icon_normal.png → V2/channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_icon_normal.png


+ 0 - 0
channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_red_dot.png → V2/channel/huawei/res/drawable-xhdpi-v4/c_buoycircle_red_dot.png


+ 0 - 0
channel/huawei/res/drawable-xhdpi-v4/hms_game_achievement_finish.png → V2/channel/huawei/res/drawable-xhdpi-v4/hms_game_achievement_finish.png


+ 0 - 0
channel/huawei/res/drawable-xhdpi-v4/upsdk_cancel_normal.png → V2/channel/huawei/res/drawable-xhdpi-v4/upsdk_cancel_normal.png


+ 0 - 0
channel/huawei/res/drawable-xhdpi-v4/upsdk_cancel_pressed_bg.png → V2/channel/huawei/res/drawable-xhdpi-v4/upsdk_cancel_pressed_bg.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_hide_float_eye_off_gray.png → V2/channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_hide_float_eye_off_gray.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_icon.png → V2/channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_icon.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_icon_normal.png → V2/channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_icon_normal.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_red_dot.png → V2/channel/huawei/res/drawable-xxhdpi-v4/c_buoycircle_red_dot.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/hms_game_achievement_finish.png → V2/channel/huawei/res/drawable-xxhdpi-v4/hms_game_achievement_finish.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_normal.png → V2/channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_normal.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_round_black.png → V2/channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_round_black.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_round_normal.png → V2/channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_round_normal.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_round_white.png → V2/channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_round_white.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_white.png → V2/channel/huawei/res/drawable-xxhdpi-v4/hwid_auth_button_white.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/upsdk_cancel_normal.png → V2/channel/huawei/res/drawable-xxhdpi-v4/upsdk_cancel_normal.png


+ 0 - 0
channel/huawei/res/drawable-xxhdpi-v4/upsdk_cancel_pressed_bg.png → V2/channel/huawei/res/drawable-xxhdpi-v4/upsdk_cancel_pressed_bg.png


+ 0 - 0
channel/huawei/res/drawable-xxxhdpi-v4/c_buoycircle_hide_float_eye_off_gray.png → V2/channel/huawei/res/drawable-xxxhdpi-v4/c_buoycircle_hide_float_eye_off_gray.png


+ 0 - 0
channel/huawei/res/drawable-xxxhdpi-v4/c_buoycircle_icon_normal.png → V2/channel/huawei/res/drawable-xxxhdpi-v4/c_buoycircle_icon_normal.png


+ 0 - 0
channel/huawei/res/drawable-xxxhdpi-v4/c_buoycircle_red_dot.png → V2/channel/huawei/res/drawable-xxxhdpi-v4/c_buoycircle_red_dot.png


+ 0 - 0
channel/huawei/res/drawable-xxxhdpi-v4/hms_game_achievement_finish.png → V2/channel/huawei/res/drawable-xxxhdpi-v4/hms_game_achievement_finish.png


+ 0 - 0
channel/huawei/res/drawable-xxxhdpi-v4/upsdk_cancel_normal.png → V2/channel/huawei/res/drawable-xxxhdpi-v4/upsdk_cancel_normal.png


+ 0 - 0
channel/huawei/res/drawable-xxxhdpi-v4/upsdk_cancel_pressed_bg.png → V2/channel/huawei/res/drawable-xxxhdpi-v4/upsdk_cancel_pressed_bg.png


+ 0 - 0
channel/huawei/res/drawable/c_buoycircle_hide_float_top.9.png → V2/channel/huawei/res/drawable/c_buoycircle_hide_float_top.9.png


+ 0 - 0
channel/huawei/res/drawable/c_buoycircle_hide_guide.gif → V2/channel/huawei/res/drawable/c_buoycircle_hide_guide.gif


+ 0 - 0
channel/huawei/res/drawable/c_buoycircle_hide_shape.xml → V2/channel/huawei/res/drawable/c_buoycircle_hide_shape.xml


+ 0 - 0
channel/huawei/res/drawable/c_buoycircle_hide_shape_red.xml → V2/channel/huawei/res/drawable/c_buoycircle_hide_shape_red.xml


+ 0 - 0
channel/huawei/res/drawable/hms_game_achievement_bg_shape.xml → V2/channel/huawei/res/drawable/hms_game_achievement_bg_shape.xml


+ 0 - 0
channel/huawei/res/drawable/upsdk_cancel_bg.xml → V2/channel/huawei/res/drawable/upsdk_cancel_bg.xml


+ 0 - 0
channel/huawei/res/drawable/upsdk_third_download_bg.xml → V2/channel/huawei/res/drawable/upsdk_third_download_bg.xml


+ 0 - 0
channel/huawei/res/layout-land/c_buoycircle_hide_guide_dialog.xml → V2/channel/huawei/res/layout-land/c_buoycircle_hide_guide_dialog.xml


+ 0 - 0
channel/huawei/res/layout/activity_endisable_service.xml → V2/channel/huawei/res/layout/activity_endisable_service.xml


+ 0 - 0
channel/huawei/res/layout/c_buoycircle_hide_guide_dialog.xml → V2/channel/huawei/res/layout/c_buoycircle_hide_guide_dialog.xml


+ 0 - 0
channel/huawei/res/layout/c_buoycircle_hide_notice.xml → V2/channel/huawei/res/layout/c_buoycircle_hide_notice.xml


+ 0 - 0
channel/huawei/res/layout/c_buoycircle_window_small.xml → V2/channel/huawei/res/layout/c_buoycircle_window_small.xml


+ 0 - 0
channel/huawei/res/layout/hms_game_achievement_finish.xml → V2/channel/huawei/res/layout/hms_game_achievement_finish.xml


+ 0 - 0
channel/huawei/res/layout/hms_game_top_async_login.xml → V2/channel/huawei/res/layout/hms_game_top_async_login.xml


+ 0 - 0
channel/huawei/res/layout/upsdk_app_dl_progress_dialog.xml → V2/channel/huawei/res/layout/upsdk_app_dl_progress_dialog.xml


+ 0 - 0
channel/huawei/res/layout/upsdk_ota_update_view.xml → V2/channel/huawei/res/layout/upsdk_ota_update_view.xml


+ 0 - 0
channel/huawei/res/values-am/values-am.xml → V2/channel/huawei/res/values-am/values-am.xml


+ 0 - 0
channel/huawei/res/values-ar/values-ar.xml → V2/channel/huawei/res/values-ar/values-ar.xml


+ 0 - 0
channel/huawei/res/values-as/values-as.xml → V2/channel/huawei/res/values-as/values-as.xml


+ 0 - 0
channel/huawei/res/values-az/values-az.xml → V2/channel/huawei/res/values-az/values-az.xml


+ 0 - 0
channel/huawei/res/values-b+jv+Latn/values-b+jv+Latn.xml → V2/channel/huawei/res/values-b+jv+Latn/values-b+jv+Latn.xml


+ 0 - 0
channel/huawei/res/values-b+my+Qaag/values-b+my+Qaag.xml → V2/channel/huawei/res/values-b+my+Qaag/values-b+my+Qaag.xml


+ 0 - 0
channel/huawei/res/values-b+sr+Latn/values-b+sr+Latn.xml → V2/channel/huawei/res/values-b+sr+Latn/values-b+sr+Latn.xml


+ 0 - 0
channel/huawei/res/values-be/values-be.xml → V2/channel/huawei/res/values-be/values-be.xml


+ 0 - 0
channel/huawei/res/values-bg/values-bg.xml → V2/channel/huawei/res/values-bg/values-bg.xml


+ 0 - 0
channel/huawei/res/values-bn/values-bn.xml → V2/channel/huawei/res/values-bn/values-bn.xml


+ 0 - 0
channel/huawei/res/values-bo-rCN/values-bo-rCN.xml → V2/channel/huawei/res/values-bo-rCN/values-bo-rCN.xml


+ 0 - 0
channel/huawei/res/values-bs/values-bs.xml → V2/channel/huawei/res/values-bs/values-bs.xml


+ 0 - 0
channel/huawei/res/values-ca/values-ca.xml → V2/channel/huawei/res/values-ca/values-ca.xml


+ 0 - 0
channel/huawei/res/values-cs/values-cs.xml → V2/channel/huawei/res/values-cs/values-cs.xml


+ 0 - 0
channel/huawei/res/values-da/values-da.xml → V2/channel/huawei/res/values-da/values-da.xml


+ 0 - 0
channel/huawei/res/values-de/values-de.xml → V2/channel/huawei/res/values-de/values-de.xml


+ 0 - 0
channel/huawei/res/values-el/values-el.xml → V2/channel/huawei/res/values-el/values-el.xml


+ 0 - 0
channel/huawei/res/values-en-rAU/values-en-rAU.xml → V2/channel/huawei/res/values-en-rAU/values-en-rAU.xml


+ 0 - 0
channel/huawei/res/values-en-rGB/values-en-rGB.xml → V2/channel/huawei/res/values-en-rGB/values-en-rGB.xml


+ 0 - 0
channel/huawei/res/values-es-rUS/values-es-rUS.xml → V2/channel/huawei/res/values-es-rUS/values-es-rUS.xml


+ 0 - 0
channel/huawei/res/values-es/values-es.xml → V2/channel/huawei/res/values-es/values-es.xml


+ 0 - 0
channel/huawei/res/values-et/values-et.xml → V2/channel/huawei/res/values-et/values-et.xml


+ 0 - 0
channel/huawei/res/values-eu/values-eu.xml → V2/channel/huawei/res/values-eu/values-eu.xml


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác