1

如何在 Android 中访问从 Java 端调用的本机方法?我的问题与 Android Media 包中的 AudioRecord 类特别相关。我阅读了 AudioRecord.java 的源代码。我发现大部分工作都是通过本机方法执行的,例如:

native_setup(...), native_start(...), native_stop(...), native_read_in_byte_array(...), native_read_in_direct_buffer(...)

我下载了 Android 源代码,但无法使用这些方法。而且我实际上不知道如何到达他们。我在源代码目录中找到的库中寻找这些方法,但没有成功。如果有人有想法,我将不胜感激。谢谢...

4

1 回答 1

4

I think I found them. After using the Linux command

grep -r "native_read_in_direct_buffer" ./ANDROID_SOURCE/.*

I found the corresponding cpp files.

AudioRecord.cpp is located in: ~/ANDROID_SOURCE/frameworks/av/media/libmedia/ directory,

android_media_AudioRecord.cpp is located in ~/ANDROID_SOURCE/frameworks/base/core/jni directory.

I wanted to share it as a reference to other possible programmers willing to reach the same/similar source files.

于 2013-04-19T20:25:37.260 回答