MDeLuise / plant-it

πŸͺ΄ Self-hosted, open source gardening companion app
https://plant-it.org
GNU General Public License v3.0
455 stars 17 forks source link

Cannot connect via Android APP #166

Closed CodingEmil closed 1 month ago

CodingEmil commented 1 month ago

Avoid duplicated bug reports

Description

Hello there, I tried to connect via the Android App, which is not working. I always get this error message: "Ops! Cannot connect to Server!". I can connect via the phone browser... I've tried with: http://ip:8080/ and http://ip:3000/

Local environment

docker-compose.yml:

  server:
    image: msdeluise/plant-it-server:latest
    env_file: server.env
    depends_on:
      - db
      - cache
    restart: unless-stopped
    volumes:
      - "./upload-dir:/upload-dir"
      - "./certs:/certificates"
    ports:
      - "8080:8080"
      - "3000:3000"

  db:
    image: mysql:8.0
    restart: always
    env_file: server.env
    volumes:
      - "./db:/var/lib/mysql"

  cache:
    image: redis:7.2.1
    restart: always

server.env

DB
MYSQL_HOST=db
MYSQL_PORT=3306
MYSQL_USERNAME=
MYSQL_PSW=
MYSQL_DATABASE=
MYSQL_ROOT_PASSWORD=
JWT
JWT_SECRET=
JWT_EXP=1

Server config
USERS_LIMIT=-1
UPLOAD_DIR=/upload-dir
API_PORT=8080
TREFLE_KEY=
LOG_LEVEL=DEBUG
ALLOWED_ORIGINS=*

Cache
CACHE_TTL=86400
CACHE_HOST=cache
CACHE_PORT=6379

SSL
SSL_ENABLED=false
CERTIFICATE_PATH=/certificates/
MDeLuise commented 1 month ago

Hi @CodingEmil, thanks for opening the issue.

Let me just understand better the problem: You are trying to connect from you android mobile to the server that host the service, but you cannot, right? Did you entered a server URL like http://192.168.... (local) or something else?

What it's not clear to me is that you mention that you're trying to use the android app without success, while you can connect using the phone browser. But right now the project does not provide an android app, just a webapp. So it's now clear to me the difference between the Android App you're talking about and the phone browser.

CodingEmil commented 1 month ago

Hi @MDeLuise, I used the apk from the last release. image I did enter it like you're saying http://10.0.30.222:8080, that's what's working in the browser, but not in the apk.

MDeLuise commented 1 month ago

I think you are one of the few, if not the first, using the APK instead of the web app. This is because I did not mention the APK anywhere, so nice find!

For now, I suggest using the web app instead of the APK, at least until I make an official announcement about it. The last release was the first to include the APK, and I uploaded it as part of my efforts to make the app available in the F-Droid store, so I'm conducting some preliminary tests with that file.

That said, really thanks for pointing out this issue. I believe I just have fixed it in PR #168. The next project release will include a working APK.

CodingEmil commented 1 month ago

I see, excited to test it in the next release. I'll give you feedback!

I just saw your merge request over at F-Droids Gitlab... :)

MDeLuise commented 1 month ago

I just saw your merge request over at F-Droids Gitlab... :)

Yes, the release on F-Droid seems to be almost ready. Right now, I'm just having some issues with the signing of the APK, but hopefully, I'll fix them soon πŸ˜…. That's why I suggested not using the APK file in the release yet β€” I'm still doing some tests by uploading and re-uploading the file.

github-actions[bot] commented 1 month ago

This task has been completed and will be implemented in the next project release. Thank you for your contribution!

If you have any further questions or updates regarding this task, feel free to leave a comment below.

CodingEmil commented 1 month ago

Hello @MDeLuise, the issue still persists on 0.7.0. I did check the installed app version, to confirm it's 0.7.0. I am supposed to use the 8080 port, right? Works over browser.

MDeLuise commented 1 month ago

Hi! Thanks for testing the APK app and confirming the problem still persists. Yes, the default server URL is http://<local-ip>:8080.

Could you please try using the APK app attached to the last release? The file is named app-release-test.apk. You can download it directly from this link: app-release-test.apk.

Unfortunately, I cannot test the app on a real device right now, only on an emulator, and there everything works fine.

Thank you for your assistance in testing this.

CodingEmil commented 1 month ago

Just tried it with the β€œnew” APK. Sadly, I am not even able to install the app.

MDeLuise commented 1 month ago

You're right, there was a problem with the file. I have re-uploaded it, and it should now be installable. Hopefully, this fixes the problem πŸ˜…. It's a bit of a trial and error process right now since everything works fine on the emulator.

CodingEmil commented 1 month ago

The installation worked. Sadly the connection error still persists... Could it be a timeout problem? Going through VPN which is a bit slow (in Browser works tho)

Happy to help!

CodingEmil commented 1 month ago

Happy to tell you, that the app is working now.

MDeLuise commented 1 month ago

Hi, Really happy to know that the problem is fixed! In the next project release, I'll incorporate the changes I made in the app-release-test.apk file.

Unfortunately, the first F-Droid release (app version 0.7.0) will not include these fixes, so it might not work properly. However, I will push a new release as soon as possible to address this on the F-Droid side as well.

Thank you so much for testing and providing updates. I will keep this GitHub issue monitored in the following days. If any new problems regards this arise, please feel free to add a comment here.