Qigsaw
🔥🔥Qigsaw ['tʃɪɡsɔ] is a dynamic modularization library which is based on Android App Bundles(Do not need Google Play Service). It supports dynamic delivery for split APKs without reinstalling the base one.
Top Related Projects
A powerful Android Dynamic Component Framework.
A powerful and lightweight plugin framework for Android
A small framework to split app into small parts
WMRouter是一款Android路由框架,基于组件化的设计思路,有功能灵活、使用简单的特点。
A hotfix library for Android platform, and not just this...
零反射全动态Android插件框架
Quick Overview
Qigsaw is an Android dynamic modularization library developed by iQIYI. It allows developers to split their Android apps into multiple modules that can be downloaded and installed on-demand, reducing initial app size and improving performance. Qigsaw is designed to be compatible with Google Play's dynamic delivery system.
Pros
- Reduces initial app size by allowing on-demand module installation
- Improves app performance by loading only necessary modules
- Compatible with Google Play's dynamic delivery system
- Supports both Java and Kotlin development
Cons
- Requires significant refactoring of existing apps to implement modularization
- Increases complexity in app architecture and development process
- May introduce additional runtime overhead for module management
- Limited documentation and community support compared to some alternatives
Code Examples
- Declaring a Qigsaw module:
@QigsawModule
class MyModule : QigsawModuleImpl() {
override fun onCreate() {
super.onCreate()
// Module initialization code
}
}
- Loading a Qigsaw module:
Qigsaw.loadModule("myModule") { success ->
if (success) {
// Module loaded successfully
} else {
// Module loading failed
}
}
- Accessing resources from a loaded module:
val moduleResources = Qigsaw.getModuleResources("myModule")
val drawableId = moduleResources.getIdentifier("my_drawable", "drawable", packageName)
val drawable = moduleResources.getDrawable(drawableId)
Getting Started
- Add Qigsaw dependencies to your project's
build.gradle
:
dependencies {
implementation 'com.iqiyi.android.qigsaw:qigsaw-core:1.4.1'
implementation 'com.iqiyi.android.qigsaw:splitcommon:1.4.1'
}
- Initialize Qigsaw in your Application class:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Qigsaw.install(this, BuildConfig.VERSION_CODE)
}
}
- Configure your app's
build.gradle
for Qigsaw:
apply plugin: 'com.iqiyi.qigsaw.application'
qigsaw {
// Qigsaw configuration options
splitInfoVersion = 1
disableLoad = false
}
Competitor Comparisons
A powerful Android Dynamic Component Framework.
Pros of Atlas
- More comprehensive documentation and examples
- Broader scope, supporting full component-based architecture
- Active development and maintenance by Alibaba
Cons of Atlas
- Steeper learning curve due to complexity
- Heavier runtime overhead compared to Qigsaw
- Less focused on specific dynamic delivery use cases
Code Comparison
Atlas:
Atlas.getInstance().installBundleTransitively(bundleFile);
Bundle bundle = Atlas.getInstance().getBundle(bundleName);
bundle.start();
Qigsaw:
SplitInstallRequest request = SplitInstallRequest.newBuilder()
.addModule("dynamic_feature")
.build();
splitInstallManager.startInstall(request);
Key Differences
- Atlas provides a more comprehensive framework for modularization, while Qigsaw focuses specifically on dynamic feature delivery
- Qigsaw offers a simpler API and integration process, making it easier to adopt for specific use cases
- Atlas has a larger community and more extensive documentation, but may be overkill for projects that only need dynamic feature delivery
Use Cases
- Choose Atlas for large-scale applications requiring full modularization and component-based architecture
- Opt for Qigsaw when focusing primarily on dynamic feature delivery with minimal overhead and simpler integration
A powerful and lightweight plugin framework for Android
Pros of VirtualAPK
- More comprehensive plugin framework, supporting full Android components
- Better performance due to optimized class loading mechanism
- Wider adoption and community support
Cons of VirtualAPK
- More complex implementation and setup process
- Larger plugin size due to full component support
- Potential security concerns with dynamic code loading
Code Comparison
VirtualAPK:
PluginManager pluginManager = PluginManager.getInstance(context);
pluginManager.loadPlugin(pluginPath);
Intent intent = new Intent();
intent.setClassName("com.example.plugin", "com.example.plugin.MainActivity");
startActivity(intent);
Qigsaw:
SplitInstallRequest request = SplitInstallRequest.newBuilder()
.addModule("feature_module")
.build();
splitInstallManager.startInstall(request);
Key Differences
- VirtualAPK focuses on full app virtualization, while Qigsaw emphasizes modular app development
- Qigsaw integrates more seamlessly with Android App Bundles and dynamic feature modules
- VirtualAPK offers more flexibility in plugin management, but Qigsaw provides a simpler API for module loading
Both projects aim to solve similar problems in Android app development, but they take different approaches. VirtualAPK is better suited for complex plugin scenarios, while Qigsaw excels in modular app development with a focus on reducing app size and improving distribution.
A small framework to split app into small parts
Pros of Small
- More mature project with longer development history
- Supports multiple programming languages (Java, Kotlin, Groovy)
- Offers a plugin system for extending functionality
Cons of Small
- Less active development and maintenance
- Fewer recent updates and releases
- Smaller community and fewer contributors
Code Comparison
Small:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Small.setBaseUri("http://example.com/");
Small.setUp(this, new Small.OnCompleteListener() {
@Override
public void onComplete() {
// Load plugins
}
});
}
}
Qigsaw:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Qigsaw.install(this);
}
}
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
QigsawInstaller.getInstance().startInstall(SPLIT_FEATURE_NAME);
}
}
Both Small and Qigsaw aim to provide modular app development solutions for Android. Small offers a more established ecosystem with multi-language support, while Qigsaw focuses on a simpler setup process and more recent development activity. The code comparison shows that Small requires more configuration upfront, while Qigsaw has a more straightforward installation process.
WMRouter是一款Android路由框架,基于组件化的设计思路,有功能灵活、使用简单的特点。
Pros of WMRouter
- More comprehensive routing solution, supporting both page and component-level routing
- Better integration with existing Android development practices
- More active development and community support
Cons of WMRouter
- Steeper learning curve due to more complex architecture
- Potentially higher overhead for simpler applications
- Less focus on dynamic feature module support compared to Qigsaw
Code Comparison
WMRouter:
@RouterUri("http://page.example.com/home")
public class HomeActivity extends Activity {
// Activity implementation
}
Qigsaw:
@QigsawInstaller
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Qigsaw.install(this);
}
}
Key Differences
- WMRouter focuses on general routing and navigation, while Qigsaw specializes in dynamic feature module management
- WMRouter uses URI-based routing, whereas Qigsaw employs a more modular approach
- Qigsaw provides built-in support for dynamic loading and unloading of modules, which is not a primary focus of WMRouter
Use Cases
- Choose WMRouter for complex navigation requirements in large-scale applications
- Opt for Qigsaw when prioritizing dynamic feature module support and app size optimization
Community and Support
- WMRouter has more recent updates and a larger community
- Qigsaw has fewer contributors but offers specialized support for dynamic feature modules
A hotfix library for Android platform, and not just this...
Pros of Amigo
- More active development with recent updates and contributions
- Broader scope, supporting multiple features beyond just dynamic loading
- Better documentation and examples for easier integration
Cons of Amigo
- Higher complexity due to its broader feature set
- Potentially larger overhead and impact on app size
- Steeper learning curve for developers new to the project
Code Comparison
Qigsaw (Java):
QigsawInstaller.install(this, new QigsawConfig.Builder()
.setDownloadMode(QigsawConfig.DOWNLOAD_MODE_WIFI_ONLY)
.build());
Amigo (Java):
Amigo.init(this);
Amigo.setDebugEnabled(true);
Amigo.setWorkDir(Environment.getExternalStorageDirectory().getAbsolutePath());
Amigo.setLoadPatchInfoThreshold(30 * 1000);
Amigo.setPatchLoadStatusNotifier(new PatchLoadStatusNotifier() {
// Implementation details
});
Both projects aim to improve Android app development, but Amigo offers a more comprehensive solution with additional features beyond dynamic loading. Qigsaw focuses specifically on dynamic component loading, which may be preferable for projects with simpler requirements. Amigo's code example demonstrates its broader scope and configuration options, while Qigsaw's example shows a more straightforward setup process for dynamic loading.
零反射全动态Android插件框架
Pros of Shadow
- More comprehensive documentation and examples
- Broader plugin ecosystem and community support
- Advanced features like dynamic loading and hot-fixing
Cons of Shadow
- Steeper learning curve due to complexity
- Heavier resource usage and larger APK size
- Potentially slower build times for large projects
Code Comparison
Shadow:
@ContainerFragment
class PluginFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_plugin, container, false)
}
}
Qigsaw:
public class PluginFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_plugin, container, false);
}
}
Both frameworks use similar approaches for creating plugin fragments, but Shadow uses Kotlin and annotations for a more concise syntax.
Shadow offers more advanced features and a larger ecosystem, making it suitable for complex projects. However, this comes at the cost of increased complexity and resource usage. Qigsaw, while simpler, may be more appropriate for smaller projects or teams new to plugin frameworks.
The choice between the two depends on project requirements, team expertise, and performance considerations. Shadow's extensive documentation and community support can be beneficial for long-term development, while Qigsaw's simplicity might lead to faster initial implementation.
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
Qigsaw
Qigsaw is a dynamic modularization library which is based on Android App Bundles. It supports dynamic delivery for split APK without reinstalling the base one.
Getting started
Import qigsaw-gradle-plugin as a dependency in your main build.gradle
in the root of your project:
buildscript {
dependencies {
classpath 'com.iqiyi.android.qigsaw:gradle-plugin:1.4.1-hotfix01'
}
}
Then "apply" the plugin and import dependencies by adding the following lines to your app/build.gradle
.
dependencies {
//qigsaw core lib
implementation "com.iqiyi.android.qigsaw:splitcore:1.4.1-hotfix01"
}
...
...
apply plugin: 'com.iqiyi.qigsaw.application'
At Last, "apply" another plugin by adding the following lines to your dynamicfeature/build.gradle
.
...
...
apply plugin: 'com.iqiyi.qigsaw.dynamicfeature'
Considering that every app has its own downloader, qigsaw just provides an interface Downloader and you are expected to implement it. Learn more from the sample SampleDownloader.
Qigsaw-gradle-plugin will upload split APKs which require dynamic delivery during compilation, so you have to implement SplitApkUploader to upload split APKs to your own CND server. Learn more from the sample SampleSplitApkUploader.
How to install qigsaw? Learn more from the sample QigsawApplication.
For proguard, we have already made the proguard config automatically via qigsaw-gradle-plugin.
For multiDex, learn more from the sample multidexkeep.pro.
For more qigsaw configurations, learn more from the sample app/build.gradle.
How to install split APKs? Qigsaw provides the same APIs to Play Core Library, so you may read google developer docs to install.
How to build base and split APKs? During development, you may use qigsawAssembleDebug
task or just click Run
app in Android Studio to build. When releasing your app, use qigsawAssembleRelease
task to build.
How to update splits? Please see our Split Update Guide.
Known Issues
There are some issues which Qigsaw can't update or support at present.
- Can't update split AndroidManifest.xml dynamically, for example adding Android Component.
- Can't update base APK dynamically.
- Doesn't support Android OS version lower than 4.0.
- Doesn't support incremental update for split APK.
- Learn more from the Known issues about Android App Bundle.
Extensive Functions
Qigsaw supports some functions which Android App Bundle doesn't yet.
- Supports to declare Application in split AndroidManifest. Qigsaw will invoke
Applicaton#attachBaseContext
andApplicaton#onCreate
methods for split application. - Supports to declare ContentProvider in split AndroidManifest.
Support
- Learn more from qigsaw-sample-android.
- Study the source code.
- Check wiki or FAQ for help.
- Contact us kisson_cjw@hotmail.com.
- Join QQ group chat.
Contributing
For more information about contributing, issues or pull requests, please check our Qigsaw Contributing Guide.
License
Qigsaw is MIT licensed. Read the LICENSE file for detail.
Top Related Projects
A powerful Android Dynamic Component Framework.
A powerful and lightweight plugin framework for Android
A small framework to split app into small parts
WMRouter是一款Android路由框架,基于组件化的设计思路,有功能灵活、使用简单的特点。
A hotfix library for Android platform, and not just this...
零反射全动态Android插件框架
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