其他分享
首页 > 其他分享> > Android 11 修改libcore Cipher AS测试

Android 11 修改libcore Cipher AS测试

作者:互联网

1.从Project\out\target\common\obj\JAVA_LIBRARIES\core-oj.com.android.art.debug_intermediates 拷贝classes.jar 到Android studio lib目录

2.在Module下的build.gradle添加

dependencies {
    implementation files('libs\\classes.jar')

3、在Project下的build.gradle文件的 allprojects 标签内中添加

    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs.add('-Xbootclasspath/p:app/libs/classes.jar')
        }
    }

4.Module下的build.gradle的末尾处添加,修改优先级:

preBuild {
    doLast {
        def imlFile = file(project.name + ".iml")
        println 'Change ' + project.name + '.iml order'
        try {
            def parsedXml = (new XmlParser()).parse(imlFile)
            def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
            parsedXml.component[1].remove(jdkNode)
            def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
            new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
            groovy.xml.XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
        } catch (FileNotFoundException e) {
            // nop, iml not found
        }
    }
}

5.修改Jar包优先顺序.idea/modules/app/ProjectName.iml , 把classes.jar 顺序调至原生API之上。

6.测试API调用的返回值,OK

 

 

标签:11,parsedXml,jar,iml,gradle,Cipher,Android,classes
来源: https://blog.csdn.net/SHH_1064994894/article/details/117425184