问题描述
我想使用自定义android.bluetooth而不是在android SDK随附的android.jar中预先安装.我将android.bluetooth编译为单独的jar文件,并导入了Studio apk项目.将其作为模块后,Studio可以解析我在BluetoothAdapter.java中添加的自定义API.但是在编译时,我遇到方法未找到错误,因为找不到符号方法xxx"
I wanted to use custom android.bluetooth instead of which presend in android.jar which comes with android SDK. I compiled android.bluetooth into seperate jar file and imported into studio apk project. After making it as a module, Studio is able to resolve my custom APIs added in BluetoothAdapter.java.But while compiling i am getting method not found error, as "cannot find symbol method xxx"
我尝试了,以编辑gradle文件以更改顺序并添加Xbootpath.但是仍然失败.非常感谢您的帮助.
I tried steps mentioned in here, to edit gradle files to change the order and adding Xbootpath. But still fails. Any help is much appreciated.
推荐答案
bootclasspath
参数必须是绝对路径.因此,您应该像这样修改build.gradle:
The bootclasspath
parameter must be an absolute path. So, you should modify build.gradle like this:
def androidJar = file('android.jar') // obtain you jar file
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs.add("-Xbootclasspath/p:$androidJar") // file.toString() is absolute path.
}
}
}
这篇关于使用自定义android.bluetooth.而不是android studio中默认sdk android.jar中的一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!