当前位置:网站首页>Android studio import customized framework classess.jar As 4.0.1 version is valid for pro test
Android studio import customized framework classess.jar As 4.0.1 version is valid for pro test
2020-11-09 12:12:00 【osc_ydeb2o99】
occasionally , We need to call the system framework Layer hidden interface , Or some customized interfaces , So in androidstudio Without special configuration and processing , The default preference is android sdk api. Then we need to make the following configuration :
step 1: stay Moudle Under the app Add below libs Folder , And put your own jar The bag is in it .
--app
--libs
---framework.jar
step 2: stay Moudle Under the app In the catalog build.gradle Add the following red code to the file .
dependencies {
compileOnly files('libs/framework.jar')
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
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
}
}
}
In fact, the above one preBuild{...} The main thing is to default to android sdk Put it at the back , This is your own framework.jar You can give priority to .
step 3: stay project In the root directory build.gradle Add the following code under the file :
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs.add('-Xbootclasspath/p:app\\libs\\framework.jar')
}
}
repositories {
google()
jcenter()
}
}
After the above steps are set , Refresh project , recompile , There may be an error when running , Tips odex beyond 65536, Generally, you need to add the following settings .
stay Module Of app Below build.gradle Found in defaultConfi Join in multiDexEnabled = true
And in dependencies Add in
implementation 'com.android.support:multidex:1.0.0'
版权声明
本文为[osc_ydeb2o99]所创,转载请带上原文链接,感谢
边栏推荐
- iPhone“连到系统上的设备没有发挥作用”原因分析及解决方法 20200105
- Setting up a proxy for the WGet command
- Mac terminal oh my Zsh + solarized configuration
- vscode 插件配置指北
- New features of Fedora 33 workstation
- 共创爆款休闲游戏 “2020 Ohayoo游戏开发者沙龙”北京站报名开启
- Well, the four ways to query the maximum value of sliding window are good
- 分库分表的 9种分布式主键ID 生成方案,挺全乎的
- 在嵌入式设备中实现webrtc的第三种方式③
- 零基础IM开发入门(四):什么是IM系统的消息时序一致性?
猜你喜欢

Setting up a proxy for the WGet command

Interface tests how to pass files in post requests

Windows must be installed with efficiency software!

使用CopyMemory API出现 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。

On the calculation of non interaction polarizability

分库分表的 9种分布式主键ID 生成方案,挺全乎的

android studio创建平板模拟器方法

开源ERP招聘了

EFF 认为 RIAA 正在“滥用 DMCA”来关闭 YouTube-DL

AI应届生年薪涨到40万了,你现在转行还来得及!
随机推荐
20201107第16课,使用Apache服务部署静态网站;使用Vsftpd服务传输文件
Suning's practice of large scale alarm convergence and root cause location based on Knowledge Map
解决IDEA快捷键 Alt+Insert 失效的问题
10款必装软件,让Windows使用效率飞起!
Android 复选框 以及回显
Jsliang job series - 08 - handwritten promise
Program life: from Internet addicts to Microsoft, bat and byte offer harvesters
An attempt to read or write to protected memory occurred using the CopyMemory API. This usually indicates that other memory is corrupted.
JVM学习(五) -执行子系统
配置交换机Trunk接口流量本地优先转发(集群/堆叠)
List of wechat video Number broadcasters October 2020
未来中国电信将把云计算服务打造成为中国电信的主业
Android NDK 开发实战 - 微信公众号二维码检测
SQL语句实现水仙花数求取
块级元素和行内元素
Wealth and freedom? Ant financial services suspended listing, valuation or decline after regulation
技美那么贵,不如找顾问 | AALab企业顾问业务
iPhone“连到系统上的设备没有发挥作用”原因分析及解决方法 20200105
Handwriting Koa.js Source code
Tidb x micro banking reduces time consumption by 58%, and distributed architecture helps to realize inclusive finance