6.6.2 - Alpha - 修复 dx 库在 Android 7.x 无法正常使用的问题 (issue #293)
This commit is contained in:
@@ -149,6 +149,7 @@ dependencies /* Unclassified */ {
|
||||
|
||||
// Dex
|
||||
implementation(files("$rootDir/libs/com.android.dx-1.14.jar"))
|
||||
implementation(files("$rootDir/libs/com.legacy.android.dx-1.7.0.jar"))
|
||||
|
||||
// OpenCV
|
||||
implementation(project(":libs:org.opencv-4.8.0"))
|
||||
@@ -820,13 +821,6 @@ class Versions(filePath: String) {
|
||||
private val javaVersionMinRadical: Int = properties["JAVA_VERSION_MIN_RADICAL"].let { it as String }.toInt()
|
||||
private val javaVersionRaw = properties["JAVA_VERSION"] as String
|
||||
private var javaVersionInfoSuffix = ""
|
||||
private val javaVersionCeilMap = mapOf(
|
||||
"idea" to mapOf(
|
||||
"2023.2" to javaVersionMinSuggested, /* Aug 17, 2023. */
|
||||
"2023.1" to javaVersionMinSuggested, /* Aug 17, 2023. */
|
||||
"2022.3" to javaVersionMinSuggested, /* Aug 17, 2023. */
|
||||
),
|
||||
)
|
||||
|
||||
val javaVersion: JavaVersion by lazy {
|
||||
var niceVersionInt = javaVersionRaw.toInt()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.autojs.autojs
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
@@ -29,7 +28,6 @@ import org.autojs.autojs.event.GlobalKeyObserver
|
||||
import org.autojs.autojs.external.receiver.DynamicBroadcastReceivers
|
||||
import org.autojs.autojs.leakcanary.LeakCanarySetup
|
||||
import org.autojs.autojs.pluginclient.DevPluginService
|
||||
import org.autojs.autojs.runtime.api.WrappedShizuku
|
||||
import org.autojs.autojs.timing.TimedTaskManager
|
||||
import org.autojs.autojs.timing.TimedTaskScheduler
|
||||
import org.autojs.autojs.tool.CrashHandler
|
||||
@@ -94,7 +92,7 @@ class App : MultiDexApplication() {
|
||||
val crashHandler = CrashHandler(ErrorReportActivity::class.java)
|
||||
|
||||
val strategy = CrashReport.UserStrategy(applicationContext)
|
||||
strategy.setCrashHandleCallback(crashHandler)
|
||||
strategy.crashHandleCallback = crashHandler
|
||||
|
||||
CrashReport.initCrashReport(applicationContext, BUGLY_APP_ID, false, strategy)
|
||||
|
||||
@@ -239,7 +237,7 @@ class App : MultiDexApplication() {
|
||||
get() = instance.get()!!
|
||||
|
||||
fun getProcessNameCompat(): String {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) Application.getProcessName() else {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) getProcessName() else {
|
||||
try {
|
||||
@SuppressLint("PrivateApi") val activityThread = Class.forName("android.app.ActivityThread")
|
||||
@SuppressLint("DiscouragedPrivateApi") val method: Method = activityThread.getDeclaredMethod("currentProcessName")
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.autojs.autojs.rhino
|
||||
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import com.android.dx.command.dexer.Main
|
||||
import com.legacy.android.dx.command.dexer.Main as LegacyMain
|
||||
import dalvik.system.DexClassLoader
|
||||
import net.lingala.zip4j.ZipFile
|
||||
import net.lingala.zip4j.exception.ZipException
|
||||
@@ -156,11 +158,19 @@ class AndroidClassLoader(private val parent: ClassLoader, private val cacheDir:
|
||||
@Throws(IOException::class)
|
||||
private fun dexJar(classFile: File, dexFile: File?): DexClassLoader {
|
||||
val niceDexFile = dexFile ?: generateTempFile("dex-" + classFile.path, true)
|
||||
Main.Arguments().apply {
|
||||
fileNames = arrayOf(classFile.path)
|
||||
outName = niceDexFile.path
|
||||
jarOutput = true
|
||||
Main.run(this)
|
||||
when (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
true -> Main.Arguments().apply {
|
||||
fileNames = arrayOf(classFile.path)
|
||||
outName = niceDexFile.path
|
||||
jarOutput = true
|
||||
Main.run(this)
|
||||
}
|
||||
else -> LegacyMain.Arguments().apply {
|
||||
fileNames = arrayOf(classFile.path)
|
||||
outName = niceDexFile.path
|
||||
jarOutput = true
|
||||
LegacyMain.run(this)
|
||||
}
|
||||
}
|
||||
val loader = loadDex(niceDexFile)
|
||||
if (dexFile == null) /* is temporary file generated */ {
|
||||
|
||||
@@ -883,7 +883,7 @@ object RhinoUtils {
|
||||
override fun toString(): String = "function ${funcName ?: ""}() { ... }"
|
||||
|
||||
override fun getDefaultValue(typeHint: Class<*>?) = when (typeHint) {
|
||||
org.mozilla.javascript.ScriptRuntime.StringClass -> toString()
|
||||
RhinoScriptRuntime.StringClass -> toString()
|
||||
else -> this
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user