¶«ÆÂÏÂÔØ£ºÄÚÈÝ×î·á¸»×ȫµÄÏÂÔØÕ¾£¡

°ïÖú|ÎļþÀàÐÍ¿â|×îиüÐÂ|ÏÂÔØ·ÖÀà|ÅÅÐаñ

±à³ÌÏà¹ØÆƽâÏà¹Ø±à³Ì¹¤¾ß·´±àÒë°²×°ÖÆ×÷³ÌÐòÔ´ÂëÈí¼þ²¹¶¡Êý¾Ý¿âVisual Studiovc++visualbasicdreamweaver

Ê×Ò³ ¡ú ±à³Ì¿ª·¢ ¡ú ±à³Ì¹¤¾ß ¡ú SDKHotfix(SDK ÈÈÐÞ¸´¹¤¾ß°ü) 1.3 ×îÐÂÃâ·Ñ°æ

SDKHotfix(SDK ÈÈÐÞ¸´¹¤¾ß°ü)

SDKHotfix(SDK ÈÈÐÞ¸´¹¤¾ß°ü)1.3 ×îÐÂÃâ·Ñ°æ

  • ´óС£º11.1M
  • ÓïÑÔ£ºÖÐÎÄ
  • ƽ̨£ºWinAll
  • ¸üУº2019-11-06 19:1
  • µÈ¼¶£º
  • ÀàÐÍ£º±à³Ì¹¤¾ß
  • ÍøÕ¾£ºÔÝÎÞ
  • ÊÚȨ£ºÃâ·ÑÈí¼þ
  • ³§ÉÌ£º
  • ²úµØ£º¹ú²úÈí¼þ
ºÃÓúÃÍæ 50%(0)
¿Óµù ¿Óµù 50%(0)
Èí¼þ½éÉÜÈí¼þ½ØͼÏà¹ØÈí¼þÈí¼þ½Ì³ÌÍøÓÑÆÀÂÛÏÂÔصØÖ·

Ïà¹ØÍƼö: SDKHotfix

    SDKHotfix(SDK ÈÈÐÞ¸´¹¤¾ß°ü)ÊÇÒ»¿îÈà SDK ¿ª·¢ÕßÄÜ¿ìËÙ¸³Óè SDK ÈÈÐÞ¸´µÄÄÜÁ¦.

    SDKHotfix(SDK ÈÈÐÞ¸´¹¤¾ß°ü)Ìصã

    5 ·ÖÖÓ¼´¿ÉÈÃÄãµÄ SDK ÓµÓÐÈÈÐÞ¸´µÄÄÜÁ¦

    ½ÚÊ¡²È¿ÓºÍ¿ª·¢³É±¾

    hook and create Gradle Task

    Kotlin + groovy

    ÈÈÐÞ¸´

    ·Ç¶Ô³Æ¼ÓÃÜ+¶Ô³Æ¼ÓÃÜ

    À©Õ¹ÃÀÍÅ Robust ¿ªÔ´¿â£¬Ê¹Æä¾ßÓÐÆäËûÈȸü¿â²»¾ß±¸µÄ²¹¶¡»Ø¹ö¹¦ÄÜ

    Êý¾ÝºÍ¼à¿Ø˼ά

    Óŵã

    ÎÞ¼æÈÝÎÊÌâ

    ʵʱÉúЧ

    ÐÞ¸´³É¹¦Âʸߴï99.9%

    ÔÚÓû§¹æģǧÍò¼¶±ðµÄappÖÐÑéÖ¤¹ý£¬¿ÉÐÅÀµ

    Ö§³Ö²¹¶¡Òì³£×Ô¶¯Ê§Ð§£¬²»ÓÃÔÙµ£ÐIJ¹¶¡Ôì³ÉcrashÀ²~

    ´ý¸Ä½ø

    ÔÚ±àÒë½×¶Î²å¼þÇÖÈëÁ˲úÆ·´úÂ룬¶ÔÔËÐÐЧÂÊ¡¢·½·¨Êý¡¢°üÌå»ý»¹ÊDzúÉúÁËһЩ¸±×÷Óᣣ¨¿ÉÖ¸¶¨Ä³Ð©classÎÞÐè²åÈë·½·¨£¬¼õÉÙ²å×®Êý£©

    soºÍ×ÊÔ´µÄÌ滻ĿǰÔÝδʵÏÖ

    ¶ÔÓÚÖ»ÓÐ×ֶηÃÎʵĺ¯ÊýÎÞ·¨Ö±½ÓÐÞ¸´£¬¿Éͨ¹ýµ÷Óô¦¼ä½ÓÐÞ¸´

    ÉÏ´«GradleTaskÉÐδÔÚMAC»·¾³Ï²âÊÔ

    ÉÏ´«µÄ²¹¶¡Ö§³Ö°´°üÃû´æµµ

    ÒªÉÌÓõÄС»ï°éҪעÒ⣬½¨Òé»»³É×Ô¼ºµÄºó¶Ë½Ó¿Ú»ò×Ô¼ºÐø·ÑÒ»¸öbmobÓ¦Óã¬ÒòΪbmobÔƺ¯Êý·þÎñ³¬¹ý40ÌìÐèÒªÊÕ·Ñ£¬ËùÒÔ±¾ÏîÄ¿ÐèÒª¶¨ÆÚ¸üÐÂÓ¦ÓÃÃØÔ¿¡£

    ʹÓ÷½·¨

    1. Ìí¼ÓÅäÖúͿª¹Ø

    1.1 ÔÚÏîÄ¿gradle.propertiesÖÐÌí¼Ó¿ª¹ØºÍÅäÖÃ

    # ½ÓÈëµÚÒ»²½£ºÌí¼ÓÅäÖúͿª¹Ø
    # Applicationģʽ£¬RobustÐèÒªÊÇApplication²ÅÄܲåÈë´úÂëºÍ´ò²¹¶¡
    isAppModule=false
    # ApplicationģʽÏ¿ªÆôÕâ¸ö¾Í¿ÉÒÔ´ò²¹¶¡
    isPatchModule=false
    # ÄãµÄÒµÎñsdkµÄ°üÃû
    sdkPackageName=com.feelschaotic.samplesdk
    # ÊÇ·ñ¿ªÆô»ìÏý£¬Ò»°ãÇé¿öÏÂsdkĬÈϲ»»ìÏý
    isProguard=false
    # ÒµÎñsdk°æ±¾ºÅ£¬Çë±£³ÖÈý룬ÇÒÎÞºó׺£¬ÇÒÔÚ´ò°üÇ°¾ÍҪȷ¶¨ºÃ°æ±¾£¬È·±£°æ±¾´òÔÚ°üÖÐ
    SDK_VERSION=0.0.1
    # ÒµÎñsdkµÄupload_artifact_id
    SDK_ARTIFACT_ID=MY-SAMPLES-SDK

    1.2 ÔÚ sdk build.gradle ÖмÓÈëÅäÖà Ìæ»»Ô­ÓеĠapply plugin: 'com.android.library'

    //×¢Ò⣡£¡Ò»¶¨Òª·ÅÔÚÎļþ×îÇ°Ãæ
    // apply plugin±íʾ¸ÃÏîÄ¿»áʹÓÃÖ¸¶¨µÄ²å¼þ,sdk¶ÔÓ¦µÄÊÇcom.android.library
    if (isAppModule.toBoolean()) {
       apply plugin: 'com.android.application'
       if (isPatchModule.toBoolean()) {
           //ÖÆ×÷²¹¶¡Ê±½«Õâ¸ö´ò¿ª£¬auto-patch-plugin½ô¸ú×Åcom.android.application
           apply plugin: 'auto-patch-plugin'
       }
       apply plugin: 'robust'
    } else {
       apply plugin: 'com.android.library'
    }

    apply from: rootProject.getRootDir().getAbsolutePath() + "/packPlugin.gradle"

    1.3 ¼ÓÈë buildConfigField

    // ÊÓÇé¿ö¶ø¶¨£¬Èç¹ûÄãÔÚ³õʼ»¯ÈȸüsdkʱµÄ´«ÈëµÄ°æ±¾ºÅÓÐÁíÍâµÄÈ¡Öµ·½Ê½£¬Ò²¿ÉÒÔ²»¼Ó´ËbuildConfig
    android {
    defaultConfig {
      buildConfigField "String", "SDK_VERSION", "\"${SDK_VERSION}\""
      buildConfigField "String", "SDK_ARTIFACT_ID", "\"${SDK_ARTIFACT_ID}\""
    }
    }

    1.4 ÔÚ sdk build.gradle ÖÐÅäÖÃÇ©Ãû

    android {
      // Ç©ÃûµÄÅäÖÃ
       signingConfigs {
           debug {

           }
           // release°æ±¾µÄÇ©Ãû
           release {
               // Ç©ÃûµÄһЩÐÅÏ¢
               keyAlias 'key0'
               keyPassword '123456'
               storeFile file('./hotfix.jks')
               storePassword '123456'
           }
       }
    }

    1.5 ÅäÖûìÏý

    ¸´ÖÆÕ³ÌùÅäÖõ½ sdk build.gradle

    android {
      buildTypes {
           innerTest {
               //...
               matchingFallbacks = ['debug', 'release']
           }
           release {
               signingConfig signingConfigs.release
               minifyEnabled isProguard.toBoolean()//´Ë´¦È¡µÄisProguard¾ÍÊÇ1.1ÔÚÏîÄ¿`gradle.properties`ÖÐÌí¼ÓµÄisProguard¿ª¹Ø
               proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
           }
       }

        sourceSets {
              main {
                  // ApplicationºÍLibraryÇåµ¥Îļþ´¦Àí·½Ê½²»Í¬
                  if (isAppModule.toBoolean()) {
                      manifest.srcFile 'src/main/debug/AndroidManifest.xml'
                  } else {
                      manifest.srcFile 'src/main/release/AndroidManifest.xml'
                  }
              }
          }
    }

    ¸´ÖÆÕ³ÌùʾÀýsdkµÄlib-proguard-rules.proµ½ÒµÎñSDK moduleĿ¼Ï£¬ÐÞ¸ÄÎļþÖеİüÃû

    ½Ó×ÅÅäÖúÃsdk×Ô¼ºµÄ»ìÏý¹æÔò

    android {
       defaultConfig {
           consumerProguardFiles 'lib-proguard-rules.pro'
       }
    }

    2. µ¼¿â

    ÔÚ sdk µÄ build.gradle ÖÐÒýÈë¿â

    implementation 'com.github.feelschaotic:SDKHotFix:XX-RELEASE'

    XXΪ×îÐÂSDK°æ±¾ºÅ£¬ÀýÈçimplementation 'com.github.feelschaotic:SDKHotFix:1.3-RELEASE'

    ×¢£º×îа汾¼ûREADME±êÖ¾ 

    ÔÚ¸ùÏîÄ¿build.gradleÖмÓÈëmavenÅäÖÃ

    repositories {
       //½ÓÈëµÚ¶þ²½:Ôö¼ÓmavenÅäÖÃ
       maven { url "https://mvnrepository.com/" }
    }
    ...
    allprojects {
       repositories {
           maven { url "https://mvnrepository.com/" }
       }
    }

    ÔÙÌí¼ÓclasspathÅäÖÃ

    // ApplicationģʽÏÂÒýÈëRobust½Å±¾²å¼þ
      if (isAppModule.toBoolean()) {
           classpath 'com.github.feelschaotic:Robust.gradle-plugin:0.4.87.5-RELEASE'
           classpath 'com.github.feelschaotic:Robust.auto-patch-plugin:0.4.87.5-RELEASE'
      }

    4. ¸´ÖÆʾÀýÏîÄ¿µÄ½Å±¾ºÍÎļþ

    4.1 ¸´ÖÆ MainActivity.java µ½ sdk module µÄ java\°üÃû Ŀ¼Ï£¨Ä¿µÄÊÇΪÁËapplication´ò°üÅäÖò»±¨´í£©

    4.2 ¸´ÖÆ debug ºÍ release 2 ¸öÎļþ¼Ðµ½ main Ŀ¼Ï£¬ÐÞ¸ÄÀïÃæµÄ AndroidManifest.xml£¬¸ü¸ÄΪÄã×Ô¼ºÒµÎñSDKµÄ°üÃû

    <manifest package="${packageName}"
             xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:tools="http://schemas.android.com/tools">

    4.3 ¸´ÖÆ robust.xml µ½sdk module ¸ùĿ¼£¬¸ü¸ÄÏ°üÃû

    4.4 ¸´ÖÆ packPlugin.gradle µ½ÏîÄ¿µÄ¸ùĿ¼

    5. ³õʼ»¯Èȸü¿â

    val config: HotfixConfig = HotfixConfig.Builder().debug(true)
                   .appVersion(BuildConfig.VERSION_NAME)
                   .packageName(BuildConfig.APPLICATION_ID)
                   .build()
           HotfixManager.init(application, config)

    6. Ìí¼ÓȨÏÞ

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

    7. ¼ÓÈë»ìÏý

    -keep class com.alibaba.sdk.android.oss.** { *; }
    -dontwarn okio.**
    -dontwarn org.apache.commons.codec.binary.**

    PC¹Ù·½°æ
    °²×¿¹Ù·½ÊÖ»ú°æ
    IOS¹Ù·½ÊÖ»ú°æ

    SDKHotfix(SDK ÈÈÐÞ¸´¹¤¾ß°ü)½Øͼ

    ÏÂÔصØÖ·

    SDKHotfix(SDK ÈÈÐÞ¸´¹¤¾ß°ü) 1.3 ×îÐÂÃâ·Ñ°æ

    ÈÈÃÅÆÀÂÛ
    ×îÐÂÆÀÂÛ
    µÚ 4 Â¥ ËÄ´¨³É¶¼ÌúͨADSL ÍøÓÑ ½ªÆܳ٠·¢±íÓÚ: 2019/11/23 3:29:04
    àÛàÛàÛ Îªbts¸øÂú·ÖËæÊÖËÑbts¾ÓÈ»»¹ÓÐÓÎÏ· kkkk

    Ö§³Ö( 0 ) ¸ÇÂ¥(»Ø¸´)

    µÚ 3 Â¥ CZ88.NETÿ ÍøÓÑ È¡¸öÃû×Ö»¹ÕæÄÑ ·¢±íÓÚ: 2019/11/21 19:06:33
    ¾ÍÊÇ·þ×°»¹ÓÐÍ··¢ÓеãÉÙ£¬ÆäËüµÄ¶¼»¹²»´í

    Ö§³Ö( 0 ) ¸ÇÂ¥(»Ø¸´)

    µÚ 2 Â¥ ÉÂÎ÷ÑîÁèÖйúË®ÍÁ±£»¤Ñ§Ôº ÍøÓÑ ÃÈßÕßÕµÄŮƱ ·¢±íÓÚ: 2019/11/16 23:20:40
    ÄÚÈÝÓеãÉÙ£¬²»ÊÇÒ²ÊÇ¿ÉÒÔ£¡

    Ö§³Ö( 0 ) ¸ÇÂ¥(»Ø¸´)

    µÚ 1 Â¥ ÃÀ¹úCZ88.NET ÍøÓÑ 424800m ·¢±íÓÚ: 2019/11/10 21:59:03
    È«Êǹã¸æÔÚÉÁ£¬¿´×žͶñÐÄ

    Ö§³Ö( 0 ) ¸ÇÂ¥(»Ø¸´)

    êdzÆ:
    ±íÇé: ¸ßÐË ¿É º¹ ÎÒ²»Òª º¦Ðß ºÃ ÏÂÏÂÏ ËÍ»¨ ʺ Ç×Ç×
    ×ÖÊý: 0/500 (ÄúµÄÆÀÂÛÐèÒª¾­¹ýÉóºË²ÅÄÜÏÔʾ)

    ±à¼­ÍƼö

    ±¾ÀàÈí¼þ±Ø±¸

    ±à³ÌUltraEditvc++6.0Notepad++±àÒëVBILSpyHopperÊý¾ÝMySQLoracleaccessÉè¼ÆDreamweaverfireworksFlash

    ±¨´í

    Çë¼òÒªÃèÊöÄúÓöµ½µÄ´íÎó£¬ÎÒÃǽ«¾¡¿ìÓèÒÔÐÞÕý¡£

    תÌûµ½ÂÛ̳
    ÂÖ̳תÌûHTML·½Ê½

    ÂÖ̳תÌûUBB·½Ê½