简体   繁体   中英

Flutter web create issue in existing flutter app

I already have the flutter app, now I am adding support to flutter Web following this doc. I am getting the error on flutter create.

Ambiguous organization in existing files: {com.app.android.fluttermodule,com.app.android.flutterModule}. The --org command line argument must be
specified to recreate project.

I have mentioned pubsec.yml

  module:
    androidPackage: com.app.android.fluttermodule
    iosBundleIdentifier: com.app.android.flutterModule

你可以使用这个命令

flutter create --org package_name .

You can add the app to the existing flutter project as well. Here are some steps that I followed

1: Create a new branch to not mess things up in existing branch if you are starting with flutter web for the first time.

2: flutter channel master

3: flutter config --enable-web : Now you may or may not see the new Dart SDK being downloaded.

4: flutter create --org package_name . : This will add the web files in your project.

5: flutter devices : You must see chrome listed now.

6: flutter run -d chrome : If you see something like project not configured for the web then try step 3 again and reopen your editor.

您只需添加以下行

flutter create --org FLUTTER_APP .

Ambiguous organization in existing files: {com.app.android.fluttermodule,com.app.android.flutterModule}. The --org command line argument must be specified to recreate project.

It means there's different package names.

com.app.android.fluttermodule
com.app.android.flutterModule

One or some of your names contain lowercase m in ..android.fluttermodule and some uppercase M. Rename all to be the same and run flutter create . again.

this worked for me. you need to specify output directory too. for the same flutterapp directory, use ./ hope this helps u :)

flutter create --org flutterappname ./

It means there's different package names so search about to different names and replac

我遇到这个问题是因为从现有的 flutter Android 和 iOS 代码库创建了 flutter web 应用程序,因为这种结构不支持 flutter web ......我们必须为 web 创建一个新的 flutter 项目

we don't have to create a new project, we just need to pass the specific organization name.

 e.g: flutter create --org <<domain_keyword>> .

this happens because, during new project creation, we leave the domain as IDE suggested. which is "com.example.project_name" and during sign application, we need to change the domain and almost everyone change it.

Here is what I did for an existing project.

Step 1: Create a new folder named web_project or something in the existing project folder.

Step 2: Go to this folder in the terminal

Step 3: Run flutter create --platforms web --org com.example.flutter .

This step will create a new flutter project with a web folder in it

Step 4: Cut and paste the web folder in your existing project folder and delete the new project which in my case was web_project

Step 5: Run the project and you will see Chrome as a device in the devices menu

FYI: This is done on Flutter 2.2.0

Hope this will help you to add web support to your flutter project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM