You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Android Studio创建Flutter项目失败,提示找不到androidx选项

Fix "Could not find an option named 'androidx'" Error in Flutter Project Creation

Hey there, let's get this sorted out quickly! That error pops up because the --androidx command-line option you're using (either manually or via Android Studio's template) is no longer supported in newer Flutter versions. AndroidX has been the default configuration for Flutter projects for a while now, so that parameter was removed entirely.

Here are the step-by-step fixes:

  • Upgrade your Flutter SDK (recommended)
    First, check your current Flutter version by running:

    flutter --version
    

    If it's not the latest stable release, update it with:

    flutter upgrade
    

    After upgrading, create your project without the --androidx parameter—just use:

    flutter create your_project_name
    

    AndroidX will be enabled by default automatically.

  • Adjust Android Studio's project creation settings
    If you're using Android Studio to create the project, the wizard might be stuck trying to add the outdated --androidx parameter. Go through the creation steps again, and make sure you haven't manually added this option in any advanced settings. New versions of Android Studio's Flutter plugin don't require this checkbox/parameter anymore.

  • Verify AndroidX configuration in existing projects
    If you already started a project and ran into this, check your android/gradle.properties file to ensure these lines are present:

    android.useAndroidX=true
    android.enableJetifier=true
    

    These lines enable AndroidX support and automatically migrate third-party dependencies to AndroidX, so you don't need the command-line flag at all.

  • Clean cache if issues persist
    Sometimes old cache can cause weird behavior. Run this command to clear Flutter's cache:

    flutter clean
    

    Then restart Android Studio and try creating the project again.

内容的提问来源于stack exchange,提问作者john

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:08:07