首先,我将全局minSdkVersion变量的值从源代码中修改为19,以便所有项目(旧的和新的)都使用它。
其次,我添加了flutter firebase插件,并成功运行了flutter。
最后,当我查看seedebug控制台时,在vscode中出现了错误。我不知道如何解决它。
D:\flutter_application_3_vs\android\app\src\main\java\io\flutter\app\FlutterMultiDexApplication.java:12: ����: �����androidx.multidex������
import androidx.multidex.MultiDex;
^
D:\flutter_application_3_vs\android\app\src\main\java\io\flutter\app\FlutterMultiDexApplication.java:22: ����: �Ҳ�������
MultiDex.install(this);
^
����: ���� MultiDex
�: �� FlutterMultiDexApplication
2 ������
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
这是Flutter中的命令,用于检查Flutter和相关依赖项的版本及其是否正确安装。它还会在默认情况下编译您的Flutter应用程序,并使用Javac编译器对Java代码进行编译。
[√] Flutter (Channel stable, 3.0.0, on Microsoft Windows [版本 10.0.19044.1645], locale zh-Hans-HK)
• Flutter version 3.0.0 at D:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ee4e09cce0 (2 days ago), 2022-05-09 16:45:18 -0700
• Engine revision d1b9a6938a
• Dart version 2.17.0
• DevTools version 2.12.2
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at D:\SDK
• Platform android-32, build-tools 32.0.0
• ANDROID_HOME = D:\SDK
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
[√] Connected device (3 available)
• Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.19044.1645]
• Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.39
[√] HTTP Host Availability
• All required HTTP hosts are available
我的app/build.gradle
android {
compileSdkVersion flutter.compileSdkVersion
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_application_3_vs"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
我在 app/build.gradle 文件中添加了这个内容,但是没有生效。
buildToolVersion "23.0.1"
在使用 vscode 设置此项目之前,已经设置了 java_home。
环境变量 java_home。
JAVA_HOME17:
D:\JDK\java\jdk-17.0.1