My app doesn´t work, in other words, doesn't launch in my smartphone

My first project with Flutter and Visual Code.

I can’t run my app. I don’t get an error but my app doesn’t launch in my Smartphone(Samsung J500). What am i doing wrong?

Hi, it is really difficult to try guessing what could be wrong in your app, with the information you (don’t) give in your post. We could try to help but more context is needed. And possibly some or all your code to read. Let me suggest this recent post of mine to help you with writing help request : How to Write a Successful Post asking for Help. It is generic but has some good starting point to keep in mind. After that you could try to give us some more details. Maybe we can have a chance to see where your problem is. HTH

Thanks, @patrick_dm. I created a new project and the IDE generated the code and i tried to launch in my Smartphone. I didn’t create any code only code generated for flutter. I saw in the right bottom this message(new notifications)

Cannot launch without an active device. How can i solve this?

You need an active device to launch your app on. This can be a physical device connected with an USB cable or a running instance of the Android emulator.
See this stack overflow thread for an extended discussion:

https://stackoverflow.com/questions/49045393/flutter-run-no-connected-devices#:~:text=Set%20up%20the%20Android%20emulator,device%20definition%20and%20select%20Next.

Errors remain. This is my configuration code:
{

    // Use IntelliSense to learn about possible attributes.

    // Hover to view descriptions of existing attributes.

    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387

    "version": "0.2.0",

    "configurations": [

        {

            "name": "Flutter",

            "type": "dart",

            "request": "launch",

            "program": "lib/main.dart"

        },

        {

            "name": "Flutter: Attach to Device",

            "type": "dart",

            "request": "attach"

        },

        {

            "name": "Dart",

            "type": "dart",

            "request": "launch",

            "program": "bin/main.dart"

        },

        {

            "name": "Dart",

            "type": "dart",

            "request": "launch",

            "program": "bin/main.dart"

        },

        {

            "name": "Flutter",

            "request": "launch",

            "type": "dart"

        }

    ]

}

I tried this:
I updated gradle file from 5.6.2 to 6.5 version but when i run my app change to 5.6.2-all again. This error continue

BUILD FAILED in 4m 58s

Exception: Gradle task assembleDebug failed with exit code 1

Exited (sigterm)

I can’t to do my app to work fine.

This is complete error. How can i update my licenses?

Launching lib\main.dart on SM J500M in debug mode…
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\Amanda e Marcelo\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in C:\Users\Amanda e Marcelo\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.

Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

Using Android SDK: C:\Users\Amanda e Marcelo\AppData\Local\Android\sdk

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 32s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

I’m not sure if this will work, but to accept licenses you could try running:

flutter doctor --android-licenses

I’ve also seen an old post (here) where for a user the following command has worked instead:

Run <YOUR_SDK_LOCATION>\tools\bin\sdkmanager --licenses

Hope this helps.

@patrick_dm, your approach worked well, but the launch is very time-consuming from 5 to 7 minutes to launch on my smartphone. It’s a long time.

Thank you.

I’m glad you could solve the problem and get to build and launch the app in your device. Compilation time depends on your hardware (I use an old Mac and it always takes long time to build) but also on the dependencies you are including. You could check how long does the default Flutter project (the counter) takes to build and launch. Anyway I have no solution to make it faster (apart from getting myself a faster computer!)

try debugging your actual phone device

Initial run might take 5-7 minutes and most probably due to network, most probably you’re not in US but somewhere overseas. Once the app you’re developing is installed on your phone next time you run should not take that long.

1 Like