flutter. 1.9 如何创建iOS的oc项目 androd的java项目

在升级flutter1.9+之后,flutter默认的iOS项目为swift,Android的默认项目为kotlin,而且通过IDEA创建的flutter项目,即使勾选了语言为oc,但是创建后的项目仍然是swift,颇为头疼.

那么我们修改创建项目项目的语言呢,

首先查看flutter create 支持哪些sub commands

复制代码
 ~/Desktop/testcode/ flutter create
No option specified for the output directory.
Create a new Flutter project.

If run on a project that already exists, this will repair the project,
recreating any files that are missing.

Usage: flutter create <output directory>
-h, --help                     Print this usage information.
    --[no-]pub                 Whether to run "flutter pub get" after the
                               project has been created.
                               (defaults to on)

    --[no-]offline             When "flutter pub get" is run by the create
                               command, this indicates whether to run it in
                               offline mode or not. In offline mode, it will
                               need to have all dependencies already available
                               in the pub cache to succeed.

    --[no-]with-driver-test    Also add a flutter_driver dependency and generate
                               a sample 'flutter drive' test.

-t, --template=<type>          Specify the type of project to create.

          [app]                (default) Generate a Flutter application.
          [package]            Generate a shareable Flutter project containing
                               modular Dart code.
          [plugin]             Generate a shareable Flutter project containing
                               an API in Dart code with a platform-specific
                               implementation for Android, for iOS code, or for
                               both.

-s, --sample=<id>              Specifies the Flutter code sample to use as the
                               main.dart for an application. Implies
                               --template=app. The value should be the sample ID
                               of the desired sample from the API documentation
                               website (http://docs.flutter.dev). An example can
                               be found at
                               https://master-api.flutter.dev/flutter/widgets/Si
                               ngleChildScrollView-class.html

    --list-samples=<path>      Specifies a JSON output file for a listing of
                               Flutter code samples that can created with
                               --sample.

    --[no-]overwrite           When performing operations, overwrite existing
                               files.

    --description              The description to use for your new Flutter
                               project. This string ends up in the pubspec.yaml
                               file.
                               (defaults to "A new Flutter project.")

    --org                      The organization responsible for your new Flutter
                               project, in reverse domain name notation. This
                               string is used in Java package names and as
                               prefix in the iOS bundle identifier.
                               (defaults to "com.example")

    --project-name             The project name for this new Flutter project.
                               This must be a valid dart package name.

-i, --ios-language             [objc, swift (default)]
-a, --android-language         [java, kotlin (default)]
    --[no-]androidx            Generate a project using the AndroidX support
                               libraries

Run "flutter help" to see global options.
复制代码

在创建项目时,比如我们想修改iOS的语言为oc,那么执行以下命令:

flutter create -i objc  flutteroc

 

 

posted on   高彰  阅读(800)  评论(0编辑  收藏  举报

编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示