小编Fac*_*all的帖子

在 Flutter 应用程序中使用 Android NDK 中的 AssetManager 类

我一直在尝试在我的 Flutter 应用程序中使用 Android NDK 的AssetManager类(它与Google Oboe配合使用)来访问音频文件。按照Oboe 存储库中的这个示例,我了解到他们是AssetManager这样从 Java 获取的:

JNIEXPORT void JNICALL
Java_com_google_oboe_sample_rhythmgame_MainActivity_native_1onStart(JNIEnv *env, jobject instance,
                                                                     jobject jAssetManager) {

    AAssetManager *assetManager = AAssetManager_fromJava(env, jAssetManager);
    if (assetManager == nullptr) {
        LOGE("Could not obtain the AAssetManager");
        return;
    }

    game = std::make_unique<Game>(*assetManager);
    game->start();
}
Run Code Online (Sandbox Code Playgroud)

基本上,它们通过 JNI 接口将参数jAssetManager从 Java 传递到 C++ 函数。现在我不使用 JNI,因为我使用 Flutter 和 Dart,Dart 中与 C++ 函数通信的方式是通过dart:ffi,但由于我可以创建的唯一方法AssetManager是 with AAssetManager_fromJava(env, jAssetManager),所以我需要这两个参数我找不到用 Flutter 和 Dart 替代的方法。

我做了一些研究,当我创建 Flutter FFI …

c++ android-ndk flutter oboe dart-ffi

5
推荐指数
1
解决办法
1366
查看次数

使用 dart::ffi 从 Dart 包中调试 C++ 代码

我正在用 C++ 开发一个包,用于 Flutter 应用程序(因此在 Dart 中),使用dart::ffi我想知道是否有更好的调试方法(逐步,变量监视,诸如此类的事情) C++ 代码,而不是记录消息。我在 Android Studio 和 VS Code 中都尝试过,但没有成功。

c++ debugging dart flutter dart-ffi

2
推荐指数
1
解决办法
665
查看次数

标签 统计

c++ ×2

dart-ffi ×2

flutter ×2

android-ndk ×1

dart ×1

debugging ×1

oboe ×1