Replugin使用
来源:互联网 发布:python 并行编程 编辑:程序博客网 时间:2024/06/05 12:05
插件开发:
1.配置项目根目录下的gradle:配置denpendencies
buildscript { repositories { mavenLocal() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.qihoo360.replugin:replugin-plugin-gradle:2.2.1' }}allprojects { repositories { mavenLocal() jcenter() }}task clean(type: Delete) { delete rootProject.buildDir}
2.配置app目录下的gradle: 配置plugin和dependencies
apply plugin: 'com.android.application'android { compileSdkVersion 25 buildToolsVersion '25.0.0' defaultConfig { versionName "1" versionCode 1 targetSdkVersion 21 applicationId "com.qihoo360.replugin.sample.demo1" minSdkVersion 15 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }}// 这个plugin需要放在android配置之后,因为需要读取android中的配置项apply plugin: 'replugin-plugin-gradle'dependencies { compile 'com.qihoo360.replugin:replugin-plugin-lib:2.2.1'}
3.配置清单文件:给activity单独配置theme
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.qihoo360.replugin.sample.demo1"> <application android:allowBackup="false" android:icon="@mipmap/app_icon" android:label="@string/app_name"> <activity android:name=".MainActivity" android:exported="true" android:theme="@android:style/Theme.Light.NoTitleBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>
4.然后就可以开发插件了,插件开发完成后,得到apk文件,将apk文件的后缀名改为jar,copy到主程序的assets下的plugins文件夹下:
5.修改主程序下app目录下的gradle:
apply plugin: 'replugin-host-gradle'repluginHostConfig { useAppCompat = true // 可以在这里自定义常驻进程的名字 // persistentName = ":XXXXService"}dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.qihoo360.replugin:replugin-host-lib:2.2.1'}
6.修改主程序下根目录的gradle:配置denpendencies
dependencies { classpath 'com.android.tools.build:gradle:3.0.0-alpha8' classpath 'com.qihoo360.replugin:replugin-host-gradle:2.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files}
7.自定义类继承RePluginApplication
8.配置清单文件:
<application android:name=".App" android:allowBackup="false" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity></application>
9.现在就可以在主程序中跳转到插件中的页面了,有多种跳转方式,下面的是包名跳转。
RePlugin.startActivity(MainActivity.this, RePlugin.createIntent("com.qihoo360.replugin.sample.demo1", "com.qihoo360.replugin.sample.demo1.MainActivity"));
ps:插件和主程序所用的插件和依赖不一样,这个要仔细了
阅读全文
0 0
- Replugin使用
- RePlugin 使用总结
- RePlugin 2.2.X使用教程
- Android 插件化框架 RePlugin 使用心得
- Replugin Demo的简单使用与分析(一)
- Replugin Demo的简单使用与分析(二)
- replugin 学习
- RePlugin主程序接入
- RePlugin外置安装教程
- RePlugin初体验
- Replugin 实战1
- 360 RePlugin引入教程
- RePlugin的一些问题
- RePlugin 常见问题总结
- Replugin ContentProvider实现机制
- Replugin Application初始化流程
- Replugin startActivity流程
- Qihoo360/RePlugin 简单项目构建
- Git 中 SSH key 生成步骤
- Spring实现控制反转(IOC)的三种方式(零)——理解IOC
- Maven打包生成包含所有依赖的jar包
- 安卓 广播有时候会接收不到
- 汽车CAN总线关闭故障的诊断与恢复
- Replugin使用
- DNS原理
- Jump Game II
- Search in Rotated Sorted Array II:带重复与转折的升序数列搜索
- 导航中的robot footprint和各种radius
- mongodb备份还原单表
- 视频物体分割--One-Shot Video Object Segmentation 2017年cvpr
- 数据结构(C语言)线性表 顺序存储
- 【转】数据库基本知识:(七)函数和表达式的使用