无法确定任务“:app:processDebugManifest”的依赖关系(FLUTTER)

问题描述 投票:0回答:1

运行我的 flutter 应用程序时出现此错误。

`失败:构建失败并出现异常。

  • 出了什么问题: 无法确定任务“:app:processDebugManifest”的依赖关系。

无法创建任务“:app:processDebugMainManifest”。 无法调用“Object.toString()”,因为“value”为 null

  • 尝试:

使用 --stacktrace 选项运行以获取堆栈跟踪。 使用 --info 或 --debug 选项运行以获得更多日志输出。 使用 --scan 运行以获得完整的见解。`

我尝试了

flutter clean
flutter pub cache clean
但没有成功。我还将compileSdkVersion更新为34,并且我使用的是7.6.2-all的gradle版本。请问我该如何解决这个问题。我在网上尝试了很多答案,但仍然不适合我。

下面是一些屏幕截图和 flutter doctor 输出,以提供更多背景信息

[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.22631.3880], locale en-GH)
    • Flutter version 3.22.2 on channel stable at C:\Users\d.partey\Documents\Development\flutter sdks\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (7 weeks ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\d.partey\AppData\Local\Android\sdk
    • Platform android-VanillaIceCream, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2024.1)
    • 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 17.0.11+0--11852314)

[√] VS Code (version 1.91.1)
    • VS Code at C:\Users\d.partey\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.92.0

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 14 (API 34) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.22631.3880]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 126.0.6478.182
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 126.0.2592.113

[√] Network resources
    • All expected network resources are available.

以下是我的清单

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="world.opine.app">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.LOCATION" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <uses-sdk
        android:minSdkVersion="23"
        android:targetSdkVersion="34" />

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="https" />
        </intent>
        <intent>
            <action android:name="android.intent.action.DIAL" />
            <data android:scheme="tel" />
        </intent>
        <intent>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="*/*" />
        </intent>
    </queries>

    <application
        android:icon="@mipmap/ic_launcher"
        android:label="Opine World"
        tools:replace="android:label">
        <activity
            android:name="io.flutter.embedding.android.FlutterActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
            android:exported="true"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:showWhenLocked="true"
            android:theme="@style/LaunchTheme"
            android:turnScreenOn="true"
            android:windowSoftInputMode="adjustResize">
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <meta-data
                android:name="flutter_deeplinking_enabled"
                android:value="true" />

            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="opine.world"
                    android:scheme="http" />
                <data android:scheme="https" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="opine.world"
                    android:scheme="opine" />
            </intent-filter>

        </activity>
        <activity
            android:name=".EmbeddingV1Activity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
            android:hardwareAccelerated="true"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize"></activity>

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="${geoApiKEY}" />

        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_channel_id"
            android:value="high_importance_channel" />
    </application>
</manifest>

android/build.gradle

buildscript {
     ext.kotlin_version = '2.0.0'
     ext.ndkVersion = "20.1.5948944"
     ext {
       compileSdkVersion   = 34                // or latest
       targetSdkVersion    = 34                // or latest
       appCompatVersion    = "1.7.0"           // or latest
    }

    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
        // START: FlutterFire Configuration
        classpath 'com.google.gms:google-services:4.4.2'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
        // END: FlutterFire Configuration
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
         maven {
            // [required] background_fetch
            url "${project(':background_fetch').projectDir}/libs"
        }
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

// subprojects {
//     project.configurations.all {
//  resolutionStrategy.eachDependency { details ->
//             if (details.requested.group == 'androidx.core' &&
//         !details.requested.name.contains('androidx')) {
//      details.useVersion "1.0.1"
//             }
//  }
//     }

// }

// subprojects {
//   afterEvaluate { subproject ->
//     if (subproject.hasProperty("android")) {
//       android {
//         compileSdkVersion 27
//         buildToolsVersion '27.0.3'
//       }
//     }
//   }
// }

应用程序/build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    throw GradleException("versionCode not found. Define flutter.versionCode in the local.properties file.")
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    throw GradleException("versionName not found. Define flutter.versionName in the local.properties file.")
}


apply plugin: 'com.android.application'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
// END: FlutterFire Configuration
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def geoApiKEY = localProperties.getProperty('geo.apiKEY')

apply plugin: 'kotlin-android'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion "34.0.0"


    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "world.opine.app"
        minSdkVersion 23
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        manifestPlaceholders = [geoApiKEY: geoApiKEY]
    }

    signingConfigs {
    release {
        // if (System.getenv()["CI"]) { // CI=true is exported by Codemagic
        //     storeFile file(System.getenv()["CM_KEYSTORE_PATH"])
        //     storePassword System.getenv()["CM_KEYSTORE_PASSWORD"]
        //     keyAlias System.getenv()["CM_KEY_ALIAS"]
        //     keyPassword System.getenv()["CM_KEY_PASSWORD"]
        // } else {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            // storeFile file(keystoreProperties['storeFile'])
            storeFile file("Users/Kwabena/key.jks")
            storePassword keystoreProperties['storePassword']
        // }
    }
}
 buildTypes {
    release {
        signingConfig signingConfigs.release

        //  minifyEnabled true
//             useProguard true

        // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        // android.applicationVariants.all { variant ->
        //     variant.outputs.all {
        //         outputFileName = "opine-${variant.name}-${variant.versionName}-${variant.versionCode}.apk"
        //     }
        // }
    }
}

android {
    namespace 'world.opine.app'
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}
    lint {
        disable 'InvalidPackage'
    }
    // buildTypes {
    //     release {
    //         // TODO: Add your own signing config for the release build.
    //         // Signing with the debug keys for now, so `flutter run --release` works.
    //         signingConfig signingConfigs.debug

    //         minifyEnabled true
    //         useProguard true

    //         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    //     }
    // }

// splits {
//         // Configures multiple APKs based on ABI.
//         abi {
//             // Enables building multiple APKs per ABI.
//             enable true
//             // By default all ABIs are included, so use reset() and include to specify that we only
//             // want APKs for armeabi-v7a and arm64-v8a.

//             // Resets the list of ABIs that Gradle should create APKs for to none.
//             reset()

//             // Specifies a list of ABIs that Gradle should create APKs for.
//             // include "armeabi-v7a", "arm64-v8a"
//             include "armeabi-v7a", "arm64-v8a", "x86"

//             // Specifies that we do not want to also generate a universal APK that includes all ABIs.
//             universalApk false
//         }
//     }

}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test:runner:1.6.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:31.0.2')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    // api "androidx.core:core:1.1.0-alpha04"
}
android flutter gradle
1个回答
0
投票

好像和java版本有关 尝试改变

   compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

compileOptions {
    sourceCompatibility JavaVersion.VERSION_17
    targetCompatibility JavaVersion.VERSION_17
}
© www.soinside.com 2019 - 2024. All rights reserved.