forked from TonyJiangWJ/AutoScriptBase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65e9d4f
commit 02d3386
Showing
9 changed files
with
282 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* @Author: TonyJiangWJ | ||
* @Date: 2020-08-04 17:30:20 | ||
* @Last Modified by: TonyJiangWJ | ||
* @Last Modified time: 2020-08-05 13:52:17 | ||
* @Description: | ||
*/ | ||
|
||
/** | ||
* 免费版的runtime.loadDex loadJar有问题,加载前需要将mDexClassLoaders清空 | ||
*/ | ||
const _resolver = () => { | ||
console.verbose('run resolver') | ||
try { | ||
let packageName = context.getPackageName() | ||
console.verbose('packageName: ' + packageName) | ||
if (packageName === 'org.autojs.autojs') { | ||
importClass(java.lang.Class) | ||
let target = org.mozilla.javascript.ContextFactory.getGlobal().getApplicationClassLoader() | ||
let clz = target.getClass() | ||
console.verbose("clz:" + clz.toString()) | ||
let field = clz.getDeclaredField("mDexClassLoaders") | ||
field.setAccessible(true) | ||
let fieldValue = field.get(target) | ||
let fieldClass = fieldValue.getClass() | ||
|
||
if (fieldClass + '' === 'class java.util.ArrayList') { | ||
fieldValue.clear() | ||
console.verbose("success") | ||
} else { | ||
console.verbose("fieldValue is not list") | ||
} | ||
} | ||
} catch (e) { | ||
let errorInfo = e + '' | ||
console.error('发生异常' + errorInfo) | ||
toastLog('请强制关闭AutoJS并重新启动') | ||
exit() | ||
} | ||
} | ||
|
||
module.exports = _resolver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.