Top Related Projects
A type-safe HTTP client for Android and the JVM
A fast dependency injector for Android and Java.
Bind Android views and callbacks to fields and methods.
RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
Google core libraries for Java
Quick Overview
RocooFix is a runtime hot-fix solution for Android applications, allowing developers to quickly patch and update their apps without the need for a full app update. It provides a simple and efficient way to fix bugs or introduce new features without going through the app store review process.
Pros
- Runtime Patching: RocooFix enables developers to apply hot-fixes to their apps without requiring users to update the app.
- Reduced Downtime: With RocooFix, developers can quickly address issues and push updates to users, minimizing app downtime and improving user experience.
- Streamlined Deployment: The solution simplifies the deployment process, allowing developers to focus on delivering new features and bug fixes.
- Compatibility: RocooFix is compatible with a wide range of Android versions, making it a versatile solution for diverse user bases.
Cons
- Potential Security Risks: Runtime patching can introduce security vulnerabilities if not implemented properly, as it allows for dynamic code execution.
- Complexity: Integrating RocooFix into an existing project may require additional setup and configuration, which can add complexity to the development process.
- Dependency on External Service: RocooFix relies on an external service (Rocoo) to manage and distribute the hot-fixes, which introduces a potential single point of failure.
- Limited Visibility: Developers may have limited visibility into the deployment and usage of hot-fixes, making it challenging to monitor and troubleshoot issues.
Code Examples
// Initializing RocooFix
RocooFix.init(this, "YOUR_APP_ID");
This code initializes the RocooFix library, setting the application ID for the current app.
// Applying a hot-fix
RocooFix.getInstance().applyPatch("path/to/patch.jar");
This code applies a hot-fix by loading a patch file located at the specified path.
// Checking the hot-fix status
boolean isPatched = RocooFix.getInstance().isPatchApplied();
This code checks whether a hot-fix has been successfully applied to the app.
// Clearing the hot-fix
RocooFix.getInstance().clearPatch();
This code removes the applied hot-fix, reverting the app to its original state.
Getting Started
To get started with RocooFix, follow these steps:
- Add the RocooFix dependency to your project's
build.gradle
file:
dependencies {
implementation 'com.dodola:rocoofix:1.0.6'
}
- Initialize RocooFix in your application's
onCreate()
method:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
RocooFix.init(this, "YOUR_APP_ID");
}
}
-
Create a hot-fix patch and upload it to the Rocoo service. You can use the provided
RocooFix.applyPatch()
method to apply the hot-fix in your app. -
Monitor the hot-fix status using the
RocooFix.isPatchApplied()
method, and handle any issues or rollbacks as needed.
For more detailed instructions and advanced usage, please refer to the RocooFix GitHub repository.
Competitor Comparisons
A type-safe HTTP client for Android and the JVM
Pros of Retrofit
- Widely adopted and well-documented library for making HTTP requests in Android applications.
- Provides a clean and intuitive API for defining and executing API calls.
- Supports a variety of response types, including JSON, XML, and custom data formats.
Cons of Retrofit
- Requires more boilerplate code to set up and configure compared to RocooFix.
- May have a steeper learning curve for developers new to the library.
Code Comparison
Retrofit:
public interface GitHubService {
@GET("users/{user}/repos")
Call<List<Repo>> listRepos(@Path("user") String user);
}
RocooFix:
public class FixedMethodInterceptor implements MethodInterceptor {
@Override
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
// Implement custom logic to fix method invocation
return proxy.invokeSuper(obj, args);
}
}
A fast dependency injector for Android and Java.
Pros of Dagger
- Dagger is a well-established and widely-used dependency injection framework, with a large and active community.
- Dagger provides a robust and flexible dependency management system, making it easier to manage complex application architectures.
- Dagger is highly performant, with a focus on compile-time code generation for efficient runtime performance.
Cons of Dagger
- Dagger has a steeper learning curve compared to RocooFix, especially for developers new to dependency injection.
- Dagger's code generation can make it more difficult to debug and understand the underlying implementation.
- Dagger may be overkill for smaller projects or simple dependency management needs.
Code Comparison
Dagger:
@Module
public class AppModule {
@Provides
@Singleton
public SharedPreferences provideSharedPreferences(Application application) {
return application.getSharedPreferences("app_prefs", Context.MODE_PRIVATE);
}
}
RocooFix:
public class RocooFixManager {
public static void init(Application application) {
RocooFix.init(application);
}
public static void register(Class<?> clazz) {
RocooFix.register(clazz);
}
}
Bind Android views and callbacks to fields and methods.
Pros of Butterknife
- Simplicity: Butterknife provides a straightforward and easy-to-use API for binding views and click listeners, reducing boilerplate code.
- Performance: Butterknife's annotation-based approach is more efficient than manual view lookups, as it generates optimized code at compile-time.
- Testability: Butterknife's separation of concerns makes it easier to write unit tests for your Android components.
Cons of Butterknife
- Dependency on Annotation Processing: Butterknife relies on annotation processing, which can increase build times and complexity.
- Limited Functionality: Butterknife is primarily focused on view binding and click listeners, and may not provide the same level of flexibility as other view binding solutions.
Code Comparison
Butterknife:
class ExampleActivity extends Activity {
@BindView(R.id.title) TextView title;
@BindView(R.id.subtitle) TextView subtitle;
@OnClick(R.id.button) void onButtonClicked() {
// TODO: handle click
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example);
ButterKnife.bind(this);
}
}
RocooFix:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText("Hello World!");
}
}
RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
Pros of RxJava
- Provides a powerful and flexible reactive programming model for Java and Android development.
- Offers a wide range of operators and utilities for working with asynchronous data streams.
- Has a large and active community with extensive documentation and resources.
Cons of RxJava
- Steep learning curve, especially for developers new to reactive programming.
- Can lead to complex and difficult-to-debug code if not used judiciously.
- Overhead and performance considerations, especially for simple use cases.
Code Comparison
RxJava:
Observable.just("Hello", "World")
.map(String::toUpperCase)
.subscribe(System.out::println);
RocooFix:
public class FixedClass {
public void doSomething() {
System.out.println("RocooFix is working!");
}
}
Google core libraries for Java
Pros of Guava
- Guava is a well-established and widely-used library, with a large community and extensive documentation.
- Guava provides a wide range of utility classes and methods, covering a variety of common programming tasks.
- Guava is actively maintained and regularly updated, ensuring compatibility with the latest Java versions.
Cons of Guava
- Guava can be a large and complex library, which may be overkill for smaller projects.
- The learning curve for Guava can be steep, as it introduces its own conventions and patterns.
Code Comparison
Guava:
Optional<Integer> value = Optional.of(42);
if (value.isPresent()) {
int x = value.get();
// do something with x
}
RocooFix:
int value = 42;
if (value != 0) {
// do something with value
}
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
RocooFix
Another hotfix framework
update
æ°åäºä¸ä¸ªæ¡æ¶åçä¸ç¾å¢robustæ¡æ¶ç±»ä¼¼ï¼å ·ä½çè¿é:AnoleFix
ä¹åçHotFix项ç®å¤ªè¿ç®åï¼ä¹æå¾å¤åå¦ç¨Nuwaéå°å¾å¤é®é¢ï¼ä½è ä¹ä¸åä¿®å¤ï¼æ以éæ°æ建äºä¸å¥å·¥å ·ã
éå°é®é¢çåå¦å¯ä»¥çä¸ä¸è¿é
https://github.com/shoyu666/derocoodemo
Bugfix
- 2016-06-26
- å¢å äº Android N (API 24)çæ¯æ
- å¢å äºå ³èå¼ç¨çè¡¥ä¸å¶ä½æ¨¡åï¼è§£å³ ART NativeCode address ä½ç½®é误å¼èµ·çå´©æºé®é¢ï¼ä½æ¯ä¼é æå 大å°çå¢å ï¼åæä¼æ¯æ微信æåºç Dexdiff ææ¯
Features
- æ¯æ两ç§æ¨¡å¼ï¼
- éæä¿®å¤æç§æ åµä¸éè¦éå¯åºç¨ã
- å¨æä¿®å¤ï¼æ ééå¯åºç¨å³å¯çæã
- æ°å¢soä¿®å¤ï¼betaä¸
- æ¯æDalvikVMåART VM
- å¶ä½è¡¥ä¸æ´å æ¹ä¾¿
- æ¯æ
com.android.tools.build:gradle:1.3.0
->com.android.tools.build:gradle:2.1.2
(解å³äºNuwa è¿ä¸ªissue) - æ¯ææ··æ·åMulitdex
- æ éå
³æ³¨
hash.txt
åmapping.txt
æ件ççæåä¿å
TODO
- è¡¥å åæµ
- å ¼å®¹æ§æµè¯
- ç®å½è§åè°æ´
- 对Winç³»ç»çæ¯æ
Use
public class RocooApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
//åå§å
RocooFix.init(this);
}
}
//æ¹æ¡1ï¼éæå¯ç¨ï¼ä¸è¬å¨Applicationéå 载补ä¸
/**
* ä»Assetséååºè¡¥ä¸ï¼ä¸è¬ç¨äºæµè¯
*
* @param context
* @param assetName
*/
RocooFix.initPathFromAssets(Context context, String assetName);
/**
* ä»æå®ç®å½å 载补ä¸
* @param context
* @param dexPath
*/
RocooFix.applyPatch(Context context, String dexPath);
//æ¹æ¡2ï¼å¨ææè¡¥ä¸ï¼ç«å³çæï¼ææ§è½é®é¢ï¼éç¨äºè¡¥ä¸æ¹æ³æ°è¾å°çæ
åµï¼å»ºè®®å¨ARTèææºéå¯ç¨è¯¥æ¨¡å¼
/**
* ä»Assetéå 载补ä¸ï¼ä¸è¬ç¨äºæ¬å°æµè¯
* @param context
* @param assetName
*/
RocooFix.initPathFromAssetsRuntime(Context context, String assetName) ;
/**
* ä»æå®ç®å½å 载补ä¸
* @param context
* @param dexPath
*/
RocooFix.applyPatchRuntime(Context context, String dexPath) ;
/**
*
* new Feature beta ä¸
* ä»æå®ç®å½å è½½soè¡¥ä¸ï¼ä½¿ç¨soè¿éè°ç¨System.loadLibrary("xx")
* @param context
* @param soDirPath soè¡¥ä¸è·¯å¾(è¿éæ¯dir)
*/
RocooSoFix.applyPatch(Context context, String soDirPath);
Configuration
1 å¨rootçbuild.gradle
å¢å å¦ä¸å
容:
repositories {
jcenter()
}
dependencies {
classpath 'com.dodola:rocoofix:1.2.6â
}
2 å¨ä½ 项ç®çbuild.gradle
æ件éæ·»å å¦ä¸é
ç½®
apply plugin: 'com.dodola.rocoofix'
repositories {
jcenter()
}
rocoo_fix {
includePackage = ['com/dodola/rocoosample']//æå®å°æ¥å¯è½éè¦å¶ä½è¡¥ä¸çpackage(å°±æ¯æå®æåºçèå´)
excludeClass = ['BaseApplication.class']//å°ä¸éè¦å å°patchéçç±»åå¨è¿é(ä¸éè¦æåºçç±»)
preVersionPath = '1'//注æï¼æ¤é¡¹å±æ§åªå¨éè¦å¶ä½è¡¥ä¸çæ¶åæéå¼å¯ï¼ï¼å¦æä¸éè¦å¶ä½è¡¥ä¸åéè¦å»ææ¤é¡¹
enable = true//注æï¼å
³ææ¤é¡¹ä¼æ æ³çæHash.txtæ件
scanref=true//é»è®¤ä¸º falseï¼å¼å¯è¿ä¸ªé项ä¼å°ä¸è¡¥ä¸ class ç¸å¼ç¨ç class é½æå
¥å
ä¸æ¥è§£å³ ART èææºå´©æºé®é¢ï¼åè½ Beta ä¸
}
dependencies {
compile 'com.dodola:rocoo:1.1'
}
è¿é主è¦ä»ç»ä¸ä¸preVersionPath
è¿ä¸ªå±æ§çä½ç¨ã
rocoo_fix
å°å¶ä½è¡¥ä¸çæ¥éª¤éæåï¼ç¨æ·æ éæå¨å¤ä»½hash.txtæ件ï¼æ件ä¼èªå¨æ ¹æ®å½åçversionCode
çæhash.txt
åmapping.txt
æ件å°æå®ç®å½ï¼æ¯å¦ï¼
ä¸ä¸ä¸ªçæ¬åå¸çæ¶åçæ¬å·æ¯1
ï¼é£ä¹çæçæ件ä¼æ¾å¨appæºç ç®å½/rocooFix/version1/[debug]|[release]
çç®å½ä¸ï¼å¦æéè¦å¶ä½è¡¥ä¸é£ä¹å¨é
ç½®éæå®preVersionPath
å±æ§ï¼å®çå¼æ¯ä¸ä¸ä¸ªçæ¬ççæ¬å·ï¼è¿éçå¼æ¯1
ï¼
ç¶åå°build.gradle
çversionCode
çå·ç ä¿®æ¹ï¼è¿éä¿®æ¹æ2
ï¼åªè¦åä¹åççæ¬ä¸åå°±å¯ä»¥ï¼æ²¡æå
·ä½å¼çè¦æ±
Proguard(æ··æ·)
-keep class com.dodola.rocoofix.** {*;}
-keep class com.lody.legend.** {*;}
-keepclassmembers class com.dodola.rocoosample.** {
public <init>();//ä¿çinit,åinclude packageä¿æä¸è´
}
Build Patch
ä¸é¢æ¼ç¤ºä¸ä¸ä½¿ç¨é¡¹ç®demoçæè¡¥ä¸çå¶ä½è¿ç¨
1 åå¦æ们éè¦æè¡¥ä¸çæ件æ¯
package com.dodola.rocoosample;
public class HelloHack {
public String showHello() {
return "hello world";
}
}
æ¤æ¶build.gradle
éçVersionCode
æ¯1
2 è¿è¡ä¸æ¬¡åºç¨ï¼è¿æ¶ä¼å¨app
çç®å½ä¸çæå¦ä¸æ件ï¼
è¿éå¯ä»¥çåæ¯æ们已ç»åå¸çæ¬çhash.txt
3 å设æ们éè¦ä¿®å¤æ¥éª¤1 éçshowHello
æ¹æ³ï¼ä¿®æ¹å¦ä¸ï¼
package com.dodola.rocoosample;
public class HelloHack {
public String showHello() {
return "hello Hack";//æ¤å¤ä¿®å¤ï¼è¡¥ä¸å è½½å该æ¹æ³è¿åhello hack
}
}
4 ä¿®æ¹build.gradle æ件érocoo_fix
项ï¼è®©å
¶æ§è¡patch çtaskï¼é
ç½®å¦ä¸
rocoo_fix {
preVersionPath = '1'//注æï¼è¿éæå®çæ¯éè¦æè¡¥ä¸çVersionCode
enable = true
}
5 ä¿®æ¹å½å项ç®çversionCode
为2
ï¼è¯´æè¿ä¸ªæ¯ä¸ä¸ªå级fixçæ¬ã
6 æ£å¸¸åå¸åºç¨ï¼æ¤æ¶ä¼å¨ä¸å¾æ示çè·¯å¾ä¸çæè¡¥ä¸æ件ï¼
7 æ们å¯ä»¥åç¼è¯apkæ¥ç¡®è®¤æåºæ¯å¦æå
ç¸å ³é¡¹ç®
Top Related Projects
A type-safe HTTP client for Android and the JVM
A fast dependency injector for Android and Java.
Bind Android views and callbacks to fields and methods.
RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
Google core libraries for Java
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot