Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[google_maps_flutter] App crashes when using maps in release mode. #69820

Closed
slightfoot opened this issue Nov 4, 2020 · 52 comments · Fixed by flutter/plugins#3746
Closed

[google_maps_flutter] App crashes when using maps in release mode. #69820

slightfoot opened this issue Nov 4, 2020 · 52 comments · Fixed by flutter/plugins#3746
Labels
a: release Challenges faced when attempting to productionize an app c: fatal crash Crashes that terminate the process found in release: 1.26 Found to occur in 1.26 found in release: 1.27 Found to occur in 1.27 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: maps Google Maps plugin package flutter/packages repository. See also p: labels. platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version

Comments

@slightfoot
Copy link
Member

slightfoot commented Nov 4, 2020

Steps to Reproduce

Build maps example in release mode. Proguard strips out native code used for new Android Lifecycle Management introduced by flutter/plugins#3213

2020-11-04 21:24:07.920 15729-15729/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: <REDACTED>, PID: 15729
java.lang.IllegalAccessError: Interface androidx.lifecycle.b implemented by class io.flutter.plugins.googlemaps.GoogleMapController is inaccessible (declaration of 'io.flutter.plugins.googlemaps.GoogleMapController' appears in /data/app/~~56fQm49wEnuz90CgkNujMQ==/<REDACTED>-okqfqFFCQFiwngFXIJCsUQ==/base.apk)
    at io.flutter.plugins.googlemaps.f.b(Unknown Source:0)
    at io.flutter.plugins.googlemaps.g.a(Unknown Source:99)
    at io.flutter.plugin.platform.SingleViewPresentation.onCreate(Unknown Source:116)
    at android.app.Dialog.dispatchOnCreate(Dialog.java:419)
    at android.app.Dialog.show(Dialog.java:313)
    at android.app.Presentation.show(Presentation.java:257)
    at io.flutter.plugin.platform.l.<init>(Unknown Source:55)
    at io.flutter.plugin.platform.l.a(Unknown Source:65)
    at io.flutter.plugin.platform.k$a.d(Unknown Source:110)
    at io.flutter.embedding.engine.h.i$a.b(Unknown Source:152)
    at io.flutter.embedding.engine.h.i$a.G(Unknown Source:144)
    at c.a.c.a.j$a.a(Unknown Source:17)
    at io.flutter.embedding.engine.e.b.e(Unknown Source:57)
    at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(Unknown Source:4)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:335)
    at android.os.Looper.loop(Looper.java:183)
    at android.app.ActivityThread.main(ActivityThread.java:7656)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Logs
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, 1.24.0-3.0.pre, on Microsoft Windows [Version 10.0.19041.572], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.3)
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Ultimate Edition (version 2020.2)
[√] VS Code, 64-bit edition (version 1.27.2)
[√] Connected device (5 available)

• No issues found!
@slightfoot slightfoot added plugin p: maps Google Maps plugin labels Nov 4, 2020
@slightfoot
Copy link
Member Author

/cc @math1man @amirh

@math1man
Copy link
Contributor

math1man commented Nov 4, 2020

Hmm, I assume that the interface whose name is obfuscated away is DefaultLifecycleObserver. However, that change did not change use of the interface (though it did remove one implementation).

Looks like this is a common issue throughout flutter. See #58479. I think this should be easy to fix in the plugin.

@math1man
Copy link
Contributor

math1man commented Nov 4, 2020

Or maybe it's not specifically an issue with the library, and you just need to follow the advice in that other fix. Let me know if that makes sense and works.

@TahaTesser
Copy link
Member

Hi @slightfoot
I wasn't able to reproduce the issue in release mode using the lates t google_maps_flutter 1.0.6 with or without proguard.

code sample
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Google Maps Demo',
      home: MapSample(),
    );
  }
}

class MapSample extends StatefulWidget {
  @override
  State<MapSample> createState() => MapSampleState();
}

class MapSampleState extends State<MapSample> {
  Completer<GoogleMapController> _controller = Completer();

  static final CameraPosition _kGooglePlex = CameraPosition(
    target: LatLng(37.42796133580664, -122.085749655962),
    zoom: 14.4746,
  );

  static final CameraPosition _kLake = CameraPosition(
      bearing: 192.8334901395799,
      target: LatLng(37.43296265331129, -122.08832357078792),
      tilt: 59.440717697143555,
      zoom: 19.151926040649414);

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: GoogleMap(
        mapType: MapType.hybrid,
        initialCameraPosition: _kGooglePlex,
        onMapCreated: (GoogleMapController controller) {
          _controller.complete(controller);
        },
      ),
      floatingActionButton: FloatingActionButton.extended(
        onPressed: _goToTheLake,
        label: Text('To the lake!'),
        icon: Icon(Icons.directions_boat),
      ),
    );
  }

  Future<void> _goToTheLake() async {
    final GoogleMapController controller = await _controller.future;
    controller.animateCamera(CameraUpdate.newCameraPosition(_kLake));
  }
}
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: 'kotlin-android'
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))
   }

android {
    compileSdkVersion 28

    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.nevercode.triage"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

      signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }

    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.release

            minifyEnabled true
            useProguard true

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

        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
logs
tahatesser@Tahas-MacBook-Pro google_maps_flutter_example % flutterd run --release  -d rmx
Running "flutter pub get" in google_maps_flutter_example...        461ms
Launching lib/main.dart on RMX2001 in release mode...
Note: /Users/tahatesser/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.7/android/src/main/java/io/flutter/plugins/flutter_plugin_android_lifecycle/FlutterAndroidLifecyclePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.                    
Note: /Users/tahatesser/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-1.0.6/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.                    
Note: Some input files use unchecked or unsafe operations.              
Note: Recompile with -Xlint:unchecked for details.                      
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                      32.0s
✓ Built build/app/outputs/flutter-apk/app-release.apk (6.2MB).
Installing build/app/outputs/flutter-apk/app.apk...                 3.9s

Flutter run key commands.
h Repeat this help message.
c Clear the screen
q Quit (terminate the application on the device).
flutter doctor -v
[✓] Flutter (Channel dev, 1.24.0-7.0.pre, on Mac OS X 10.15.7 19H2 darwin-x64,
    locale en-GB)
    • Flutter version 1.24.0-7.0.pre at /Users/tahatesser/Code/flutter_dev
    • Framework revision a0860f6e87 (6 days ago), 2020-10-29 20:07:34 -0700
    • Engine revision 073263e39d
    • Dart version 2.11.0 (build 2.11.0-260.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/tahatesser/Code/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/tahatesser/Code/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.10.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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
      1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.50.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (5 available)
    • RMX2001 (mobile)     • EUYTFEUSQSRGDA6D          • android-arm64  •
      Android 10 (API 29)
    • Taha’s iPad (mobile) • 00008020-000255113EE8402E • ios            • iOS
      14.1
    • macOS (desktop)      • macos                     • darwin-x64     • Mac OS
      X 10.15.7 19H2 darwin-x64
    • Web Server (web)     • web-server                • web-javascript •
      Flutter Tools
    • Chrome (web)         • chrome                    • web-javascript • Google
      Chrome 86.0.4240.183

• No issues found!

Can you please provide step by steps to reproduce the issue crash
Thank you

@TahaTesser TahaTesser added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 5, 2020
@amirh
Copy link
Contributor

amirh commented Nov 5, 2020

I also tried to reproduce it and failed.

For Proguard issues I'd typically expect the error to be about a missing class, not about an inaccessible class.

@slightfoot are you just running the example app as-is? is there something special in your environment? does this reproduce everytime you try?

cc @blasten

edit: @slightfoot did you by chance update the Android Gradle Plugin version for the example app?

@TaifRaoof
Copy link

this issue is appeared to me in release mode while is debug mode it work so i am waiting to solve it ... please help me

@math1man
Copy link
Contributor

Please thoroughly read #58479 and see if the suggestions there provide a solution.

On the other hand, I wonder if the problem is that the Google Maps module doesn't have an explicit gradle dependency on androidx.lifecycle.

@mockturtl
Copy link
Contributor

@slightfoot The proguard -keep workaround #58479 (comment) fixes it for me.

@pedromassangocode
Copy link

Without additional information, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now.
Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of flutter doctor -v.
All system setups can be slightly different, so it's always better to open new issues and reference related issues.

@pedromassangocode pedromassangocode removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 11, 2020
@pamir72
Copy link

pamir72 commented Dec 18, 2020

issue is not solved!

E/AndroidRuntime(25599): java.lang.IllegalAccessError: Interface androidx.lifecycle.b implemented by class io.flutter.plugins.googlemaps.GoogleMapController is inaccessible (declaration of 'io.flutter.plugins.googlemaps.GoogleMapController' appears in ...
E/AndroidRuntime(25599):        at io.flutter.plugins.googlemaps.g.a(Unknown Source:2)
E/AndroidRuntime(25599):        at io.flutter.plugin.platform.SingleViewPresentation.onCreate(Unknown Source:116)
E/AndroidRuntime(25599):        at android.app.Dialog.dispatchOnCreate(Dialog.java:702)
E/AndroidRuntime(25599):        at android.app.Dialog.show(Dialog.java:424)
E/AndroidRuntime(25599):        at android.app.Presentation.show(Presentation.java:283)
E/AndroidRuntime(25599):        at io.flutter.plugin.platform.l.<init>(Unknown Source:55)
E/AndroidRuntime(25599):        at io.flutter.plugin.platform.l.a(Unknown Source:65)
E/AndroidRuntime(25599):        at io.flutter.plugin.platform.k$a.g(Unknown Source:110)
E/AndroidRuntime(25599):        at io.flutter.embedding.engine.i.i$a.b(Unknown Source:152)
E/AndroidRuntime(25599):        at io.flutter.embedding.engine.i.i$a.G(Unknown Source:144)
E/AndroidRuntime(25599):        at f.a.c.a.j$a.a(Unknown Source:17)
E/AndroidRuntime(25599):        at io.flutter.embedding.engine.e.b.d(Unknown Source:57)
E/AndroidRuntime(25599):        at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(Unknown Source:4)
E/AndroidRuntime(25599):        at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(25599):        at android.os.MessageQueue.next(MessageQueue.java:336)
E/AndroidRuntime(25599):        at android.os.Looper.loop(Looper.java:197)
E/AndroidRuntime(25599):        at android.app.ActivityThread.main(ActivityThread.java:8154)
E/AndroidRuntime(25599):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(25599):        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
E/AndroidRuntime(25599):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
[✓] Flutter (Channel dev, 1.26.0-1.0.pre, on macOS 11.1 20C69 darwin-x64, locale ru-RU)
    • Flutter version 1.26.0-1.0.pre at /Users/pavelmiheev/Flutter
    • Framework revision 63062a6443 (5 days ago), 2020-12-13 23:19:13 +0800
    • Engine revision 4797b06652
    • Dart version 2.12.0 (build 2.12.0-141.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/pavelmiheev/Library/Android/sdk
    • Platform android-30, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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 1.8.0_242-release-1644-b3-6915495)

[✓] Connected device (1 available)
    • SM G985F (mobile) • R58N210SHRV • android-arm64 • Android 10 (API 29)

• No issues found!

@TahaTesser
Copy link
Member

@pamir72
Can you please steps to reproduce the issue
Thank you

@pamir72
Copy link

pamir72 commented Dec 21, 2020

flutter run --release

Crash and exception when call widget GoogleMap.
I found several topics with a similar problem. The proguard -keep workaround #58479 (comment) fixes it for me. But we want fix from flutter team at last.

dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.google.gms:google-services:4.3.4'
}

@TahaTesser
Copy link
Member

Hi @pamir72
4.0+ isn't fully supported hence the issue is still open
Meanwhile, you can use default 3.5.0 with no issues

@pamir72
Copy link

pamir72 commented Dec 22, 2020

Thank you. But I can't use 3.5.0 because firebase_messaging 8.0.0-dev.11 has build problems with 3.5.x and firebase_messaging 7.0.3 crashes app when a message arrives . A desperate situation )
Ok. Will wait for fix and use workarounds for now.

@dwikurniantom
Copy link

have you guys solved the issue? same problem here

@shibatatsuya0611
Copy link

i have same problem here. i using google map flutter 1.1.0 and run app on physical device alway crash app. any ide for fix it ? thank ! :(

@dwikurniantom
Copy link

dwikurniantom commented Jan 18, 2021

@shibatatsuya0611 Hey mate, I already solved these issues. It's very frustrating since no one tells us what the solution is.
please check your android/build.gradle file and look into gradle version bc, google_maps_flutter isn't compatible with 4.0.0. I know it's weird since every fresh flutter project now using 4.0.0. Please upgrade it so we can use both google_maps_flutter and gradle with the 4.0.0 version. Thanks a lot

dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
}

and also adding new file then add this line
android/proguard-rules.pro
-keep class androidx.lifecycle.** { *; }

@pamir72
Copy link

pamir72 commented Jan 22, 2021

Updated Flutter to ver. 1.26.0-12.0.pre. Issue is not resolved !

@dwikurniantom
Copy link

@pamir72 it's not the flutter SDK that makes an error. I am sure it's gradle version

@arifai
Copy link

arifai commented Jan 28, 2021

Still unsolved!

Logs

✓ Built build/app/outputs/repo.
Building plugin flutter_plugin_android_lifecycle...
Running Gradle task 'assembleAarRelease'...                             
Running Gradle task 'assembleAarRelease'... Done                   82.3s

/home/ahmadrifai/App/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.11/android/src/main/java/io/flutter/embedding/engine/plugins/lifecycle/FlutterLifecycleAdapter.java:8: error: package androidx.lifecycle does not exist
import androidx.lifecycle.Lifecycle;
                         ^
/home/ahmadrifai/App/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.11/android/src/main/java/io/flutter/embedding/engine/plugins/lifecycle/FlutterLifecycleAdapter.java:22: error: cannot find symbol
  public static Lifecycle getActivityLifecycle(
                ^
  symbol:   class Lifecycle
  location: class FlutterLifecycleAdapter
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 1m 15s


The plugin flutter_plugin_android_lifecycle could not be built due to the issue above.

flutter doctor -v

[✓] Flutter (Channel stable, 1.22.5, on Linux, locale en_US.UTF-8)
    • Flutter version 1.22.5 at /home/ahmadrifai/App/flutter
    • Framework revision 7891006299 (7 weeks ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /home/ahmadrifai/App/Android/Sdk
    • Platform android-30, build-tools 29.0.3
    • ANDROID_HOME = /home/ahmadrifai/App/Android/Sdk
    • Java binary at: /home/ahmadrifai/App/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Android Studio (version 4.0)
    • Android Studio at /home/ahmadrifai/App/android-studio
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.52.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.18.1

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

@shibatatsuya0611
Copy link

Still unsolved!

Logs

hey guys !
u can try add this line to file: android/gradle.properties :
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableDexingArtifactTransform=false

@arifai
Copy link

arifai commented Jan 28, 2021

Still unsolved!
Logs

hey guys !
u can try add this line to file: android/gradle.properties :
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableDexingArtifactTransform=false

I do not understand, I have tried your method and all the ways above but it has not been solved.
I am using google_maps_flutter: 1.0.5. Sorry if my english is bad.

@shibatatsuya0611
Copy link

Still unsolved!
Logs

hey guys !
u can try add this line to file: android/gradle.properties :
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableDexingArtifactTransform=false

I do not understand, I have tried your method and all the ways above but it has not been solved.
I am using google_maps_flutter: 1.0.5. Sorry if my english is bad.

u just select open file gradle.properties on foder android then add this line code: android.enableDexingArtifactTransform=false

@DomingoMG
Copy link

@shibatatsuya0611
It works in debug mode.
It doesn't work in release mode, can someone else offer a solution?

android.enableDexingArtifactTransform = false

@shimulxx
Copy link

thanks.....niktob560...it is working with gradle 4.1.2

@dimz1690
Copy link

Flutter beta and Flutter master 1.27.0-2.0.pre.102 issue appears

UPD:
Fixed by providing proguard config in app/build.gradle by putting
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
in buildTypes block with
-keep class androidx.lifecycle.DefaultLifecycleObserver
param added in proguard config

can you @niktob560 give us example how to put this on gradle file ?

@nikto-b
Copy link

nikto-b commented Mar 12, 2021

Flutter beta and Flutter master 1.27.0-2.0.pre.102 issue appears
UPD:
Fixed by providing proguard config in app/build.gradle by putting
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
in buildTypes block with
-keep class androidx.lifecycle.DefaultLifecycleObserver
param added in proguard config

can you @niktob560 give us example how to put this on gradle file ?

Ok
app/build.gradle:

android {
...
    buildTypes {
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            ...
        }
    }
...
}

Modifyed proguard-rules.pro file
The only difference is in the last line
@dimz1690

UPD: it's kinda dirty workaround, remove it after this fix

@dimz1690
Copy link

Thanks Bro @niktob560, its working well ...

@highdragon1996
Copy link

Great, I had the same issue and now it worked with the solution of @niktob560.

@temirfe
Copy link

temirfe commented Mar 25, 2021

proguard-rules.pro

where is proguard-rules.pro file in project tree? I can't find it.

@highdragon1996
Copy link

@temirfe use your file explorer and search for "proguard" in the root directory where you have your app. There will be several proguard files. proguard rules pro will also be there

@slevchyk
Copy link

Thanks a lot @niktob560, it works like a charm.

@jzz567
Copy link

jzz567 commented Mar 27, 2021

You can just modify this file
your_flutter _app\build\app\intermediates\proguard-files\proguard-android.txt-x.x.x
open this file and add this:
-keep class androidx.lifecycle.DefaultLifecycleObserver
Then everything works fine.

@didierbokaold
Copy link

Hi @slightfoot, you issue can't be reproduiced.
I used this version of google_maps_flutter : google_maps_flutter: 1.0.6 and it work perfectly on debug, profile and release mode on Android or iOS.
Try this

@nikto-b
Copy link

nikto-b commented Mar 28, 2021

Hi @slightfoot, you issue can't be reproduiced.
I used this version of google_maps_flutter : google_maps_flutter: 1.0.6 and it work perfectly on debug, profile and release mode on Android or iOS.
Try this

@didierboka
Downgrade is not an option. Actual version of google_maps_flutter is 2.0.1

@didierbokaold
Copy link

didierbokaold commented Mar 28, 2021

Hi @slightfoot, you issue can't be reproduiced.
I used this version of google_maps_flutter : google_maps_flutter: 1.0.6 and it work perfectly on debug, profile and release mode on Android or iOS.
Try this

@didierboka
Downgrade is not an option. Actual version of google_maps_flutter is 2.0.1

Great i trying this current version on my real project and make callback.

@xster
Copy link
Member

xster commented Mar 30, 2021

This should now be solved by the newly published https://pub.dev/packages/flutter_plugin_android_lifecycle version 2.0.1 (which some plugins such depend on transitively). Doing a flutter pub upgrade and looking for a > flutter_plugin_android_lifecycle 2.0.1 line should resolve the issue.

@BimsaraGunarathna
Copy link

Updating google_maps_flutter to 2.0.2(google_maps_flutter: ^2.0.2) worked for me.

@imtiaz8014
Copy link

Updating google_maps_flutter to 2.0.2(google_maps_flutter: ^2.0.2) worked for me.

This works for me too.

@xster
Copy link
Member

xster commented Apr 8, 2021

Excellent

@oguzhnatly
Copy link

oguzhnatly commented Apr 20, 2021

I confirm that this solved my issue by using the google_maps_flutter: ^1.2.0 package. Though @niktob560 is right, if you cannot/don't want to upgrade google_maps_flutter package, this solution can be used. But I highly recommend upgrading to the actual version ^2.0.3.

1st Step

As you can see here, google maps use Gradle Version was 3.x, that's why it crashes. Add the line below to android/build.gradle file.

// android/build.gradle
buildscript {
    ....
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0' // downgrade to 3.5.0
        ....
    }
}

2nd Step

The second step is more important, because google() repository is a shortcut to Google's Maven Repository which is introduced in Gradle 4.x. When 3.x version is used, it will crash again. Add the line below to android/build.gradle file.

// android/build.gradle
allprojects {
    repositories {
        maven { url 'https://maven.google.com' } // this should be added
        google() // Google's Maven repository
        jcenter()
    }
}

FMI, refer to difference between google() and maven { url 'https://maven.google.com' }.

@mabujaber
Copy link

Updating google_maps_flutter to 2.0.2(google_maps_flutter: ^2.0.2) worked for me.

does upgrading the packages to google_maps_flutter: ^2.0.2 or google_maps_flutter: ^2.0.3 enough?

I can see some suggestions to downgrade classpath 'com.android.tools.build:gradle:3.5.0'

@laxkarparas1
Copy link

@niktob560 not work for me
it's shows me this error

W/DynamiteModule( 1000): Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule( 1000): Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:6
I/DynamiteModule( 1000): Selected remote version of com.google.android.gms.googlecertificates, version >= 6
I/System.out( 1000): [socket]:check permission begin!
I/deorwine.fix_i( 1000): The ClassLoaderContext is a special shared library.
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
I/chatty ( 1000): uid=10484(com.deorwine.fix_it) GoogleApiHandle identical 6 lines
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
I/System.out( 1000): [OkHttp] sendRequest<<
I/System.out( 1000): [okhttp]:check permission begin!
I/System.out( 1000): [okhttp]:not MMS!
I/System.out( 1000): [okhttp]:not Email!
I/System.out( 1000): [socket]:check permission begin!
D/BufferQueueProducer( 1000): SurfaceTexture-0-1000-0 cancelBuffer: slot 0
F/HidlStatus(22177): Status.cpp:163] Failed HIDL return status not checked: Status(EX_TRANSACTION_FAILED): 'DEAD_OBJECT: '

1 similar comment
@laxkarparas1
Copy link

@niktob560 not work for me
it's shows me this error

W/DynamiteModule( 1000): Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule( 1000): Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:6
I/DynamiteModule( 1000): Selected remote version of com.google.android.gms.googlecertificates, version >= 6
I/System.out( 1000): [socket]:check permission begin!
I/deorwine.fix_i( 1000): The ClassLoaderContext is a special shared library.
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
I/chatty ( 1000): uid=10484(com.deorwine.fix_it) GoogleApiHandle identical 6 lines
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
I/System.out( 1000): [OkHttp] sendRequest<<
I/System.out( 1000): [okhttp]:check permission begin!
I/System.out( 1000): [okhttp]:not MMS!
I/System.out( 1000): [okhttp]:not Email!
I/System.out( 1000): [socket]:check permission begin!
D/BufferQueueProducer( 1000): SurfaceTexture-0-1000-0 cancelBuffer: slot 0
F/HidlStatus(22177): Status.cpp:163] Failed HIDL return status not checked: Status(EX_TRANSACTION_FAILED): 'DEAD_OBJECT: '

@nikto-b
Copy link

nikto-b commented May 13, 2021

@niktob560 not work for me
it's shows me this error

W/DynamiteModule( 1000): Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule( 1000): Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:6
I/DynamiteModule( 1000): Selected remote version of com.google.android.gms.googlecertificates, version >= 6
I/System.out( 1000): [socket]:check permission begin!
I/deorwine.fix_i( 1000): The ClassLoaderContext is a special shared library.
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
I/chatty ( 1000): uid=10484(com.deorwine.fix_it) GoogleApiHandle identical 6 lines
W/deorwine.fix_i( 1000): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
I/System.out( 1000): [OkHttp] sendRequest<<
I/System.out( 1000): [okhttp]:check permission begin!
I/System.out( 1000): [okhttp]:not MMS!
I/System.out( 1000): [okhttp]:not Email!
I/System.out( 1000): [socket]:check permission begin!
D/BufferQueueProducer( 1000): SurfaceTexture-0-1000-0 cancelBuffer: slot 0
F/HidlStatus(22177): Status.cpp:163] Failed HIDL return status not checked: Status(EX_TRANSACTION_FAILED): 'DEAD_OBJECT: '

@laxkarparas1 looks like it's an another issue, provide more information about an issue (and maybe open another issue)

@github-actions
Copy link

github-actions bot commented Aug 1, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2021
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: release Challenges faced when attempting to productionize an app c: fatal crash Crashes that terminate the process found in release: 1.26 Found to occur in 1.26 found in release: 1.27 Found to occur in 1.27 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: maps Google Maps plugin package flutter/packages repository. See also p: labels. platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version
Projects
None yet