ElectronJS autoupdater.setFeedURL引发异常[“更新检查失败服务器发送了无效的响应请稍后重试”]

问题描述

我正在使用电子程序在桌面应用程序上工作,除autoUpdater.setFeedURL()方法外,其他所有东西都运行良好,它始终返回以下异常:“更新检查失败。服务器发送了无效的响应。请稍后再试。 “

Java.perform(function() {
    const System = Java.use("java.lang.System");
    const Runtime = Java.use("java.lang.Runtime");
    const Systemload_2 = System.loadLibrary.overload("java.lang.String");
    const VMStack = Java.use("dalvik.system.VMStack");

    Systemload_2.implementation = function(library) {
        console.log("Loading dynamic library => " + library);
        try {
            const loaded =     Runtime.getRuntime().loadLibrary0(VMStack.getCallingClassLoader(),library);
            if(library.includes("native2")) {
// here your hook
Interceptor.attach(Module.findExportByName("libnative2.so","%s"),{
    onEnter: function(args) {
        console.log("onEnter...");
        //send (Memory.readUtf8String (args [1]));     
    },onLeave: function(args) {
        console.log("onLeave...");
    }
});


}
            return loaded;
        } catch(ex) {
            console.log(ex);
        }
    };
});

enter image description here

解决方法

是的!经过两天的头痛,我发现我只是使用了不推荐使用的autoUpdater版本,我应该使用此版本:

const { autoUpdater } = require('electron-updater');

所以我接下来要做的就是删除 setFeedURL 行,而不是 autoUpdater.checkForUpdates() 我使用了 autoUpdater.checkForUpdatesAndNotify()

if(!isDev)
{
    autoUpdater.checkForUpdatesAndNotify();
}