Skip to content

Commit

Permalink
Remove allowoptimization modifier from FlutterPlugin proguard rules (f…
Browse files Browse the repository at this point in the history
…lutter#154715)

Fixes: flutter#154580
Previous PR: flutter#154677
More info: flutter#154580 (comment)

The errors described in the original issue [are still occurring](flutter#154580 (comment)) after flutter#154677. Before this change, the repro [broken_demo](https://github.com/rajveermalviya/broken_demo) mentioned in the original issue logs:

```shell-session
$ flutter run --release
Launching lib/main.dart on sdk gphone64 arm64 in release mode...
Running Gradle task 'assembleRelease'...                           14.5s
� Built build/app/outputs/flutter-apk/app-release.apk (7.4MB)
Installing build/app/outputs/flutter-apk/app-release.apk...        739ms

Flutter run key commands.
h List all available interactive commands.
c Clear the screen
q Quit (terminate the application on the device).
W/FlutterEngineCxnRegstry(13284): Attempted to register plugin (a0.a@53b33b6) but it was already registered with this FlutterEngine (d0.c@8baa8b7).
E/flutter (13284): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
E/flutter (13284): #0      PathProviderApi.getApplicationSupportPath (package:path_provider_android/messages.g.dart:65)
E/flutter (13284): <asynchronous suspension>
E/flutter (13284): #1      getApplicationSupportDirectory (package:path_provider/path_provider.dart:78)
E/flutter (13284): <asynchronous suspension>
E/flutter (13284): #2      _BorkenDemoHomePageState.build.<anonymous closure> (package:broken_demo/main.dart:44)
E/flutter (13284): <asynchronous suspension>
E/flutter (13284): 
```

After this change:
```shell-session
$ flutter run --release
Launching lib/main.dart on sdk gphone64 arm64 in release mode...
Running Gradle task 'assembleRelease'...                           15.2s
� Built build/app/outputs/flutter-apk/app-release.apk (7.4MB)
Installing build/app/outputs/flutter-apk/app-release.apk...        857ms

Flutter run key commands.
h List all available interactive commands.
c Clear the screen
q Quit (terminate the application on the device).
I/flutter (13040): path_provider: Directory: '/data/user/0/com.example.broken_demo/files'
```
  • Loading branch information
rajveermalviya authored Sep 6, 2024
1 parent 84757af commit 6ad6641
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/flutter_tools/gradle/flutter_proguard_rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
# why this is the case.
# See https://github.com/flutter/flutter/issues/154580.
-if class * implements io.flutter.embedding.engine.plugins.FlutterPlugin
-keep,allowoptimization,allowshrinking,allowobfuscation class <1>
-keep,allowshrinking,allowobfuscation class <1>

0 comments on commit 6ad6641

Please sign in to comment.