参考 fshexrayng so 文件启动方法 在 debugger 情况下可以执行成功 但是 release 模式下 java.io.IOException: Cannot run program "/data/app/~~YxrgSgM30wXb9o9v_lr4zQ==/com.example.wx_reader-KkaJrsiH9Mvh6ofwIwbnDA==/lib/arm64/net.so" (in directory "/data/user/0/com.example.wx_reader/files"): error=2, No such file or directory 11-20 13:28:35.925 21619 21668 E ProxyServiceImpl: Unexpected error: net.so 是一个 golang 交叉编译得来的 image 打开 release 包 也发现打包进去了

` Log.d(TAG, "Starting Go Proxy...") val context = applicationContext // val execPath = context.getDir("libs", Context.MODE_PRIVATE).absolutePath + "/net.so" val execPath = File(context.applicationInfo.nativeLibraryDir, "net.so").absolutePath

        try {
            val proBuilder = ProcessBuilder(execPath, "-p", "4568")
            proBuilder.redirectErrorStream(true)
            process = proBuilder
                .directory(context.filesDir)
                .start()

            CoroutineScope(Dispatchers.IO).launch {
                Thread.sleep(50L)
                Log.d(TAG, "runProcess check")
                process?.waitFor()
                Log.d(TAG, "runProcess exited")
            }
            Log.d(TAG, process.toString())

        } catch (e: Exception) {
            Log.d(TAG, e.toString())
        }`
        
        请指教一下 🙏
举报· 105 次点击
登录 注册 站外分享
快来抢沙发
0 条回复  
返回顶部