4
votes

I am making an application on flutter. I connected map_view: ^0.0.14 to draw a road on the map, but I get the following error:

  • Error running Gradle: ProcessException: Process "C:\Users\admin\AndroidStudioProjects\advertise\android\gradlew.bat" exited abnormally:

Configure project :app registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

Configure project :map_view WARNING: The specified Android SDK Build Tools version (27.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1. Android SDK Build Tools 28.0.3 will be used. To suppress this warning, remove "buildToolsVersion '27.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools. ********************************************************* WARNING: This version of firebase_auth will break your Android build if it or its dependencies aren't compatible with AndroidX. See goo.gl/CP92wY for more information on the problem and how to fix it. This warning prints for all Android build failures. The real root cause of the error may be unrelated. *********************************************************

FAILURE: Build failed with an exception.

  • What went wrong: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'map_view' is using version 1.2.50.

  • 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 help.grade.org

BUILD FAILED in 2s Command: C:\Users\admin\AndroidStudioProjects\advertise\android\gradlew.bat app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

app/build.gradel:

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

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.advertise"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        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.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.9'
}
apply plugin: 'com.google.gms.google-services'

build.gradle:

 buildscript {
        repositories {
            google()
            jcenter()
        }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51'

    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.advertise">
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="advertise"
        android:icon="@mipmap/ic_launcher">
        <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="xxxxxxxxxxxxxxxxxxxxxx"/>
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
        <meta-data android:name="com.google.android.geo.API_KEY"
            android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
        <activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <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>
        </activity>
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" />
        <activity android:name="com.facebook.CustomTabActivity" android:exported="true">
            <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:scheme="@string/fb_login_protocol_scheme" />
        </intent-filter>
        </activity>

    </application>
</manifest>
2

2 Answers

1
votes

It's hard to be sure from here but I can suggest you:

Increase minimum SDK version:

minSdkVersion 16

to:

minSdkVersion 21

IDE usually warns about your Kotlin version inside the build.gradle. Try to fix it through IDE recommandation. It may say update to '1.3.21' etc.

Play around gradle version:

classpath 'com.android.tools.build:gradle:3.2.1'

try: 3.3.0, 3.0.1, 3.4.1

1
votes

in buildgradel:library change buildToolsVersion:'27.0.3' to '28.0.3',and fixed my warning