在 flutter 中找不到参数的 android() 方法

moh*_*ani 5 android gradle dart flutter

我将本地 android 库(.aar)推送到我的 flutter 项目并更改 android 目录中的 gradle 文件,这是我的 build.gradle

buildscript {
repositories {

    google()
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0'
    classpath 'io.fabric.tools:gradle:1.+'
}


}


allprojects {
repositories {

    google()
    jcenter()
    flatDir
            {
                dirs 'pecpayment-release'
            }
    Maven { url 'https://maven.fabric.io/public' }


  }
 }

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

task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

这是我的 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.")
}

def flutterVersionCode =     localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName =                                                localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

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

android {
compileSdkVersion 28
lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    // TODO: Specify your own unique Application ID       (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.shabakieh.art_man"
    minSdkVersion 22
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    testInstrumentationRunner "androidx.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.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-        core:3.0.2'
androidTestCompile 'com.android.support:support-annotations:22.0.0'


implementation project(':pecpayment-release')
implementation fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:LAST_VER'
implementation 'com.android.support:design:LAST_VER'
implementation (name:'pecpayment-release', ext:'aar')
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation ('com.crashlytics.sdk.android:crashlytics:2.10.1@aar'){
    transitive = true;
 }

 }
Run Code Online (Sandbox Code Playgroud)

但是当构建我的项目时出现此错误

 * Error running Gradle:
ProcessException: Process "C:\Users\Mohammad\Desktop\flutter    project\ArtMan\android\gradlew.bat" exited abnormally:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Mohammad\Desktop\flutter project\ArtMan\android  \build.gradle' line: 27

* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not find method Maven() for arguments   [build_c9fbu96kunvkjy5e4z3tft0zv$_run_closure1$_closure5$_closure7@4ff63451]     on repository container of type   org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.

* 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 3s
Command: C:\Users\Mohammad\Desktop\flutter project\ArtMan\android   \gradlew.bat app:properties

Finished with error: Please review your Gradle project setup in the     android/ folder.
Run Code Online (Sandbox Code Playgroud)

我从这个网站和github上阅读了很多代码并测试了它,但没有任何效果我不知道如何修复它如何找到maven问题是它

Pet*_*dad 1

改变这个(内部repositories):

 Maven { url 'https://maven.fabric.io/public' }
Run Code Online (Sandbox Code Playgroud)

进入这个:

 maven { url 'https://maven.fabric.io/public' }
Run Code Online (Sandbox Code Playgroud)

maven()方法包含小写字母m