Device not applicable for the “main.dart” configuration ,

前端 未结 7 1324
名媛妹妹
名媛妹妹 2020-12-10 07:13

I use Android Studio as my IDE in coding Flutter. I was able to create 2 projects before this and it worked absolutely fine. I had to clone a repo from Github. The IDE said

相关标签:
7条回答
  • 2020-12-10 07:38

    Go to Tools > SDK Manager > SDK Tools and check Google USB Driver. Restart Android Studio. All this worked for me, might be helpful to someone.

    0 讨论(0)
  • 2020-12-10 07:41

    This seems to be the problem:

    [X] Android toolchain - develop for Android devices
    -> ANDROID_HOME = D:\Android\Sdk but Android SDK not found at this location.
    

    Since you said that you added the Android SDK to your D directory, you could just add D:\Android\sdk\tools and D:\Android\sdk\platform-tools to your PATH environment variable. This is how you can add it to your Path enviroment variable: https://docs.telerik.com/teststudio/features/test-runners/add-path-environment-variables

    0 讨论(0)
  • 2020-12-10 07:44

    Some SDK versions of Flutter may cause the problem of not being able to find the device or simulator.You can switch the SDK version to the stable version. I had a same problem on my Mac with the Flutter version 1.17.4, and it worked after I went back the version to 1.17.3.

    Version rollback step:

    1.Open the Flutter GitHub repository.

    2.Click 'master' button to open the switch menu. And the click 'Tags' item.

    3.Search the stable version tag(e.g. 1.17.3).

    4.Open the tag and click the commits.

    5.Copy the top commit id.

    6.Run the command 'git reset --hard $(commit id)' in the Flutter directory.

    7.Restart the Android Studio.

    0 讨论(0)
  • 2020-12-10 07:56

    It solved my problem:

    1. Make sure Flutter plugin is installed in android studio, you can install the plugin from file > setting > plugin
    2. choose flutter SDK path from File > setting> Language & Framework > flutter.

    For my case the flutter sdk path was D:/flutter

    0 讨论(0)
  • 2020-12-10 07:57

    It seems like this problem may have a lot of different symptoms, but for me to be able to run my flutter app in my android device, I had to set the android SDK in the Project Structure modal.

    You can open the Project Structure modal by right clicking on the project root folder (in the file tree) > Module Settings > Project and set the Project SDK:

    Mine is like this:

    If somehow the Project tab is disabled or in a weird state, I recommend you to close android studio, delete the project .iml file and the .idea folder, reopen the project in AS (open existing project) and set the android SDK in the project structure like I've described above. At least this is what I did and it fixed for me, so I hope this answer help someone.

    0 讨论(0)
  • 2020-12-10 07:59

    I've had the same issue and what worked for me is to re-import the project.

    File > Close Project, go to the project's directory and delete the .idea folder. Then File > Open... and re-open the project.

    Open Project Structure, you can set the project's SDK with what you have.

    After this, I was able to run main.dart with the emulator.

    0 讨论(0)
提交回复
热议问题