首页 > 解决方案 > Flutter 项目:错误(主要与 Android Manifest 和 Main Activity 文件有关)

问题描述

Sooo,我有几个我无法修复的错误,这会很烦人,因为我尝试了很多东西,我将我的颤振降级到稳定版本,现在我在颤振医生中看到了 tis:

C:\Users\wdowk>flutter doctor -v
[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.18363.1379], locale pl-PL)
    • Flutter version 1.22.6 at C:\src\flutter
    • Framework revision 9b2d32b605 (5 weeks ago), 2021-01-22 14:36:39 -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\wdowk\AppData\Local\Android\Sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: F:\Program Files\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[!] Android Studio (version 4.1.0)
    • Android Studio at F:\Program Files\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

但我在我的 Android Studio 中添加了插件:Flutter 和 Dart。

关于我的项目中的错误,现在看起来像这样:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="polacoenchile.world_time_app2"
    android:versionCode="1"
    android:versionName="1.1">
    <uses-sdk android:minSdkVersion="28"
        android:targetSdkVersion="30"
        android:maxSdkVersion="30" />
   <application
        android:label="world_time_app2"
        android:icon="@mipmap/ic_launcher"
        android:theme="@style/LaunchTheme">

        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>
package polacoenchile.world_time_app2

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}

错误屏幕 我所有错误的屏幕截图

当我尝试构建一个apk时,在flutter clean之后,我看到:

Running "flutter pub get" in world_time_app2...                     0,5s
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JetifyTransform: C:\Users\wdowk\AndroidStudioProjects\world_time_app2\build\app\intermediates\flutter\debug\libs.jar.
         > Transform's input file does not exist: C:\Users\wdowk\AndroidStudioProjects\world_time_app2\build\app\intermediates\flutter\debug\libs.jar. (See https://issuetracker.google.com/issues/158753935)

* 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 29s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                      30,4s
Gradle task assembleRelease failed with exit code 1

屏幕截图 和oridmanifest

主要活动

有任何想法吗?

标签: javaandroidflutterandroid-studio

解决方案


推荐阅读