MSI SDR 设备示例代码无法编译
MSI SDR device sample code does not compile
我正在尝试使用 android 应用
与 MSI SDR dongle 交互
此设备是 SDRPlay SDR 设备的克隆,并与其软件和驱动程序兼容
我正在尝试使用 OTG 数据线和 android phone
连接
可从此处下载 android 驱动程序 https://www.sdrplay.com/downloads/
它位于 API/HW 下的 Android 选项卡中 – V2.11(2017 年 11 月 15 日)link (https://www.sdrplay.com/anddl.php)
可以在此处找到此驱动程序的可能示例代码:https://www.sdrplay.com/docs/AndroidIntegrationNote.pdf
在制作完整的 android 程序之前,它说应该使用 ndk-build
将库 (libmir_sdr_api.a) 构建到 .so 库文件中
我目前从这里获得了 Android 的 hello-jni 示例项目:https://github.com/android/ndk-samples/tree/android-mk/hello-jni
我已经使用 Android.mk 文件、libmir_sdr_api.a、mir_sdr.h、初始化-jni.cpp、demod-jni.cpp 和 demod- 替换了 jni 文件夹jni.h 我在上面 link 编辑的 AndroidIntegrationNote.pdf 文件第 3 节中提到的文件
当我从 hello-jni 项目文件夹执行 ndk-build 时,出现以下错误:
Android NDK: Found platform level in ./default.properties. Setting APP_PLATFORM to android-25.
Android NDK: android-25 is an alias for android-24. Adjusting APP_PLATFORM to match.
[arm64-v8a] Gdbserver : [aarch64-linux-android] libs/arm64-v8a/gdbserver
[arm64-v8a] Gdbsetup : libs/arm64-v8a/gdb.setup
[x86_64] Gdbserver : [x86_64-linux-android] libs/x86_64/gdbserver
[x86_64] Gdbsetup : libs/x86_64/gdb.setup
[armeabi-v7a] Gdbserver : [arm-linux-androideabi] libs/armeabi-v7a/gdbserver
[armeabi-v7a] Gdbsetup : libs/armeabi-v7a/gdb.setup
[x86] Gdbserver : [i686-linux-android] libs/x86/gdbserver
[x86] Gdbsetup : libs/x86/gdb.setup
make: *** No rule to make target 'jni/initialisation-jni.cpp', needed by 'obj/local/arm64-v8a/objs-debug/mirics-jni/initialisation-jni.o'. Stop.
我习惯于使用 Android Studio 和 cmake 编译 NDK 代码,所以我不确定这里发生了什么。我也无法通过 cmake link .a 文件,所以我想尝试一下驱动程序制造商的示例代码,但它也不起作用。 pdf 文件 link 中的 Android.mk 文件是否不完整,或者我没有正确构建它?这些是 Android.mk 文件的内容:
# $(call my-dir) returns the local directory which is the jni directory
LOCAL_PATH := $(call my-dir)
# libmir_sdr_api.a – this section creates a version of the Mirics API to be used below
include $(CLEAR_VARS)
LOCAL_MODULE := mir_sdr_api-prebuilt
LOCAL_SRC_FILES := libmir_sdr_api.a
LOCAL_EXPORT_C_INCLUDES := $(call my-dir)
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# mirics-jni – this section uses the jni C++ source code to build the dynamic library
LOCAL_MODULE := mirics-jni
LOCAL_SRC_FILES := initialisation-jni.cpp demod-jni.cpp
LOCAL_C_INCLUDES := $(call my-dir)
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib
LOCAL_STATIC_LIBRARIES := mir_sdr_api-prebuilt
include $(BUILD_SHARED_LIBRARY)
关于丢失 jni/initialisation-jni.cpp
,您可能有文件 jni/initiali
zation-jni.cpp
。
此外,不幸的是,document 是错误的。您只能在文件顶部轻松使用 $(call my-dir)
。幸运的是,Android NDK 为您添加了 jni 目录以包含路径。不过,为了安全起见,最好写:
# $(call my-dir) returns the local directory which is the jni directory
LOCAL_PATH := $(call my-dir)
# libmir_sdr_api.a – this section creates a version of the Mirics API to be used below
include $(CLEAR_VARS)
LOCAL_MODULE := mir_sdr_api-prebuilt
LOCAL_SRC_FILES := libmir_sdr_api.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# mirics-jni – this section uses the jni C++ source code to build the dynamic library
LOCAL_MODULE := mirics-jni
LOCAL_SRC_FILES := initialization-jni.cpp demod-jni.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib
LOCAL_STATIC_LIBRARIES := mir_sdr_api-prebuilt
include $(BUILD_SHARED_LIBRARY)
最后,注意你的构建过程。您只有一种 libmir_sdr_api.a 静态库,它是为 32 位 ARM CPU 构建的。因此,您不能为其他架构构建 libmirics-jni.so。添加
APP_ABIS = armeabi-v7a
到您的Application.mk文件,或指定
abifilters = armeabi-v7a
在您的 build.gradle 中,如果您在 Android Studio 中构建库。
我正在尝试使用 android 应用
与 MSI SDR dongle 交互此设备是 SDRPlay SDR 设备的克隆,并与其软件和驱动程序兼容
我正在尝试使用 OTG 数据线和 android phone
连接可从此处下载 android 驱动程序 https://www.sdrplay.com/downloads/
它位于 API/HW 下的 Android 选项卡中 – V2.11(2017 年 11 月 15 日)link (https://www.sdrplay.com/anddl.php)
可以在此处找到此驱动程序的可能示例代码:https://www.sdrplay.com/docs/AndroidIntegrationNote.pdf
在制作完整的 android 程序之前,它说应该使用 ndk-build
将库 (libmir_sdr_api.a) 构建到 .so 库文件中我目前从这里获得了 Android 的 hello-jni 示例项目:https://github.com/android/ndk-samples/tree/android-mk/hello-jni
我已经使用 Android.mk 文件、libmir_sdr_api.a、mir_sdr.h、初始化-jni.cpp、demod-jni.cpp 和 demod- 替换了 jni 文件夹jni.h 我在上面 link 编辑的 AndroidIntegrationNote.pdf 文件第 3 节中提到的文件
当我从 hello-jni 项目文件夹执行 ndk-build 时,出现以下错误:
Android NDK: Found platform level in ./default.properties. Setting APP_PLATFORM to android-25.
Android NDK: android-25 is an alias for android-24. Adjusting APP_PLATFORM to match.
[arm64-v8a] Gdbserver : [aarch64-linux-android] libs/arm64-v8a/gdbserver
[arm64-v8a] Gdbsetup : libs/arm64-v8a/gdb.setup
[x86_64] Gdbserver : [x86_64-linux-android] libs/x86_64/gdbserver
[x86_64] Gdbsetup : libs/x86_64/gdb.setup
[armeabi-v7a] Gdbserver : [arm-linux-androideabi] libs/armeabi-v7a/gdbserver
[armeabi-v7a] Gdbsetup : libs/armeabi-v7a/gdb.setup
[x86] Gdbserver : [i686-linux-android] libs/x86/gdbserver
[x86] Gdbsetup : libs/x86/gdb.setup
make: *** No rule to make target 'jni/initialisation-jni.cpp', needed by 'obj/local/arm64-v8a/objs-debug/mirics-jni/initialisation-jni.o'. Stop.
我习惯于使用 Android Studio 和 cmake 编译 NDK 代码,所以我不确定这里发生了什么。我也无法通过 cmake link .a 文件,所以我想尝试一下驱动程序制造商的示例代码,但它也不起作用。 pdf 文件 link 中的 Android.mk 文件是否不完整,或者我没有正确构建它?这些是 Android.mk 文件的内容:
# $(call my-dir) returns the local directory which is the jni directory
LOCAL_PATH := $(call my-dir)
# libmir_sdr_api.a – this section creates a version of the Mirics API to be used below
include $(CLEAR_VARS)
LOCAL_MODULE := mir_sdr_api-prebuilt
LOCAL_SRC_FILES := libmir_sdr_api.a
LOCAL_EXPORT_C_INCLUDES := $(call my-dir)
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# mirics-jni – this section uses the jni C++ source code to build the dynamic library
LOCAL_MODULE := mirics-jni
LOCAL_SRC_FILES := initialisation-jni.cpp demod-jni.cpp
LOCAL_C_INCLUDES := $(call my-dir)
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib
LOCAL_STATIC_LIBRARIES := mir_sdr_api-prebuilt
include $(BUILD_SHARED_LIBRARY)
关于丢失 jni/initialisation-jni.cpp
,您可能有文件 jni/initiali
zation-jni.cpp
。
此外,不幸的是,document 是错误的。您只能在文件顶部轻松使用 $(call my-dir)
。幸运的是,Android NDK 为您添加了 jni 目录以包含路径。不过,为了安全起见,最好写:
# $(call my-dir) returns the local directory which is the jni directory
LOCAL_PATH := $(call my-dir)
# libmir_sdr_api.a – this section creates a version of the Mirics API to be used below
include $(CLEAR_VARS)
LOCAL_MODULE := mir_sdr_api-prebuilt
LOCAL_SRC_FILES := libmir_sdr_api.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
# mirics-jni – this section uses the jni C++ source code to build the dynamic library
LOCAL_MODULE := mirics-jni
LOCAL_SRC_FILES := initialization-jni.cpp demod-jni.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib
LOCAL_STATIC_LIBRARIES := mir_sdr_api-prebuilt
include $(BUILD_SHARED_LIBRARY)
最后,注意你的构建过程。您只有一种 libmir_sdr_api.a 静态库,它是为 32 位 ARM CPU 构建的。因此,您不能为其他架构构建 libmirics-jni.so。添加
APP_ABIS = armeabi-v7a
到您的Application.mk文件,或指定
abifilters = armeabi-v7a
在您的 build.gradle 中,如果您在 Android Studio 中构建库。