Android cordova build Access-Control-Allow-Origin error

I am trying to run my app in Android Cordova, using this command:

meteor run android-device --settings settings-production.json --mobile-server domain.com

I am getting this error:

I20160325-14:35:25.865(-7) (android:http://localhost:12728/login:0) XMLHttpRequest cannot load http://domain.com/sockjs/info?cb=otxt3hu1g4. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:12728' is therefore not allowed access.

Also am getting:
I20160325-15:06:52.228(-7) (android:http://localhost:12728/packages/meteor.js:943) Error syncing to server time: I20160325-15:06:52.228(-7) (android:http://localhost:12728/packages/meteor.js:941) Max number of time sync attempts reached. Giving up.

I’ve tried a number of things, without success:

  1. Added App.accessRule("*"); to mobile-config.js
  2. Added the browser policy package and BrowserPolicy.content.allowOriginForAll(); in the server code
  3. Cleared out the .meteor/local folder
  4. Set ROOT_URL to https://domain.com in settings-production.json

I have seen a lot of posts created around this topic, but none of the solutions seem to be working for me. I’m on Meteor 1.3-rc.8.

3 Likes

This suddenly started happening today to me.
Did you ever find an answer?