我正在尝试制作一个 flutter 插件,所以我通过https://flutter.dev/docs/development/packages-and-plugins/developing-packages 上提供的步骤创建了一个插件。当我尝试运行 ios 示例时出现错误。下面是我在运行 ios 示例应用程序时得到的日志。
谁能帮我这个?
Running pod install...
CocoaPods' output:
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Fetching external sources
-> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
-> Fetching podspec for `flutter_plugin` from `.symlinks/plugins/flutter_plugin/ios`
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
A Flutter
A flutter_plugin
Downloading dependencies
-> Installing Flutter (1.0.0)
-> Installing flutter_plugin (0.0.1)
- Running pre-install hooks
[!] Unable …Run Code Online (Sandbox Code Playgroud) 我正在进行一个 Flutter 项目,我们正在使用build_runner.
我们正在使用多个构建器,并且运行它们都需要很长时间。我们的文件如下所示:
targets:
$default:
builders:
package1|builder1:
# ... options package1
package2|builder2:
# ... options package2
package3|builder3:
# ... options package3
# ... A bunch of other packages
packageN|builderN:
# ... options packageN
Run Code Online (Sandbox Code Playgroud)
现在假设我在项目中应用了一些更改,并且需要运行构建器。但我知道,只有一些构建器需要运行,而不需要运行其他构建器(比方说builder2和builder3)。
现在,当我跑步时
flutter pub run build_runner build --delete-conflicting-outputs
Run Code Online (Sandbox Code Playgroud)
它正在运行所有构建器,并且需要很长时间。
有没有办法使用命令行运行特定的构建器?
我正在 flutter 中创建一个应用程序,一切都很顺利,但此刻它开始给我一个错误。它不会让我编译,flutter pub升级和flutter pub过时不起作用,但flutter pub get如果工作正常的话。
\n我是颤振新手,我无法理解他们告诉我的大部分内容,如果您能尽可能详细地解释我,我将不胜感激
\nFlutter --no-color 构建 apk\nC:\\src\\flutter\\bin\\flutter.bat --no-color 构建 apk
\n具有良好零安全性的建筑
\nRunning Gradle task 'assembleRelease'...\n/C:/Users/LEO/AppData/Local/Pub/Cache/hosted/pub.dev/google_fonts-2.3.3/lib/src/google_fonts_base.dart:14:1: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.\nimport 'asset_manifest.dart';\n^^^^^^^^^^^^^\n/C:/Users/LEO/AppData/Local/Pub/Cache/hosted/pub.dev/google_fonts-2.3.3/lib/src/google_fonts_base.dart:32:31: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.\nAssetManifest assetManifest = AssetManifest();\n^^^^^^^^^^^^^\nTarget kernel_snapshot failed: Exception\n\nFAILURE: Build failed with an exception.\n\nWhere:\nScript 'C:\\src\\flutter\\packages\\flutter_tools\\gradle\\flutter.gradle' line: 1154\n\nWhat went wrong:\nExecution failed for task ':app:compileFlutterBuildRelease'.\n\nProcess 'command 'C:\\src\\flutter\\bin\\flutter.bat'' finished with non-zero exit value 1\n\nTry:\nRun with --stacktrace option to get the stack trace.\nRun with …Run Code Online (Sandbox Code Playgroud) 现在一周,有时当我 HotReload 我的更改没有应用(日志说它是 HotReload 但实际上他们不是)和我 HotRestart 时一样,所以我被迫停止并重新运行应用程序(和有时删除构建)!
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel beta, v1.15.17, on Microsoft Windows [version 10.0.17763.1098], locale fr-FR)
[?] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[?] Chrome - develop for the web
[?] Android Studio (version 3.6)
[?] Connected device (3 available)
• No issues found!
Run Code Online (Sandbox Code Playgroud)
我在 Android Emulator 9 Pie 上运行我的应用程序。
编辑:我试图使 AndroidStudio 的缓存无效并重新启动,并且还尝试了另一个模拟器,但它没有解决问题......
run-app flutter flutter-build flutter-hotreload flutter-compiler
当我尝试构建应用程序时,它会抛出错误 -你的项目需要更新版本的 kotlin gradle 插件。
\n [!] Your project requires a newer version of the Kotlin Gradle plugin. \xe2\x94\x82\n\xe2\x94\x82 Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, \n| then update E:\\flutter_apps\\geodata\\android\\build.gradle: \xe2\x94\x82\n\xe2\x94\x82 ext.kotlin_version = '<latest-version>'\nRun Code Online (Sandbox Code Playgroud)\n我已经升级了 android/build.gradle,如下所示。
\nbuildscript {\n ext.kotlin_version = '1.7.20'\n repositories {\n google()\n jcenter()\n }\n\n dependencies {\n classpath 'com.android.tools.build:gradle:7.1.2'\n classpath 'com.google.gms:google-services:4.3.10'\n classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"\n }\n}\n\nallprojects {\n repositories {\n google()\n jcenter()\n }\n}\n\nrootProject.buildDir = '../build'\nsubprojects {\n project.buildDir = "${rootProject.buildDir}/${project.name}"\n project.evaluationDependsOn(':app')\n}\n\ntask clean(type: Delete) {\n delete rootProject.buildDir\n}\nRun Code Online (Sandbox Code Playgroud)\n我的 android/gradle/wrapper/gradle-wrapper.properties 如下 …
我在终端命令中 flutter build appbundle 时遇到问题
编译器消息:
../../flutter/packages/flutter/lib/src/widgets/basic.dart:5149:9: Error: Type 'ui.TextHeightBehavior' not found.
final ui.TextHeightBehavior textHeightBehavior;
^^^^^^^^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/widgets/text.dart:149:9: Error: Type 'ui.TextHeightBehavior' not found.
final ui.TextHeightBehavior textHeightBehavior;
^^^^^^^^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/widgets/text.dart:432:9: Error: Type 'ui.TextHeightBehavior' not found.
final ui.TextHeightBehavior textHeightBehavior;
^^^^^^^^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/rendering/paragraph.dart:78:5: Error: Type 'ui.TextHeightBehavior' not found.
ui.TextHeightBehavior textHeightBehavior,
^^^^^^^^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/rendering/paragraph.dart:281:3: Error: Type 'ui.TextHeightBehavior' not found.
ui.TextHeightBehavior get textHeightBehavior => _textPainter.textHeightBehavior;
^^^^^^^^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/rendering/paragraph.dart:282:26: Error: Type 'ui.TextHeightBehavior' not found.
set textHeightBehavior(ui.TextHeightBehavior value) {
^^^^^^^^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/painting/text_painter.dart:145:5: Error: Type 'ui.TextHeightBehavior' not found.
ui.TextHeightBehavior textHeightBehavior,
^^^^^^^^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/painting/text_painter.dart:346:3: Error: Type …Run Code Online (Sandbox Code Playgroud) dart flutter android-app-bundle flutter-channel flutter-build
当我在显示此错误后运行flutter run或调试代码时flutter clean
注意:C:\src\flutter.pub-cache\hosted\pub.dartlang.org\firebase_core-0.7.0\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java 使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以了解详细信息。注意:C:\src\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.16.0+1\android\src\main\java\io\flutter\plugins\firebase\firestore\FlutterFirebaseFirestorePlugin.java使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以了解详细信息。注意:C:\src\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.16.0+1\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler .java 使用未经检查或不安全的操作。注意:使用 -Xlint:unchecked 重新编译以了解详细信息。注意:C:\src\flutter.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.20.1\android\src\main\java\io\flutter\plugins\firebase\auth\FlutterFirebaseAuthPlugin.java 使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以了解详细信息。注意:某些输入文件使用或覆盖已弃用的 API。
注意:使用 -Xlint:deprecation 重新编译以了解详细信息。C:\src\flutter.pub-cache\hosted\pub.dartlang.org\firebase_storage-7.0.0\android\src\main\java\io\flutter\plugins\firebase\storage\FlutterFirebaseStoragePlugin.java:38:警告: [弃用] PluginRegistry 中的注册器已弃用 public static void registerWith(PluginRegistry.Registrar registrar) { ^ 1 warning 注意:C:\src\flutter.pub-cache\hosted\pub.dartlang.org\google_api_availability-2.0.4 \android\src\main\java\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.java 使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以了解详细信息。注意:C:\src\flutter.pub-cache\hosted\pub.dartlang.org\location_permissions-2.0.5\android\src\main\java\com\baseflow\location_permissions\LocationPermissionsPlugin.java 使用或覆盖已弃用的 API 。注意:使用 -Xlint:deprecation 重新编译以了解详细信息。注意:C:\src\flutter.pub-cache\hosted\pub.dartlang.org\google_sign_in-4.5.9\android\src\main\java\io\flutter\plugins\googlesignin\GoogleSignInPlugin.java 使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以了解详细信息。注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以了解详细信息。注意:C:\src\flutter.pub-cache\hosted\pub.dartlang.org\path_provider-0.5.0+1\android\src\main\java\io\flutter\plugins\pathprovider\PathProviderPlugin.java 使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以了解详细信息。
但它只显示一次,之后它不会显示任何错误,直到我删除 build flutter clean。有什么办法可以消除这个错误吗?或者它是否会导致任何问题,因为我在我的应用程序中还没有看到任何问题。谢谢
我几乎没有找到关于这两者之间有什么区别的信息
flutter build bundle
Run Code Online (Sandbox Code Playgroud)
flutter build appbundle
Run Code Online (Sandbox Code Playgroud)
我什么时候应该使用其中一种而不是另一种?
每当我尝试使用命令测试我的应用程序时,flutter run它都非常缓慢且缓慢,并且我无法确定我的应用程序在发布模式下的性能如何。然而,为了构建 Android 应用程序,release mode我们需要为应用程序创建一个密钥,它不会显示大部分日志文件和打印。
所以问题是,有没有办法以发布模式格式运行应用程序,但具有调试功能?
我一直在为使用 的 Flutter 应用程序进行更新Firebase Firestore,一旦我完成更新并开始为 IOS 构建它,我收到以下错误消息,导致构建操作失败:
[!] CocoaPods could not find compatible versions for pod "Firebase/Auth":
In snapshot (Podfile.lock):
Firebase/Auth (= 9.3.0)
In Podfile:
firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) was resolved to 3.3.12, which depends on Firebase/Auth (= 8.14.0)
Run Code Online (Sandbox Code Playgroud)
注意:问题中的错误消息说是Firebase/Authpackage,但其他包也发生过这种情况Firebase。
那么我应该怎么做才能克服这个问题呢?
flutter-build ×10
flutter ×9
dart ×3
android ×2
ios ×2
build-runner ×1
firebase ×1
flutter-pub ×1
flutter-test ×1
gradle ×1
kotlin ×1
run-app ×1