在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):ximsfei/Stark开源软件地址(OpenSource Url):https://github.com/ximsfei/Stark开源编程语言(OpenSource Language):Java 67.5%开源软件介绍(OpenSource Introduction):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
Fix Code
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
<string name="fix_text">Resources bug</string>
<!--<string name="fix_text">Aha, Resources Bug Fix</string>--> Change the
Getting StartedThe 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 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 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 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.
After running the Even you can enable an automatic backup configuration in the stark.properties file.
When you find a bug in an online apk, you can fix the code and run the The ProGuard-keep class com.ximsfei.stark.core.runtime.** {public *;} Configuration filesAlso, the stark plugin will generate two configuration files in your Android application project dir:
# 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
ContributingFor more information about contributing, see our contributing guide. More
ThinksThanks to InstantRun, Tinker, Small, jbsdiff and Robust. About AuthorPengfeng Wang(王鹏锋) email: [email protected] License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论