All Projects → luqinx → sp

luqinx / sp

Licence: Apache-2.0 license
sp(a)是一个SPI(Service Provider Interface)框架, 他具有跨模块(无任何依赖关系的模块)创建对象的能力。使用简单、功能强大、性能损耗极低,是组件化开发、模块解耦合的不二之选。由于sp(a)灵活的配置能力,使得它很容易扩展出更多的跨模块通信能力,如组件热插拔、路由、事件分发、rpc通信等。如果您正在使用组件化开发,或者您有多项目需要做差异化处理,强烈推荐您使用sp(a)。

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to sp

SwiftArchitectureWithPOP
A base architecture written in swift and protocol oriented, for building new apps easily and quickly
Stars: ✭ 28 (-71.13%)
Mutual labels:  componentization
Repo
一个基于shell + gradle开发的效率工具,用来优化模块化/组件化分仓后带来的编译和调试痛点,提升开发效率
Stars: ✭ 28 (-71.13%)
Mutual labels:  componentization
StarWarsSearch-MVI
Star wars sample android project showcasing the use of View components for rendering UI in Fragments and Activities. Uses Android Jetpack, clean architecture with MVI (Uni-directional data flow), dagger hilt, and kotlin coroutines with StateFlow
Stars: ✭ 189 (+94.85%)
Mutual labels:  componentization
Arouter
💪 A framework for assisting in the renovation of Android componentization (帮助 Android App 进行组件化改造的路由框架)
Stars: ✭ 13,587 (+13907.22%)
Mutual labels:  componentization
Component
🔥🔥🔥A powerful componentized framework.一个强大、100% 兼容、支持 AndroidX、支持 Kotlin并且灵活的组件化框架
Stars: ✭ 2,434 (+2409.28%)
Mutual labels:  componentization
Cc
业界首个支持渐进式组件化改造的Android组件化开源框架,支持跨进程调用。Componentize your android project gradually.
Stars: ✭ 3,863 (+3882.47%)
Mutual labels:  componentization

ServicePool

GitHub license build release 掘金

ServicePool接入方法

spa已迁移至mavenCentral, groupId已修正为io.github.luqinx, 包名还保持原来的包名

在项目根目录的build.gradle中引入

allprojects {
    repositories {
        ...
        mavenCentral()
    }
}

buildscript {

    repositories {
        ...
        mavenCentral()
    }
    dependencies {
        ...
        classpath 'io.github.luqinx:autoservice:1.7.0'
    }
}

在主Module目录(一般是app目录)的build.gradle中添加

apply plugin: 'sp.autoservice'

...

** 其他Module下按需添加依赖 **

dependencies {
    implementation 'io.github.luqinx:sp:1.7.0' //servicepool核心库, 是java库, 非android环境用这个就可以了
    implementation 'io.github.luqinx:spa:1.7.0' // servicepool的Android支持(spa), 只依赖spa也是可以的
    implementation 'io.github.luqinx:sprouter:1.7.0' // 基于spa的页面路由
}

** 混淆配置 **


-ignorewarnings

-dontwarn com.google.common.**

-dontwarn net.bytebuddy.**

-keep class net.bytebuddy.** {*;}
-keep class com.android.** {*;}

-keep @chao.java.tools.servicepool.annotation.* class *
-keep @chao.android.tools.rpc.annotation.* class ** {*;}

-keep class chao.android.tools.** {*;}
-keep class chao.java.tools.** {*;}

ServicePool使用方式

在Application的onCreate()/onAttachBaseContext()方法中初始化

ServicePool使用懒加载思想,所有服务Service对象都是在真正使用的时刻才会去创建和初始化。这里主要是因为Android部分功能依赖Context, 初始化时可注入ApplicationContext。还有有些特定的服务有预加载的需求(如业务组件可能需要一个特定的初始化场景,而不是去依赖Application的onCreate()方法)

   Spa.init(this); //初始化耗时10ms左右, 设备不同可能会有些差异, 我测试的设备是小米mix3

Spa的更多使用细节,请参考博客Android端简单易用的SPI框架 - SPA

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].