Skip to content
This repository was archived by the owner on Jun 25, 2019. It is now read-only.
This repository was archived by the owner on Jun 25, 2019. It is now read-only.

Google Map & Firebase Messaging Plugin ERROR. #76

Open

Description

@NTMS2017

Activity

  1. toregua commented on Jun 26, 2018

    @toregua

    Same error for me when i do :

                                  var _mapView = new MapView();
    
                                    _mapView.show(
                                        new MapOptions(
                                            mapViewType: MapViewType.normal,
                                            showUserLocation: true,
                                            initialCameraPosition:
                                                new CameraPosition(
                                                    new Location(
                                                        widget
                                                            .viewModel
                                                            .professionnelSportContract
                                                            .localisation
                                                            .latitude,
                                                        widget.viewModel.professionnelSportContract.localisation.longitude),
                                                    16.0),
                                            title: widget.viewModel.professionnelSportContract.titre),
                                        toolbarActions: [
                                          new ToolbarAction("Fermer", 1)
                                        ]);
    

    Same code was working before I upgrade.

    My LogCat on Android say :

    
    6-26 12:40:31.386  1345  9932 D ActivityManager: Process com.cleanmaster.security:ScanService has 0 services
    06-26 12:40:31.387  1345  1403 W zygote64: kill(-22116, 9) failed: No such process
    06-26 12:40:31.392  1345  1403 W zygote64: kill(-22116, 9) failed: No such process
    06-26 12:40:31.392  1345  1403 I zygote64: Successfully killed process cgroup uid 10164 pid 22116 in 5ms
    06-26 12:40:31.392   660   660 I Zygote  : Process 22116 exited cleanly (255)
    06-26 12:40:31.403   768  3780 I vendor.qti.bluetooth@1.0-ibs_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
    06-26 12:40:31.463   929  1057 I ThermalEngine: Monitor : quiet_therm = 33, msm_therm = 35, ufs_therm = -40, battery_therm = 305,current_now = 30000 
    06-26 12:40:31.808  1345  2217 V AlarmManager: Triggering alarm #0: 2 when =400906594 package =com.google.android.gms operation =*walarm*:com.google.android.gms.gcm.HEARTBEAT_ALARM flags =0x5
    06-26 12:40:31.824  4712  6515 E WakeLock: release without a matched acquire!
    06-26 12:40:32.269 22173 22173 I zygote64: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.maps.model.CameraPosition>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzbfm;
    06-26 12:40:32.269 22173 22173 I zygote64:   at void com.apptreesoftware.mapview.MapViewPlugin.<clinit>() (MapViewPlugin.kt:-1)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void com.apptreesoftware.mapview.MapViewPlugin.registerWith(io.flutter.plugin.common.PluginRegistry$Registrar) (MapViewPlugin.kt:-1)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void io.flutter.plugins.GeneratedPluginRegistrant.registerWith(io.flutter.plugin.common.PluginRegistry) (GeneratedPluginRegistrant.java:28)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void com.agilyteam.sortiesportmobile.MainActivity.onCreate(android.os.Bundle) (MainActivity.java:25)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7036)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7027)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1231)
    06-26 12:40:32.269 22173 22173 I zygote64:   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2864)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2989)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1688)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.os.Looper.loop() (Looper.java:164)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6753)
    06-26 12:40:32.269 22173 22173 I zygote64:   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:482)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:807)
    06-26 12:40:32.269 22173 22173 I zygote64: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.zzbfm" on path: DexPathList[[zip file "/data/app/com.agilyteam.sortiesportmobile-uMbG37e2ZTqLoKQK5YJk4w==/base.apk"],nativeLibraryDirectories=[/data/app/com.agilyteam.sortiesportmobile-uMbG37e2ZTqLoKQK5YJk4w==/lib/arm64, /data/app/com.agilyteam.sortiesportmobile-uMbG37e2ZTqLoKQK5YJk4w==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
    06-26 12:40:32.269 22173 22173 I zygote64:   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125)
    06-26 12:40:32.269 22173 22173 I zygote64:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
    06-26 12:40:32.269 22173 22173 I zygote64:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void com.apptreesoftware.mapview.MapViewPlugin.<clinit>() (MapViewPlugin.kt:-1)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void com.apptreesoftware.mapview.MapViewPlugin.registerWith(io.flutter.plugin.common.PluginRegistry$Registrar) (MapViewPlugin.kt:-1)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void io.flutter.plugins.GeneratedPluginRegistrant.registerWith(io.flutter.plugin.common.PluginRegistry) (GeneratedPluginRegistrant.java:28)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void com.agilyteam.sortiesportmobile.MainActivity.onCreate(android.os.Bundle) (MainActivity.java:25)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7036)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7027)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1231)
    06-26 12:40:32.269 22173 22173 I zygote64:   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2864)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2989)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1688)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.os.Looper.loop() (Looper.java:164)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6753)
    06-26 12:40:32.269 22173 22173 I zygote64:   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:482)
    06-26 12:40:32.269 22173 22173 I zygote64:   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:807)
    06-26 12:40:32.269 22173 22173 I zygote64: 
    06-26 12:40:32.269 22173 22173 F flutter : [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(61)] Check failed: CheckException(env). 
    06-26 12:40:32.270 22173 22173 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 22173 (rtiesportmobile), pid 22173 (rtiesportmobile)
    06-26 12:40:32.360 23348 23348 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
    06-26 12:40:32.362  3214  3806 D HeadsetStateMachine: Disconnected process message: 10, size: 0
    06-26 12:40:32.363   768  3785 I vendor.qti.bluetooth@1.0-ibs_handler: DeviceSleep: TX Awake, Sending SLEEP_IND
    06-26 12:40:32.363   768  3785 I vendor.qti.bluetooth@1.0-ibs_handler: SerialClockVote: vote for UART CLK OFF
    06-26 12:40:32.363   972   972 I /system/bin/tombstoned: received crash request for pid 22173
    06-26 12:40:32.369 23348 23348 I crash_dump64: performing dump of process 22173 (target tid = 22173)
    

    My android/build.gradle file :

    buildscript {
        repositories {
            google()
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    
        dependencies {
            // classpath 'com.android.tools.build:gradle:2.3.3'
            classpath 'com.android.tools.build:gradle:3.0.1'
            classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4'
            classpath 'com.google.gms:google-services:3.2.0'
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
        project.evaluationDependsOn(':app')
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    Seems to be a duplicate of 72 73

  2. patipol commented on Jul 4, 2018

    @patipol

    It works for me after I have added the dependency of com.google.android.gms:play-services-maps in android/app/build.gradle.

    My android/build.gradle looks like this:

    buildscript {
        ...
    
        dependencies {
            ...
            classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4'
            classpath 'com.google.gms:google-services:3.2.1'
        }
    }
    
    ...
    

    And my android/app/build.gradle looks like this:

    ...
    
    dependencies {
        ...
        implementation 'com.google.firebase:firebase-core:15.0.2'
        implementation 'com.google.android.gms:play-services-maps:15.0.1'
    }
    
    apply plugin: 'com.google.gms.google-services'
    

    I think dependencies of map_view are conflicted with those of firebase_messaging in this case.

  3. NTMS2017 commented on Jul 4, 2018

    @NTMS2017
    Author

    Thanks @patipol
    I add exactly what you post and I get below error:

    My android build_gardel:

    buildscript {
        ext.kotlin_version = '1.2.41'
        repositories {
            google()
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.2'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            //classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4'
            classpath 'com.google.gms:google-services:3.2.1'
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
        project.evaluationDependsOn(':app')
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    

    My android/app/build_gradel

    def localProperties = new Properties()
    def localPropertiesFile = rootProject.file('local.properties')
    if (localPropertiesFile.exists()) {
        localPropertiesFile.withInputStream { stream ->
            localProperties.load(stream)
        }
    }
    
    
    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 plugin: 'kotlin-android'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    apply plugin: 'com.google.gms.google-services'
    
    android {
        compileSdkVersion 27
        buildToolsVersion '25.0.3'
    
        sourceSets {
            main.java.srcDirs += 'src/main/kotlin'
        }
    
        lintOptions {
            disable 'InvalidPackage'
        }
    
        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "com.niyazibank.niyazibank"
            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 {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.41"
        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'
        implementation 'com.google.firebase:firebase-core:15.0.2'
        implementation 'com.google.android.gms:play-services-maps:15.0.1'
    }
    
    
    

    ERROR:
    Launching lib/main.dart on Android SDK built for x86 in debug mode...
    Initializing gradle...
    Resolving dependencies...
    Running 'gradlew assembleDebug'...
    registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

    FAILURE: Build failed with an exception.

    • What went wrong:
      Execution failed for task ':app:processDebugGoogleServices'.

    Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.4.2.

    • 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 20s
    Finished with error: Gradle build failed: 1

  4. patipol commented on Jul 5, 2018

    @patipol

    @NTMS2017 Could you please try investigating what dependencies map_view uses in different cases?

    By using

    cd android
    ./gradlew :app:dependencies
    

    Please consider my cases.

    1. Use map_view without firebase_messaging, the dependencies look like this:
    +--- project :map_view
    |    +--- com.android.support:appcompat-v7:27.1.1 (*)
    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.4-2
    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.4-2
    |    |         \--- org.jetbrains:annotations:13.0
    |    \--- com.google.android.gms:play-services-maps:11.+ -> 11.8.0
    |         +--- com.google.android.gms:play-services-base:11.8.0
    |         |    +--- com.google.android.gms:play-services-basement:11.8.0
    |         |    |    +--- com.android.support:support-v4:25.2.0
    |         |    |    |    +--- com.android.support:support-compat:25.2.0 -> 27.1.1 (*)
    |         |    |    |    +--- com.android.support:support-media-compat:25.2.0
    |         |    |    |    |    +--- com.android.support:support-annotations:25.2.0 -> 27.1.1
    |         |    |    |    |    \--- com.android.support:support-compat:25.2.0 -> 27.1.1 (*)
    |         |    |    |    +--- com.android.support:support-core-utils:25.2.0 -> 27.1.1 (*)
    |         |    |    |    +--- com.android.support:support-core-ui:25.2.0 -> 27.1.1 (*)
    |         |    |    |    \--- com.android.support:support-fragment:25.2.0 -> 27.1.1 (*)
    |         |    |    \--- com.google.android.gms:play-services-basement-license:11.8.0
    |         |    +--- com.google.android.gms:play-services-tasks:11.8.0
    |         |    |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
    |         |    |    \--- com.google.android.gms:play-services-tasks-license:11.8.0
    |         |    \--- com.google.android.gms:play-services-base-license:11.8.0
    |         +--- com.google.android.gms:play-services-basement:11.8.0 (*)
    |         \--- com.google.android.gms:play-services-maps-license:11.8.0
    

    It uses com.google.android.gms:play-services-maps:11.+ -> 11.8.0 which depends on com.google.android.gms:play-services-base:11.8.0 and com.google.android.gms:play-services-basement:11.8.0, the versions are matched and map_view works properly.

    1. Use map_view with firebase_messaging by adding classpath 'com.google.gms:google-services:3.2.1' in android/build.gradle as well as implementation 'com.google.firebase:firebase-core:15.0.2' and apply plugin: 'com.google.gms.google-services' in android/app/build.gradle, the dependencies look like this:
    +--- project :map_view
    |    +--- com.android.support:appcompat-v7:27.1.1 (*)
    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.4-2
    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.4-2
    |    |         \--- org.jetbrains:annotations:13.0
    |    \--- com.google.android.gms:play-services-maps:11.+ -> 11.8.0
    |         +--- com.google.android.gms:play-services-base:11.8.0 -> 15.0.1 (*)
    |         +--- com.google.android.gms:play-services-basement:11.8.0 -> 15.0.1 (*)
    |         \--- com.google.android.gms:play-services-maps-license:11.8.0
    

    com.google.android.gms:play-services-maps:11.+ -> 11.8.0 is still be in use but com.google.android.gms:play-services-base:11.8.0 -> 15.0.1 (*) and com.google.android.gms:play-services-basement:11.8.0 -> 15.0.1 (*) are changed to 15.0.1. The app crashed when calling something like _mapView.show(mapOptions);.

    1. Add implementation 'com.google.android.gms:play-services-maps:15.0.1' in android/app/build.gradle, the dependencies look like this:
    +--- project :map_view
    |    +--- com.android.support:appcompat-v7:27.1.1 (*)
    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.4-2
    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.4-2
    |    |         \--- org.jetbrains:annotations:13.0
    |    \--- com.google.android.gms:play-services-maps:11.+ -> 15.0.1
    |         +--- com.google.android.gms:play-services-base:[15.0.1,16.0.0) -> 15.0.1 (*)
    |         \--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
    

    com.google.android.gms:play-services-maps:11.+ -> 15.0.1 and its dependencies com.google.android.gms:play-services-base:[15.0.1,16.0.0) -> 15.0.1 (*) and com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*) all are changed to 15.0.1 which are matched and map_view works properly again!

    Hope this helps.

  5. NTMS2017 commented on Jul 5, 2018

    @NTMS2017
    Author

    @patipol thank you very much. I add the "implementation 'com.google.android.gms:play-services-maps:15.0.1'" and activated just firebase_messaging plugin in pubspec.yaml and get the dependencies. No problem in here. I delete my project bin folder and rebuild the application. Now map_view works perfectly. I didn't add any firebase_messaging implementation yet. I will try to add today or may be tomorrow to see. Now in pubspec.yaml has this;

      cupertino_icons: "^0.1.2"
      connectivity: "^0.3.1"
      decimal: "^0.2.0"
      url_launcher: "^3.0.2"
      firebase_messaging: "^1.0.3"
      map_view: "^0.0.12"
    

    and seems no conflict now. My android/app/build.gradle look like this

    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.41"
        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'
        implementation 'com.google.firebase:firebase-core:15.0.2'
        implementation 'com.google.android.gms:play-services-maps:15.0.1'
    }
    
  6. NTMS2017 commented on Jul 7, 2018

    @NTMS2017
    Author

    @patipol can you actually use map_view and firebase messaging and can you show me how to implement the dependencies in both build.gradele like showing me... (***************) what is exactly. Anything I try to implement I still get an error.

    dependencies {
    implementation ""
    testImplementation "
    "
    androidTestImplementation ""
    androidTestImplementation "
    "
    implementation ""
    implementation "
    "
    }

    the error:

    FAILURE: Build failed with an exception.

    • What went wrong:
      Failed to capture snapshot of input files for task ':map_view:compileDebugAidl' property 'importDirs' during up-to-date check.

    The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 11.8.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

    • 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
    Finished with error: Gradle build failed: 1

    Project Build-Gradle:

    buildscript {
        ext.kotlin_version = '1.2.41'
        repositories {
            google()
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.2'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.google.gms:google-services:4.0.0'
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
        project.evaluationDependsOn(':app')
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    

    App Build-Gradle:

    def localProperties = new Properties()
    def localPropertiesFile = rootProject.file('local.properties')
    if (localPropertiesFile.exists()) {
        localPropertiesFile.withInputStream { stream ->
            localProperties.load(stream)
        }
    }
    
    
    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 plugin: 'kotlin-android'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    apply plugin: 'com.google.gms.google-services'
    
    android {
        compileSdkVersion 27
        buildToolsVersion '25.0.3'
    
        sourceSets {
            main.java.srcDirs += 'src/main/kotlin'
        }
    
        lintOptions {
            disable 'InvalidPackage'
        }
    
        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "com.test.niyazi"
            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 {
        implementation 'org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.41'
        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'
        implementation 'com.google.firebase:firebase-core:15.0.2'
        implementation 'com.google.android.gms:play-services-maps:15.0.1'
    }
    
    
    
  7. patipol commented on Jul 16, 2018

    @patipol

    @NTMS2017 Every time trying each implementation, please make sure to stop running the app and start it again.

    android/build.gradle:

    buildscript {
        repositories {
            google()
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.2'
            classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4'
            classpath 'com.google.gms:google-services:3.2.1'
        }
    }
    
    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
    }
    

    android/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.example.myapp"
            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'
        implementation 'com.google.firebase:firebase-core:15.0.2'
        implementation 'com.google.android.gms:play-services-maps:15.0.1'
    }
    
    apply plugin: 'com.google.gms.google-services'
    
    

    Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions