Skip to content

Commit

Permalink
update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
wyouflf committed Jul 28, 2020
1 parent 2beae53 commit 2f544dc
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
// 最低gradle编译插件版本要求 com.android.tools.build:gradle:4.0.0
// 宿主中
implementation 'org.xutils:xutils:3.8.12'
implementation 'org.xutils:xutils:3.9.0'
implementation 'org.xplugin:xplugin:1.3.0'
// 插件中
compileOnly 'org.xutils:xutils:3.8.12' // 可选
compileOnly 'org.xutils:xutils:3.9.0' // 可选
compileOnly 'org.xplugin:xplugin:1.3.0'
```
2. 初始化接口示例: [MyApplication](app/src/main/java/org/xplugin/demo/app/MyApplication.java)
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

implementation 'org.xutils:xutils:3.8.12'
implementation 'org.xutils:xutils:3.9.0'
implementation project(path: ':xplugin')
}
Binary file modified app/src/main/assets/xpl_res/org.xplugin.demo.main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/assets/xpl_res/org.xplugin.demo.module2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
aaptOptions {
// 使用小于0x80的packageId需要添加 '--allow-reserved-package-id'
// additionalParameters '--allow-reserved-package-id', '--package-id', '0x72',
additionalParameters '--package-id', '0x80', '--emit-ids', "${project.rootDir.absolutePath}/runtime/main.id.txt"
additionalParameters '--package-id', '0x80', '--emit-ids', "${rootDir}/runtime/main.id.txt"
}

defaultConfig {
Expand Down Expand Up @@ -53,7 +53,7 @@ android {
variant.outputs.all { output ->
if (variant.flavorName.startsWith("rt")) {
appIds.add(variant.applicationId)
variant.packageApplicationProvider.get().outputDirectory = new File(project.rootDir.absolutePath + "/runtime")
variant.packageApplicationProvider.get().outputDirectory = new File("${rootDir}/runtime")
outputFileName = "${project.name}_${variant.flavorName}.apk"
} else if (variant.flavorName == "plugin") {
outputFileName = "${applicationId}.png"
Expand All @@ -67,10 +67,10 @@ android {
if (outputPluginPath != null && outputPluginPath.endsWith(".png")) {
copy {
from "${outputPluginPath}"
into "${project.rootDir.absolutePath}/app/src/main/assets/xpl_res/"
into "${rootDir}/app/src/main/assets/xpl_res/"
}

def mainIdFile = file("${project.rootDir.absolutePath}/runtime/main.id.txt")
def mainIdFile = file("${rootDir}/runtime/main.id.txt")
if (mainIdFile.exists()) {
// cp emit-ids
def outputId = null;
Expand All @@ -84,12 +84,12 @@ android {
for (String appId : appIds) {
copy {
from mainIdFile.absolutePath
into "${project.rootDir.absolutePath}/runtime/"
into "${rootDir}/runtime/"
rename { fileName ->
"${appId}.id.txt"
}
}
def idFile = file("${project.rootDir.absolutePath}/runtime/${appId}.id.txt")
def idFile = file("${rootDir}/runtime/${appId}.id.txt")
def idContent = idFile.text.replaceAll("${outputId}", "${appId}")
idFile.withPrintWriter { printWriter ->
printWriter.println(idContent)
Expand Down Expand Up @@ -132,5 +132,5 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

compileOnly project(path: ':xplugin')
compileOnly 'org.xutils:xutils:3.8.12'
compileOnly 'org.xutils:xutils:3.9.0'
}
4 changes: 2 additions & 2 deletions module1/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ android {
if (outputPluginPath != null && outputPluginPath.endsWith(".png")) {
copy {
from "${outputPluginPath}"
into "${project.rootDir.absolutePath}/app/src/main/assets/xpl_res/"
into "${rootDir}/app/src/main/assets/xpl_res/"
}

println("install cmd: ${android.adbExe} push ${outputPluginPath} /sdcard/a_xpl/")
Expand Down Expand Up @@ -90,5 +90,5 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])

compileOnly project(path: ':xplugin')
compileOnly 'org.xutils:xutils:3.8.12'
compileOnly 'org.xutils:xutils:3.9.0'
}
4 changes: 2 additions & 2 deletions module2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ android {
if (outputPluginPath != null && outputPluginPath.endsWith(".png")) {
copy {
from "${outputPluginPath}"
into "${project.rootDir.absolutePath}/app/src/main/assets/xpl_res/"
into "${rootDir}/app/src/main/assets/xpl_res/"
}

println("install cmd: ${android.adbExe} push ${outputPluginPath} /sdcard/a_xpl/")
Expand Down Expand Up @@ -78,5 +78,5 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'

compileOnly project(path: ':xplugin')
compileOnly 'org.xutils:xutils:3.8.12'
compileOnly 'org.xutils:xutils:3.9.0'
}

0 comments on commit 2f544dc

Please sign in to comment.