繁体   English   中英

Flutter 构建失败('无法读取 package 名称')

[英]Flutter build Failed ('Cannot read package name')

我想构建我的 flutter android 应用程序,但是当我运行“flutter build apk”时出现此错误


* What went wrong:
Execution failed for task ':generateReleaseBuildConfig'.
> Cannot read packageName from C:\Users\hp\Desktop\wooble\android\src\main\AndroidManifest.xml

* 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
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                       8,6s
Gradle task assembleRelease failed with exit code 1')

这是清单代码:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.wooble.news">

         
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="social_media_app"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity
            android:name="com.yalantis.ucrop.UCropActivity"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

有谁可以帮助我,因为清单文件中指定了 package

更改android/app/scr/build.gradle中的 applicationId

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.sometertiary.master"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

还要检查这篇文章https://stackoverflow.com/a/51550358/9398610

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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