当前位置:   article > 正文

Android 插件化开发(五)—— Replugin内部插件开发

内部插件

最近在学习插件化开发,之前看的是VirtualApk,但是从2018年之后,已经没有人维护了,所以换成360的Replugin,先上效果图
在这里插入图片描述
环境搭建:
Android stuido 4.0
gradle 3.1.3+4.4
replugin 2.3.1
com.android.support:appcompat-v7

本次使用的是内部插件方式加载
项目结构图
在这里插入图片描述
环境搭建:
因为是在同一个项目下的,所以在project中放入宿主和插件导入

buildscript {
   
    repositories {
   
        google()
        jcenter()
    }
    dependencies {
   
        classpath "com.android.tools.build:gradle:3.1.3"
        classpath 'com.qihoo360.replugin:replugin-host-gradle:2.3.1'
        classpath 'com.qihoo360.replugin:replugin-plugin-gradle:2.3.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
   
    repositories {
   
        google()
        jcenter()
    }
}

task clean(type: Delete) {
   
    delete rootProject.buildDir
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

说明:gradle版本如果升级用太高的话,是会存在问题,各种报错,有可能是RePluginHostConfig文件不能自动生成的错,也有可能是build.gradle中语法报错,到处都是坑

宿主app:

apply plugin: 'com.android.application'

android {
   
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
   
        applicationId "com.example.pluginprojectonly"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
   
        release 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号