Problem -> Polymer Client with Cordova and PhoneGap

Good Morning,

I am following the video that is in the documentation with which we are taught to create an app with Polymer, Cordova and PhoneGap and I have a small problem. (https://www.cuba-platform.com/webinars/creating-hybrid-mobile-application)

I’m following all the steps, I created the emulator in Android Studio, I have everything installed, however, when I give the command “cordova emulate android”, I get a message that I have taken the emulator I want (since I have only one), but then it gives an error (attached screenshot).

image

Can anybody help me?

Thank you very much,
Greetings.

Hi,

Did you set environment variables (JAVA_HOME, ANDROID_HOME)?https://cordova.apache.org/docs/en/latest/guide/platforms/android/#setting-environment-variables

Hello,

Yes, it seems that now it works, so it should not have any problem in that aspect. Now I have another small problem, and that is that the project that is used in the tutorial if launched with Cuba works great, you put username and password and it works perfectly.

Now, all the same in the Android emulator tells you that the login is incorrect, and are the same credentials.

Any suggestions?

Thank you,
Greetings.

Yes, when running as a mobile app it should be given an absolute server URL, so as a quick solution you can specify server address here


(e.g. http://192.169.0.1:8080/app/rest/)
Usually it’s done in a more complex build process and not included in this sample.

Hello,

Thanks for the answer, in my case I am adding “http: // localhost: XXXX / app-front /” and it still does not work, I’ve also tried with “/ app / rest /” and nothing, something else I should do?

Regards,
Jordi

localhost will not work, you should specify an ip address in your local network

Hi,

With 127.0.0.1:XXXX/app-front/ ??

Regards.

Nope, since device/emulator is another entity in network it will not work. You should figure out ip address of your machine in your local network.

Hello,

It’s weird, I have in Cuba the app displayed in localhost, until then I understand that everything is fine. However, I just made an “ipconfig” on my machine, I pick up the IP and I put it as it is there and still does not work. The back side, “app / rest /” is mandatory? Or simplementa was an example and in my case is “/ app-front /” ??

Thank you,
Greetings.

The address should look like http://192.168.0.1:8080/app/rest/ (where 192.168.0.1 should be replaced by address from ipconfig)

Hi,

I’m sorry to bother you so long but it still does not work. I am testing with several options:

  • http: // myIP: 8080 / app / rest /
  • http: // myIP: 8080 / app-front /
  • http: // myIP: 8094 / app / rest /
  • http: // myIP: 8094 / app-front /

Port 8094 is where I have the application deployed in Cuba, and it keeps giving me login error every time I try it from the emulator. I do not know what else I should do.

Regards,
Jordi

Please open the following URL in your browser, it should print ok
http://yourIp:8094/app/rest/health

Hi,

Yes, that’s right.

Regards.

Ok then the address http://yourIp:8094/app/rest/ should work.
If it doesn’t work - please try to attach Chrome dev tools remote debugger (https://developers.google.com/web/tools/chrome-devtools/remote-debugging/) and see if there any errors in js console.

Hello,

With the Android Studio emulator it still does not work. I have connected my smartphone as you have mentioned and I am seeing the app on my mobile, however, my intention was to use the emulator, but if there is no other option I should throw it there.

Thank you,
Greetings.

Hello,

Now another small problem. I have tried the app on the mobile with developer options as if it were a web site and everything was fine. But when I have uploaded the app to my PhoneGap space (end of the tutorial), I downloaded it and my screen remains blank, why does this happen?

Regards,
Jordi