Search code examples
androiddebuggingflutterapk

Is there any difference in the app operation between release and debug versions?


I'm having a strange problem with my application. I made a very simple app to request car parts for a garage. The user (the garage's automobile mechanics) put the parts that he need in the app and a computer (that is in another part of the garage) receives the order and prints directly to a thermal printer. I send the data via an HTTP post, very simple, I just send the JSON to an HTTP address.

The problem is: when I run the debug version (via "flutter run" command on vscode) it runs perfectly, but when I generate the apk (via "flutter build apk") the app runs but it doesn't send the HTTP post (there are no error messages, the app just don't send and stays in the same screen forever). I have tested different devices, they all worked normally with the debug version, created and installed directly from vscode, and didn't work with the release app.

Why does it happen? Since the debug and the release apk have the same code shouldn't work the same way? Is there any way to see a log (some kind of debug, I don't know) running the release version?


Solution

  • This issue is most likely related to the permissions. Please check if your AndroidManifest.xml file in Android > app > src > main directory has the following permission:

    <uses-permission android:name="android.permission.INTERNET"/>
    

    If the permission isn't present, add it above the line that starts with <application:

    <uses-permission android:name="android.permission.INTERNET"/> // Add here
    <application
        android:name="io.flutter.app.FlutterApplication"