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

Package size too large. #55

Closed
TristanGrobler opened this issue Feb 10, 2023 · 9 comments
Closed

Package size too large. #55

TristanGrobler opened this issue Feb 10, 2023 · 9 comments

Comments

@TristanGrobler
Copy link

Builing an APK before adding the package resulted in 26.4 MB APK. Adding the package to pubspec.yaml, running futter pub get and then building APK resulted in a 60.5 MB APK. Both sizes are for release APK.
Screenshot 2023-02-10 at 13 39 52

@tlserver
Copy link
Owner

This is a known issue caused by hemanthrajv/flutter_compass#92. I cannot found any alternative package to replace this package last year. I am planning to write a new package to receive heading angle from the device after June 2023 if this issue and other existing issues are not fixed and there are still no alternative package exist.

@TristanGrobler
Copy link
Author

Have you tried this?

I just added it to my current project and it only bumped it up less than a mb.

@tlserver
Copy link
Owner

Here is my test result.
image
After adding this plugin the size is not increated too much for release apk.
for the settings of *-16, the minSdkVersion is set to flutter.minSdkVersion, and it include flutter_map as dependencies.
for the settings of *-23, the minSdkVersion is set to 23, and it include flutter_map as dependencies.
for the settings of *-fmlm, the minSdkVersion is set to 23, and it include flutter_map and this plugin as dependencies.

Steps for my test:
Create a flutter project named fmlm_size.
Paste this code to main.dart:

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
// import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Size',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Size"),
      ),
      body: FlutterMap(
        options: MapOptions(
          zoom: 1,
          minZoom: 0,
          maxZoom: 19,
        ),
        children: [
          TileLayer(
            urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            subdomains: const ['a', 'b', 'c'],
            userAgentPackageName:
            'net.tlserver6y.flutter_map_location_marker.example',
            maxZoom: 19,
          ),
          // CurrentLocationLayer(),
        ],
      ),
    );
  }
}

Paste this code to pubspec.yaml:

name: fmlm_size
description: size
publish_to: 'none'

version: 1.0.0+1

environment:
  sdk: '>=2.19.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  flutter_map: any
#  flutter_map_location_marker: any


  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

flutter:

  uses-material-design: true

Run pub get.
Run flutter build apk and flutter build apk --debug.
Add postfix -16 to two apks.
Edit app/build.gradle, change minSdkVersion from flutter.minSdkVersion to 23.
Add this code to app/src/main/AndroidManifest.xml after <manifest ...> and before <application ...>:

   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
   <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Run flutter build apk and flutter build apk --debug.
Add postfix -23 to two apks.
Uncomment import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; and CurrentLocationLayer(), in main.dart.
Uncomment flutter_map_location_marker: any in pubspec.yaml.
Run pub get.
Run flutter build apk and flutter build apk --debug.
Add postfix -fmlm to two apks.

@TristanGrobler
Copy link
Author

Sweet, that sounds promising then

@TristanGrobler
Copy link
Author

I am sure you are busy, so don't mean to rush you. Do you perhaps have a time frame for releasing package update?

Thanks

@tlserver
Copy link
Owner

tlserver commented Mar 3, 2023

I think the published version is already the most updated version. What do you mean?

@TristanGrobler
Copy link
Author

TristanGrobler commented Mar 3, 2023 via email

@tlserver
Copy link
Owner

How do you get this result? Can you provide details reproduce steps?

@TristanGrobler
Copy link
Author

Ok I tested it again and it is nice an small now, so it is resolved. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants