从应用程序收到错误-32601:未找到方法,Andriod中出现Flutter Upgrade问题

时间:2018-05-06 08:08:19

标签: android flutter

升级扑动后,当我构建我的应用程序时,我开始收到以下错误:

  

任务执行失败':app:processDebugManifest'。 [+ 5毫秒]>   清单合并失败:属性   meta-data#android.support.VERSION@value value =(25.4.0)from   [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35   [+ 23毫秒]也出现在   [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35   值=(26.1.0)。 [+8 ms]建议:添加   'tools:replace =“android:value”'to element at   AndroidManifest.xml:26:9-28:38覆盖。

add 'tools:replace="Android:value"' to <meta-data> element at AndroidManifestAndroid: Getting "Manifest merger failed" error after updating to a new version of gradle中所述  {{3}}所以答案我添加了

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.4.0'
            }
        }
    }
}

到我的app文件夹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 new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 27

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.yourcompany.chatapp"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    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
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.4.0'
            }
        }
    }
}
apply plugin: 'com.google.gms.google-services'

现在每当我运行我的应用程序时,我都会收到以下错误:

  

Error -32601 received from application: Method not found

我已经尝试过运行flutter clean,错误仍然存​​在。

以下是flutter doctor的输出:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.3.1, on Microsoft Windows [Version 10.0.16299.371], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.0-rc1)
[√] Android Studio (version 3.1)
[√] Connected devices (1 available)

• No issues found!

2 个答案:

答案 0 :(得分:0)

我发现原始问题:

  

任务执行失败':app:processDebugManifest'。 [+ 5毫秒]&gt;   清单合并失败:属性   meta-data#android.support.VERSION@value value =(25.4.0)from   [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35   [+ 23 ms]也出现在[com.android.support:support-v4:26.1.0]   AndroidManifest.xml:28:13-35 value =(26.1.0)。 [+8 ms]建议:添加   'tools:replace =“android:value”'to element at   AndroidManifest.xml:26:9-28:38覆盖。

可能是因为较旧的firebase软件包依赖项。

我的初始pubspec.yaml依赖关系看起来像:

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.0
  contact_picker:  ^0.0.2
  connectivity: ^0.3.0
  image_picker: 0.1.1
  google_sign_in: 0.3.1
  firebase_analytics: 0.0.4
  firebase_auth: 0.2.0
  firebase_database: 0.0.1
  firebase_storage: 0.0.5
  firebase_messaging: 0.2.5

如果我更新pubspec.yaml,如下所示:

  cupertino_icons: ^0.1.0
  contact_picker:  ^0.0.2
  connectivity: ^0.3.0
  image_picker: ^0.4.1
  google_sign_in: ^3.0.3
  firebase_analytics: ^0.3.3
  firebase_auth: ^0.5.7
  firebase_database: ^0.4.6
  firebase_storage: ^0.3.3
  firebase_messaging: ^0.2.5

首先没有Manifest merger failed因此build.gradle文件中不需要进行任何更改。

我不确定Manifest merger failed是如何与其他firebase软件包相关联的,但是在此解决方案之后,构建工作正常,并且没有Manifest merger failedError -32601 received from application: Method not found错误。

答案 1 :(得分:0)

刚刚遇到了相同的错误,并且可以确认这是Firestore软件包相关性错误。收到错误0.12.11时,我试图更新为binding to the service failed

解决方案是返回到0.12.10 Firestore插件,该问题已解决