nparashuram / cordova-plugin-browsersync

BrowserSync Plugin for Cordova
110 stars 69 forks source link

Error: gap_init:2 #8

Open jgluhov opened 8 years ago

jgluhov commented 8 years ago

This alert has shown up to me after reloading app or update data and browser-sync update my page what should I do to remove it 2015-11-18 17-44-22 iphone 6 - iphone 6 ios 9 1 13b137

axemclion commented 8 years ago

Looks like cordova.js is not loaded properly. Can you give me a little more detail on how you got to this error ?

jgluhov commented 8 years ago

Parashuram i run command cordova run ios -- --live-reload --ignore=lib//. see Iphone 6 and when I change any data in www after update I saw this error. I can give you my project

On Wed, Nov 18, 2015 at 7:07 PM, Parashuram N notifications@github.com wrote:

Looks like cordova.js is not loaded properly. Can you give me a little more detail on how you got to this error ?

— Reply to this email directly or view it on GitHub https://github.com/nparashuram/cordova-plugin-browsersync/issues/8#issuecomment-157761836 .

axemclion commented 8 years ago

Could be an error here - https://github.com/nparashuram/cordova-plugin-browsersync/blob/master/lib/pluginHook.js#L34

Basically, when you update any file, cordova prepare run again. Looks like this is messing up the built project.

jgluhov commented 8 years ago

I enter this "cordova build" command before "cordova run ios -- --live-reload --ignore=lib//." and nothing has changed...

On Wed, Nov 18, 2015 at 7:24 PM, Parashuram N notifications@github.com wrote:

Could be an error here - https://github.com/nparashuram/cordova-plugin-browsersync/blob/master/lib/pluginHook.js#L34

Basically, when you update any file, cordova prepare run again. Looks like this is messing up the built project.

— Reply to this email directly or view it on GitHub https://github.com/nparashuram/cordova-plugin-browsersync/issues/8#issuecomment-157767142 .

jgluhov commented 8 years ago

After make some changes in console I see several Browsers Reloading 3-4 ... ? Is it right ?

On Wed, Nov 18, 2015 at 7:24 PM, Parashuram N notifications@github.com wrote:

Could be an error here - https://github.com/nparashuram/cordova-plugin-browsersync/blob/master/lib/pluginHook.js#L34

Basically, when you update any file, cordova prepare run again. Looks like this is messing up the built project.

— Reply to this email directly or view it on GitHub https://github.com/nparashuram/cordova-plugin-browsersync/issues/8#issuecomment-157767142 .

axemclion commented 8 years ago

@jgluhov Has this problem been fixed ? Are you still having this issue ?

jgluhov commented 8 years ago

Yes I have.

On Wed, Dec 9, 2015 at 6:00 PM, Parashuram N notifications@github.com wrote:

@jgluhov https://github.com/jgluhov Has this problem been fixed ? Are you still having this issue ?

— Reply to this email directly or view it on GitHub https://github.com/nparashuram/cordova-plugin-browsersync/issues/8#issuecomment-163281586 .

axemclion commented 8 years ago

@jgluhov Sorry, did not understand your reply. Did you mean that you are still having this issue, or that you have solved the problem ?

jgluhov commented 8 years ago

Hey I've recorded a video for you.

On Wed, Dec 9, 2015 at 10:23 PM, Parashuram N notifications@github.com wrote:

@jgluhov https://github.com/jgluhov Sorry, did not understand your reply. Did you mean that you are still having this issue, or that you have solved the problem ?

— Reply to this email directly or view it on GitHub https://github.com/nparashuram/cordova-plugin-browsersync/issues/8#issuecomment-163364145 .

axemclion commented 8 years ago

@jgluhov Did you mean to share the video in your comment? I don't seem to see the video in this issue.

jgluhov commented 8 years ago

---------- Forwarded message ---------- From: EVGENY GLUKHOV jgluhov@gmail.com Date: Mon, Dec 14, 2015 at 11:07 AM Subject: Re: [cordova-plugin-browsersync] Error: gap_init:2 (#8) To: nparashuram/cordova-plugin-browsersync < reply@reply.github.com

Hey I've recorded a video for you.

On Wed, Dec 9, 2015 at 10:23 PM, Parashuram N notifications@github.com wrote:

@jgluhov https://github.com/jgluhov Sorry, did not understand your reply. Did you mean that you are still having this issue, or that you have solved the problem ?

— Reply to this email directly or view it on GitHub https://github.com/nparashuram/cordova-plugin-browsersync/issues/8#issuecomment-163364145 .

axemclion commented 8 years ago

@jgluhov Looks like there could be a problem when you are replying via email client. I am still not able to see the video.

jgluhov commented 8 years ago

How can I send you a video file ?

On Tue, Dec 22, 2015 at 2:37 AM, Parashuram N notifications@github.com wrote:

@jgluhov https://github.com/jgluhov Looks like there could be a problem when you are replying via email client. I am still not able to see the video.

— Reply to this email directly or view it on GitHub https://github.com/nparashuram/cordova-plugin-browsersync/issues/8#issuecomment-166458773 .

axemclion commented 8 years ago

@jgluhov You could upload it to something like dropbox, or youtube and send a link ?

jgluhov commented 8 years ago

Ok I will do it

On Tue, Dec 22, 2015 at 8:08 PM, Parashuram N notifications@github.com wrote:

@jgluhov https://github.com/jgluhov You could upload it to something like dropbox, or youtube and send a link ?

— Reply to this email directly or view it on GitHub https://github.com/nparashuram/cordova-plugin-browsersync/issues/8#issuecomment-166676095 .

jgluhov commented 8 years ago

https://www.dropbox.com/s/jcjh0znor6i4lkg/14%20Dec%202015%2011_04_52%20AM.m4a?dl=0

On Tue, Dec 22, 2015 at 8:08 PM, Parashuram N notifications@github.com wrote:

@jgluhov https://github.com/jgluhov You could upload it to something like dropbox, or youtube and send a link ?

— Reply to this email directly or view it on GitHub https://github.com/nparashuram/cordova-plugin-browsersync/issues/8#issuecomment-166676095 .

jgluhov commented 8 years ago

:) It's audio)) Just a moment I will make a video)

On Wed, Dec 23, 2015 at 11:36 AM, EVGENY GLUKHOV jgluhov@gmail.com wrote:

https://www.dropbox.com/s/jcjh0znor6i4lkg/14%20Dec%202015%2011_04_52%20AM.m4a?dl=0

On Tue, Dec 22, 2015 at 8:08 PM, Parashuram N notifications@github.com wrote:

@jgluhov https://github.com/jgluhov You could upload it to something like dropbox, or youtube and send a link ?

— Reply to this email directly or view it on GitHub https://github.com/nparashuram/cordova-plugin-browsersync/issues/8#issuecomment-166676095 .

mnasyrov commented 8 years ago

I faced with a similar issue too when I run cordova run browser -- --livereload and opened http://localhost:3000 after that. Also I noticed in logs that the browser-sync serves android and ios assets:

[BS] Serving files from: platforms/android/assets/www
[BS] Serving files from: platforms/ios/www

Maybe the issue is related with serving incorrect platform assets?

axemclion commented 8 years ago

@mnasyrov @jgluhov I am planning to retire this project in favor of Taco-livereload. That is also based on pretty much the same code, and I am now a PM on that project. That project will also have more devs working on it, so will have much more support as an official project.

Would that fulfill your needs ? Are there anything that this project has, that taco-livereload does not have ?

rixo commented 8 years ago

Hi! Can you point to some documentation for taco-livereload? I didn't know taco, I just found about it in your comment, but it seems to me that it isn't so easy to integrate in an existing project, is it? The plugin approach of this project and the focus on the browser-sync concern is far more appealing to me.

Edit And also, there is that that I was fearing :(

TACO2114: Error: Your current platform is not supported: linux

axemclion commented 8 years ago

@rixo Oooh -- that is an ugly error. There is no reason that taco-livereload should need that. Maybe we could see if we release taco-livereload as a standalone utility instead.

Taco (stands for Tools for Apache Cordova) and has a bunch of utilities on top of Cordova - including things like a newer version of Ripple, way to install requirements, etc.

arihantdaga commented 7 years ago

Is this issue resolved ? I am still facing the same issue. Apk is built, launch is successfull. but getting an error - gap_init:2 when try to open the 192.168.0.12:8100 in my mobile browser. and app throws an error - failed to connect to server 192.168.0.12:8100

rixo commented 7 years ago

@arihantdaga As pointed in the first comment, this error is indicative that Cordova is not loaded. And indeed, it is not loaded if you access your application directly from a browser, it is only included in the mobile build. If you setup is correct, you'll have browser-sync reloading in the app itself. Launch the app from your device or emulator, and the app webview will reload when files change.

arihantdaga commented 7 years ago

@rixo , Thank you vey much rixo. Now i understand. But there is also this issue that whenever i am doing this - "ionic run android -l -c". The app which is built and launched in my mobile fails to connect to the liverload server and hence always on opening my app, it shows "Unable to conenct to the server 192.168.0.116:8100" and app crashes. Although with this error i have seen some anomalies. sometimes this error occurs, but sometimes it launches app successfully.

rixo commented 7 years ago

@arihantdaga I remember I had some difficulties passing this step too, but you're now in the right tracks. You're almost there I think; once you'll have figured the issue with the connection, it should work and it's pretty flawless browsersync then. Quite the difference in feedback loop, as compared as rebuilding the app with cordova each time!

Unfortunately, I don't remember how I solved this myself, and I don't have access to the project I was working on anymore... Check the Cordova access control policy, I think it may have been hardened on the Cordova side since this project has been written. Ensure you don't have a CORS issue too. When your app is launched, you should be able to debug its webview with chrome://inspect to gain some insight... Good luck!

clChenLiang commented 7 years ago

I also have see this affair.but not as you find that .I have place my code or project on the Node.js Server , than visit the index.html by chrome browser on my mobile phone . Then the web has popup the panel,for that gap_init:2. I think that is an error that not right load the cordova.js module.

StefansArya commented 6 years ago

Usually it happen because browser platform haven't being added cordova platform add browser You may need to remove it first if still happen..

Or.. Put this on the html header before any script.. <script type="text/javascript">window.prompt = console.prompt = function(){};</script>