Coder Social home page Coder Social logo

aceso's Introduction

Aceso

Aceso is a Android HotFix by optimizing the AOSP's "InstantRun HotSwap" solution, it is used to fix online bugs without a new APK publish.

wiki

中文说明

Features

  • Support 4.x to 7.0 Android OS
  • Perfect compatibility
  • Taking effect immediately after download without reboot
  • Support fixing at method level
  • Support adding new classes

Limitations

  • Current not support fixing static code block and constructors.
  • Functions that shrinked/inlined by proguard are NOT repariable.
  • Only the Method's body can be fixed.

Usage

1.Add below codes in the outest project's build.gradle file

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
         classpath 'com.mogujie.aceso:aceso-build:0.0.2'
    }
}

2.Add below codes in the module's build.gradle

apply plugin: 'Aceso'

dependencies {
    compile 'com.mogujie.aceso:aceso-android-lib:0.0.1'
}

Add below codes once you need aceso for Debug version.

Aceso {
    instrumentDebug = false
}

3.Add below codes at the place after HotFix downloaded and Application's onAttachedBaseContext() or onCreate()

 new Aceso().installPatch(optDir, patchFile);

4.Pls. reserve the file folder "build/intermediates/aceso" under module directory at each HotFix publishment.

Generate Patch

1.An additional Fix project is needed(pls. refer to aceso-demo-fix)

2.Pls. add below codes in the outest prject's build.gradle:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
         classpath 'com.mogujie.aceso:aceso-build:0.0.2'
    }
}

3.Pls. add below codes in the module's build.gradle:

apply plugin: 'AcesoFix'

Aceso {
    // The HotFix is for method level once methodLevelFix set to true, i.e., only fix the designated method, the annotation @FixMtd should be added above the method to be fixed. Once set to false, the HotFix is for class level. 
    methodLevelFix = true
    // Below files are those aceso file folders whch mentioned in 4th step of Usage, pls. refer to the file usage in the wiki.
    instrumentJar =The path of instrument.jar which generated in host project’
    allClassesJar =The path of all-classes.jar which generated in host project’
    acesoMapping =The path of aceso-mapping.txt which generated in host project’
}

4.Pls copy the class to be fixed to Fix project, and reserve the package name, e.g., the class to be fixed named com.mogujie.aceso.demo.MainActivity, the MainActivity in fix project should reserve the package name as com.mogujie.aceso.demo.MainActivity.

5.Fix you bug in Fix project.

6.Pls. add @FixMtd above the method to be fixed once methodLevelFix is set.

7.Execute command gradle acesoRelease(or acesoDebug) to generate the patch package, the patch would be generated under directory build/outputs/apk

8.Deploy the patch to the target phones.

Demo

1.Compile and install aceso-demo, press the test button, the 'not fix' would be displayed

2.Execute command gradle acesoRelease(or acesoDebug) in project 'aceso-demo-fix'

3.Use adb push command to push the apk generated to path '/sdcard/fix.apk'

4.Press fix button on the phone

5.Press test button, the 'has been fixed' would be displayed!

Thanks

License

Aceso is under the Apache 2.0 license.

aceso's People

Contributors

farmerjohngit avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.