Skip to content

Latest commit

 

History

History
92 lines (66 loc) · 2.45 KB

README.md

File metadata and controls

92 lines (66 loc) · 2.45 KB

AppCatcher

ac-plugin ac-component-app ac-main-app

An Android library to help component/module initialization.

Feature

  1. Automatic initialization of components

  2. The component has a fully functional application instance

Configuration

Step 1. Add it in your root build.gradle at the end of repositories:

buildscript {
    ...
    dependencies {
        ...
        classpath "com.lenebf.plugin:ac:1.0.3"
    }
}

Step 2. Apply 'com.lenebf.plugin.ac' plugin on your app and add dependencies

apply plugin: 'com.lenebf.plugin.ac'

dependencies {
    implementation 'com.lenebf.ac:main-app:1.0.3'
}

Step 3. Let your main application extend MainApplication

public class MyApplication extends MainApplication {
    @Override
    public void onComponentAppsInitFinish() {

    }

    @Override
    public void onCatchThrowable(Throwable throwable) {

    }
}

Step 4. Add dependencies for your components and Let your componetn/module application extend ComponentApplication

dependencies {
    implementation 'com.lenebf.ac:component-app:1.0.3'
}
public class Test1Application extends ComponentApplication {
    @Override
    public void init() {
        Log.d("Test1Application", "I'm component test1, function -init- be invoked.");
    }

    @Override
    public void initBackground() {
        Log.d("Test1Application", "I'm component test1, function -initBackground- be invoked.");
    }
}

3. Add confusing rules (If Proguard is turn on)

-keep class * extends com.lenebf.ac.component_application.ComponentApplication {
*;
}

# Replace [package name] with your main application package name.
-keep class [package name].CatchedApps {
*;
}

That's all you need to do, and the 'com.lenebf.plugin.ac' plugin will take care of the rest automatically!

License

GNU General Public License v3.0. See the LICENSE file for details.