k2-fsa/sherpa-ncnn

windows 移植编译问题

Closed this issue · 5 comments

看了官网教程,build-android-arm64-v8a.sh 不支持windows + android studio+cmake编译,希望作者能支持一下,我这边移植发现#include "net.h" // NOLINT 这个文件还需要去下载,最终没成功

两种解决方法

  1. 用我们提供好的 .so 文件。(假装是你自己编译的)
  2. 使用 linux 或者 macos 去编译。

得到 .so 文件后,你就可以在 windows 上用 android studio 了.

两种解决方法

  1. 用我们提供好的 .so 文件。(假装是你自己编译的)
  2. 使用 linux 或者 macos 去编译。

得到 .so 文件后,你就可以在 windows 上用 android studio 了.

好滴,还有一个问题

class SherpaNcnn(
    var config: RecognizerConfig,
    assetManager: AssetManager? = null,
) {
    private val ptr: Long

    init {
        if (assetManager != null) {
            ptr = newFromAsset(assetManager, config)
        } else {
            ptr = newFromFile(config)
        }
    }
}

newFromFile() 我这边想把模型放到手机外置存储然后加载,但这个没看到具体的使用demo。看了jni源码没有发现文件读写相关的操作。

你把文件路径放在config里,替换掉assets里的路径,把assetManager设置为null,就可以啦

@Hynsn
是不是解决了?

是的。目前只能这样