我有一个多人宾果游戏,我制作并将其托管在Modulus上。 将项目上传到Modulus并为我的项目安装他们的MongoDB之后,多人游戏在浏览器上工作得很好,但是当我尝试meteor构建游戏并获得android .apk文件安装在我的魅族设备上时安装中止了并告诉我一个解析错误,所以我决定将整个项目导入android studio并从那里构建apk文件。 从Android Studio安装apk后,应用程序打开,但它似乎没有与Modulus托管服务器/ Modulus数据库的连接。 任何人都可以帮我指出我的错误吗? build命令是:
meteor build ../pathToBuild --server serverAdress任何帮助?
I have a multiplayer bingo game which I made and im hosting it over Modulus. After uploading the project to Modulus and installing their MongoDB for my project, the multiplayer game works good over the browser, BUT, when I tried to meteor build the game and get the android .apk file to install over my Meizu device the installation got aborted and threw me a parse error so I decided to import the whole project to android studio and build the apk file from there. After installing the apk from Android Studio the application opens up, but it seems that it has no connection to the Modulus hosting server / Modulus db. Can anyone help and point me out my mistakes which I did? the build command was:
meteor build ../pathToBuild --server serverAdressany help?
最满意答案
这通常与服务器的启动方式而不是应用程序有关,请尝试在运行要将应用程序连接到的服务器时使用与构建服务器相同的地址指定--mobile-server:
meteor --mobile-server http:/app.server:port
如果这样做或者您没有直接使用meteor命令运行应用程序,那么您可以在运行的服务器目录上设置DDP_DEFAULT_CONNECTION_URL环境变量,以避免每次运行应用程序时都必须指定它。
或者我想如果你升级到meteor 1.3并重建/部署,那么这个bug应该会消失。
关于这个帖子的更多信息,虽然它很长,还有一些其他的东西可以影响到这里,但这个方法适用于我的cordova Android应用程序。
well I solved this by hard coding the server's path inside the code
var theURL = "http://myServer"; if (process.env.NODE_ENV === "development") { // home theURL = "http://myServer"; // office //theURL = "http://192.168.10.30:3000"; } Meteor.absoluteUrl.defaultOptions.rootUrl = theURL; process.env.ROOT_URL = theURL; process.env.MOBILE_ROOT_URL = theURL; process.env.MOBILE_DDP_URL = theURL; process.env.DDP_DEFAULT_CONNECTION_URL = theURL;did the trick for me
更多推荐
发布评论