All Projects → ximsfei → Stark

ximsfei / Stark

Licence: apache-2.0
Stark is a hot-fix framework for Android. It supports swapping new implementations of classes without restarting a running Android application, and updated Android resources (icons, layout, etc) while only restarting the Android Activity. Most importantly, there is no private API invoked in Stark.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Stark

Play Services Plugins
Plugins to help with using Google Play services SDK.
Stars: ✭ 298 (-17.22%)
Mutual labels:  gradle
Country Picker Android
A simple library that displays a beautiful list of all the countries allowing the user to pick the country he wishes and provide details like country code, iso code name,currency and flag.
Stars: ✭ 317 (-11.94%)
Mutual labels:  gradle
Hexagon
Hexagon is a microservices toolkit written in Kotlin. Its purpose is to ease the building of services (Web applications, APIs or queue consumers) that run inside a cloud platform.
Stars: ✭ 336 (-6.67%)
Mutual labels:  gradle
Mmorpg
springboot编写的轻量级高性能mmorpg手游服务端框架,基本功能逐渐完善中。
Stars: ✭ 309 (-14.17%)
Mutual labels:  gradle
Gdub
A gradlew / gradle wrapper.
Stars: ✭ 312 (-13.33%)
Mutual labels:  gradle
Trampoline
Admin Spring Boot Locally
Stars: ✭ 325 (-9.72%)
Mutual labels:  gradle
The Pit Of The Android Studio
👍 👍 👏 🌟 ⭐️ ⭐️ Everything about the Android Studio and Intellij IDEAfor example:Install,common problems and solutions,each libraries for android and androidx library,code and peoject templates,etc.全面总结Android Studio以及Intellij IDEA的填坑指南,详解AS版本号、Gradle版本、BuildTools三者的对照关系,AS模板配置,gradle插件,Android自带注解库详解,support详解等干货。
Stars: ✭ 296 (-17.78%)
Mutual labels:  gradle
Gradle Android Command Plugin
Handy commands for testing Android on CI
Stars: ✭ 349 (-3.06%)
Mutual labels:  gradle
Unityandroidil2cpppatchdemo
这是Unity Android APP il2cpp热更完美解决方案的Demo。更新build_demo_apk里的Unity路径,执行即可一键重build Patch和apk。因为文件libunity是没有热更的,如unity版本有变化则热更不适用。
Stars: ✭ 312 (-13.33%)
Mutual labels:  patch
Gradle Doctor
The right prescription for your Gradle build.
Stars: ✭ 331 (-8.06%)
Mutual labels:  gradle
Fataar Gradle Plugin
Gradle plugin to help embed dependencies in generated AAR artifact
Stars: ✭ 308 (-14.44%)
Mutual labels:  gradle
App Engine
分布式App服务端快速开发框架
Stars: ✭ 313 (-13.06%)
Mutual labels:  gradle
Swagger Gradle Codegen
💫 A Gradle Plugin to generate your networking code from Swagger
Stars: ✭ 330 (-8.33%)
Mutual labels:  gradle
Minecolonies
Minecolonies minecraft mod
Stars: ✭ 303 (-15.83%)
Mutual labels:  gradle
Awesome Gradle
A curated list of awesome Gradle plugins and resources for a better development workflow automation.
Stars: ✭ 341 (-5.28%)
Mutual labels:  gradle
Emotion Rating View
A library for animated rating view in Android apps.
Stars: ✭ 299 (-16.94%)
Mutual labels:  gradle
Jraw
The Java Reddit API Wrapper
Stars: ✭ 320 (-11.11%)
Mutual labels:  gradle
Samples
JavaFX samples to run with different options and build tools
Stars: ✭ 352 (-2.22%)
Mutual labels:  gradle
Gsync
gSync is an rsync based library for sending delta updates of files to a remote server.
Stars: ✭ 344 (-4.44%)
Mutual labels:  patch
Kotlin Dsl Samples
Samples builds using the Gradle Kotlin DSL
Stars: ✭ 3,483 (+867.5%)
Mutual labels:  gradle

logo

release build pr license

Stark is a hot-fix framework for Android. It supports swapping new implementations of classes without restarting a running Android application, and updated Android resources (icons, layout, etc) while only restarting the Android Activity.

Sample Usage

  1. git clone https://github.com/ximsfei/Stark.git
  2. cd Stark
  3. ./gradlew :stark-sample:clean :stark-sample:assembleDebug
  4. adb install -r stark-sample/build/outputs/apk/debug/stark-sample-debug.apk
  5. Launch sample APK.
  6. Fix code and resources.

Fix Code

SecondActivity.java

public class SecondActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        content.setText("Code bug");
//        content.setText("aha, Code Bug Fix");
//        Toast.makeText(this, "fixed", Toast.LENGTH_SHORT).show();
    }
}

Fix Resources

strings.xml

    <string name="fix_text">Resources bug</string>
    <!--<string name="fix_text">Aha, Resources Bug Fix</string>-->

Change the TextView in activity_main.xml and activity_second.xml to Button.

  1. ./gradlew :stark-sample:clean :stark-sample:starkGeneratePatchDebug
  2. adb push stark-sample/build/outputs/apk/debug/stark-sample-debug.patch /sdcard/Android/data/com.ximsfei.stark.app/fix.apk
  3. Launch sample APK.
  4. Click the Button of applyPatch.
  5. Click the Button of recreate.
  6. Observe whether the code and resources are fixed.

Getting Started

The Gradle Dependency is available via jCenter,

Firstly, add dependency directly in your root project's build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.ximsfei:stark-gradle:0.0.5'
    }
}

Secondly, apply com.ximsfei.stark plugin and add stark core dependencies in your Android application project's build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.ximsfei.stark'

dependencies {
    implementation 'com.ximsfei:stark-core:0.0.5'
    implementation 'io.sigpipe:jbsdiff:1.0'
}

Note: Stark depends on jbsdiff, you need add jbsdiff dependency in your build.gradle

Initialize stark framework in application's attachBaseContext:

public class YourApp extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        Stark.get().load(base);
    }
}

After got the patch file, invoke the applyPatchAsync method to apply patch.

public class AnyClass {
    public void applyPatch(Context context, String path) {
        Stark.get().applyPatchAsync(context, path);
    }
}

After adding the dependencies and apply plugin, refresh gradle project, stark plugin will add two more tasks for you:

You can find them in the gradle stark task group.

  1. starkBackup + BuildType

After running the assemble + BuildType, run the backup task can backup the files needed to generate the patch for you.

Even you can enable an automatic backup configuration in the stark.properties file.

  1. starkGeneratePatch + BuildType

When you find a bug in an online apk, you can fix the code and run the starkGeneratePatch + BuildType task to generate hot-fix patch.

The starkGeneratePatch + BuildType task relies on files backed up by the starkBackup + BuildType task.

ProGuard

-keep class com.ximsfei.stark.core.runtime.** {public *;}

Configuration files

Also, the stark plugin will generate two configuration files in your Android application project dir:

stark.properties

# If autoBackup is true.
# Stark plugin will automatically backup the files needed to generate the patch.
# Otherwise, you need to run the stark backup task manually.
autoBackup=false

# If allStark is true.
# Stark plugin will inject redirection code into all BuildType(debug/release).
# You'd better disable this configuration at the development stage.
allStark=false

# If releaseStark is true.
# Stark plugin will inject redirection code into release stage.
releaseStark=true

# If your project needs to use multidex.
# You'd better get rid of the `multiDexEnabled = true` in build.gradle and enable it here.
multiDexEnabled=false

stark-rules.txt

# Add project specific stark rules here.
# include packages that need  to be fixed in the future.
# exclude packages that never to be fixed in the future.

-include: applicationId.

-exclude: android.support.

Contributing

For more information about contributing, see our contributing guide.

More

Thinks

Thanks to InstantRun, Tinker, Small, jbsdiff and Robust.

About Author

Pengfeng Wang(王鹏锋)

email: [email protected]

License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].