Skip to content

Commit 9fb84e7

Browse files
author
hyb1996
committed
修复 Android5以下退出编辑器时卡死的问题
1 parent 0d88a12 commit 9fb84e7

File tree

7 files changed

+68
-42
lines changed

7 files changed

+68
-42
lines changed
0 Bytes
Binary file not shown.

app/build.gradle

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ android {
2424
versionName versions.appVersionName
2525
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2626
multiDexEnabled true
27-
ndk {
28-
abiFilters 'armeabi-v7a', 'x86'
29-
}
3027
}
3128
buildTypes {
3229
debug {
@@ -49,34 +46,40 @@ android {
4946
disable 'MissingTranslation'
5047
disable 'ExtraTranslation'
5148
}
52-
android.applicationVariants.all { variant ->
53-
variant.outputs.all {
54-
outputFileName = "${variant.name}-${variant.versionName}.apk"
55-
}
56-
}
5749

5850
configurations.all {
5951
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
6052
}
6153

6254
flavorDimensions "channel"
55+
splits {
56+
57+
// Configures multiple APKs based on ABI.
58+
abi {
59+
60+
// Enables building multiple APKs per ABI.
61+
enable true
62+
63+
// By default all ABIs are included, so use reset() and include to specify that we only
64+
// want APKs for x86 and x86_64.
6365

66+
// Resets the list of ABIs that Gradle should create APKs for to none.
67+
reset()
68+
69+
// Specifies a list of ABIs that Gradle should create APKs for.
70+
include "x86", "armeabi-v7a"
71+
72+
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
73+
universalApk false
74+
}
75+
}
6476
productFlavors {
6577
common {
6678
buildConfigField "String", "CHANNEL", '"common"'
67-
ndk {
68-
abiFilters "armeabi-v7a"
69-
}
7079
}
7180
coolapk {
7281
buildConfigField "String", "CHANNEL", '"coolapk"'
7382
}
74-
x86 {
75-
buildConfigField "String", "CHANNEL", '"common"'
76-
ndk {
77-
abiFilters "x86"
78-
}
79-
}
8083
}
8184

8285
}

app/release/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":253,"versionName":"4.1.0 Alpha3","enabled":true,"outputFile":"inrt-release.apk","fullName":"release","baseName":"release"},"path":"inrt-release.apk","properties":{}}]
1+
[{"outputType":{"type":"APK"},"apkInfo":{"type":"FULL_SPLIT","splits":[{"filterType":"ABI","value":"armeabi-v7a"}],"versionCode":261,"versionName":"4.1.1 Alpha2","enabled":true,"filterName":"armeabi-v7a","outputFile":"inrt-armeabi-v7a-release.apk","fullName":"armeabi-v7aRelease","baseName":"armeabi-v7a-release"},"path":"inrt-armeabi-v7a-release.apk","properties":{}},{"outputType":{"type":"APK"},"apkInfo":{"type":"FULL_SPLIT","splits":[{"filterType":"ABI","value":"x86"}],"versionCode":261,"versionName":"4.1.1 Alpha2","enabled":true,"filterName":"x86","outputFile":"inrt-x86-release.apk","fullName":"x86Release","baseName":"x86-release"},"path":"inrt-x86-release.apk","properties":{}}]

app/src/main/java/org/autojs/autojs/ui/edit/EditActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private void finishAndRemoveFromRecents() {
210210
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
211211
finishAndRemoveTask();
212212
} else {
213-
finish();
213+
super.finish();
214214
}
215215
if (mNewTask) {
216216
startActivity(new Intent(this, MainActivity_.class));

coolapk/release/output.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

inrt/build.gradle

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ android {
1414
versionName versions.appVersionName
1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1616
multiDexEnabled true
17-
ndk {
18-
abiFilters 'armeabi-v7a'
19-
}
20-
2117
}
2218
lintOptions {
2319
disable 'MissingTranslation'
@@ -27,6 +23,27 @@ android {
2723
sourceCompatibility JavaVersion.VERSION_1_8
2824
targetCompatibility JavaVersion.VERSION_1_8
2925
}
26+
splits {
27+
28+
// Configures multiple APKs based on ABI.
29+
abi {
30+
31+
// Enables building multiple APKs per ABI.
32+
enable true
33+
34+
// By default all ABIs are included, so use reset() and include to specify that we only
35+
// want APKs for x86 and x86_64.
36+
37+
// Resets the list of ABIs that Gradle should create APKs for to none.
38+
reset()
39+
40+
// Specifies a list of ABIs that Gradle should create APKs for.
41+
include "x86", "armeabi-v7a"
42+
43+
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
44+
universalApk false
45+
}
46+
}
3047
buildTypes {
3148
debug {
3249
minifyEnabled false
@@ -39,30 +56,37 @@ android {
3956
}
4057
}
4158

59+
def buildApkPluginForAbi(File pluginProjectDir, String abi) {
60+
copy {
61+
from file('..\\app\\release\\')
62+
into new File(pluginProjectDir, 'app\\src\\main\\assets')
63+
def fileName = "inrt-" + abi + "-release.apk"
64+
include fileName
65+
rename fileName, 'template.apk'
66+
}
67+
exec {
68+
workingDir pluginProjectDir
69+
commandLine 'gradlew.bat', 'assembleRelease'
70+
}
71+
copy {
72+
from new File(pluginProjectDir, 'app\\build\\outputs\\apk\\release')
73+
into file('..\\common\\release')
74+
def fileName = '打包插件-' + versions.appVersionName + '-release.apk'
75+
include fileName
76+
rename fileName, '打包插件-' + abi + '-' + versions.appVersionName + '-release.apk'
77+
}
78+
}
4279

4380
task buildApkPlugin {
4481
doLast {
4582
def pluginProjectDirPath = '..\\..\\AutoJsApkBuilderPlugin'
4683
def pluginProjectDir = file(pluginProjectDirPath)
47-
if(!pluginProjectDir.exists() || !pluginProjectDir.isDirectory()){
84+
if (!pluginProjectDir.exists() || !pluginProjectDir.isDirectory()) {
4885
println 'pluginProjectDir not exists'
4986
return
5087
}
51-
copy {
52-
from file('build\\outputs\\apk\\release\\')
53-
into new File(pluginProjectDir, 'app\\src\\main\\assets')
54-
include "inrt-release-unsigned.apk"
55-
rename "inrt-release-unsigned.apk", 'template.apk'
56-
}
57-
exec {
58-
workingDir pluginProjectDir
59-
commandLine 'gradlew.bat', 'assembleRelease'
60-
}
61-
copy {
62-
from new File(pluginProjectDir, 'app\\build\\outputs\\apk\\release')
63-
into file('..\\common\\release')
64-
include '*-release.apk'
65-
}
88+
buildApkPluginForAbi(pluginProjectDir, 'armeabi-v7a')
89+
buildApkPluginForAbi(pluginProjectDir, 'x86')
6690
}
6791
}
6892

project-versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"appVersionCode": 460,
3-
"appVersionName": "4.1.1 Alpha",
2+
"appVersionCode": 461,
3+
"appVersionName": "4.1.1 Alpha2",
44
"target": 28,
55
"mini": 17,
66
"compile": 28,

0 commit comments

Comments
 (0)