flutter_bugly 0.2.7

  • Readme
  • Changelog
  • Example
  • Installing
  • 92

flutter_bugly #

pub package Gitter

腾讯Bugly flutter应用更新插件

支持Android/iOS 运营统计、原生异常上报、flutter异常上报、应用更新 #


一、引入 #

//因为大部分主流插件都已升级androidx,所以pub库升级androidx
//版本更新弹窗问题见下面说明
//androidx 
dependencies:
  flutter_bugly: lastVersion
  
//support
dependencies:
  flutter_bugly:
    git:
      url: git://github.com/crazecoder/flutter_bugly.git
      ref: dev

二、项目配置 #

在android/app/build.gradle的android下加入

    defaultConfig {
        ndk {
            //设置支持的SO库架构
            abiFilters 'armeabi-v7a'//, 'arm64-v8a', 'x86', 'x86_64'
        }
    }

三、使用 #

import 'package:flutter_bugly/flutter_bugly.dart';

//使用flutter异常上报
void main()=>FlutterBugly.postCatchedException((){
  runApp(MyApp());
});

FlutterBugly.init(androidAppId: "your android app id",iOSAppId: "your iOS app id");

四、release打包(Android) #

64-bit

flutter build apk --release --target-platform android-arm64

32-bit(目前配合armeabi-v7a可以打出32位64位通用包)

flutter build apk --release --target-platform android-arm

五、支持属性(Android) #

 String channel, //自定义渠道标识
 bool autoCheckUpgrade = true,//自动检查更新开关
 bool autoInit = true,//自动初始化
 bool autoDownloadOnWifi = false,//设置Wifi下自动下载
 bool enableNotification = false,//通知栏
 bool showInterruptedStrategy = true, //设置开启显示打断策略
 bool canShowApkInfo = true, //设置是否显示弹窗中的apk信息
 int initDelay = 0, //延迟初始化,单位秒
 int upgradeCheckPeriod = 0, //升级检查周期设置,单位秒
 
 //手动检查更新
 checkUpgrade({
     bool isManual = false,//用户手动点击检查,非用户点击操作请传false
     bool isSilence = false,//是否显示弹窗等交互,[true:没有弹窗和toast] [false:有弹窗或toast]
 })
 FlutterBugly.setUserId("user id");
 FlutterBugly.putUserData(key: "key", value: "value");
 int tag = 9527;
 FlutterBugly.setUserTag(tag);

六、自定义弹窗(Android) #

通过FlutterBugly.getUpgradeInfo()获取更新策略信息填入自定义flutter widget,手动弹窗

UpgradeInfo参数:

  String id = "";//唯一标识
  String title = "";//升级提示标题
  String newFeature = "";//升级特性描述
  long publishTime = 0;//升级发布时间,ms
  int publishType = 0;//升级类型 0测试 1正式
  int upgradeType = 1;//升级策略 1建议 2强制 3手工
  int popTimes = 0;//提醒次数
  long popInterval = 0;//提醒间隔
  int versionCode;
  String versionName = "";
  String apkMd5;//包md5值
  String apkUrl;//APK的CDN外网下载地址
  long fileSize;//APK文件的大小
  String imageUrl; // 图片url

七、说明(Android) #

异常上报说明

1、flutter异常上报不属于崩溃,所以如需查看flutter的异常上报,请在【错误分析】tab页查看

2、iOS的异常上报没有过多测试,如出现问题请issue

目前已知问题

1、第一次接受到更新策略之后,不会弹窗,即使手动检查更新也不会,需要退出app之后再进入,才会有弹窗(已解决)

2、官方没有适配8.0的notification,所以如果需要用到notification的时候请关闭后(默认关闭),自己写相关业务逻辑,或者直接把gradle里的targetSdkVersion设成26以下(方法见示例) 官方已适配

3、请勿在targetSdkVersion 26以上设置autoDownloadOnWifi = true,会导致在8.0以上机型更新策略没有反应

4、因为版本更新弹窗封装进sdk,使用的是support包,所以使用androidx包时,请配合FlutterBugly.getUpgradeInfo()或者FlutterBugly.checkUpgrade()【两种方法区别见方法注释】方法自定义弹窗界面 弹窗示例或者有下载打开安装的完整示例

0.2.7 #

  • 异常上报新增debugUpload字段,默认false
  • 异常上报新增uploadException方法
  • 新增setAppChannel方法

0.2.6 #

  • android:networkSecurityConfig改为android:usesCleartextTraffic

0.2.5 #

  • 优化iOS和android异常上报控制台排版格式

0.2.4+1 #

  • 修复自动适配模式时,debug时网络请求会上报的问题

0.2.4 #

  • 自动适配debug、release模式。debug下只打印异常不上报,release只上报,不打印
  • 混淆合并,自带flutter和bugly相关混淆规则

0.2.3+1 #

  • 修复useCache取值不正确的问题

0.2.3 #

  • 优化checkUpgrade方法,等待网络请求更新策略完成后再返回UpgradeInfo(注意点见方法注释)
  • 升级com.tencent.bugly:crashreport_upgrade:1.4.1

0.2.2 #

  • 新增初始化channel参数,见注释
  • 新增setUserTag、putUserData方法,见注释

0.2.1+1 #

  • 新增setUserId方法,用于crash用户标识

0.2.0+1 #

  • 优化UpgradeInfo获取机制,优先获取网络策略,网络策略没有来得及拉取时,取本地策略

0.2.0 #

  • 优化UpgradeInfo获取机制

0.1.9+2 #

  • 解决The 'Pods-Runner' target has transitive dependencies that include static binaries

0.1.9+1 #

  • 获取更新信息增加非空判断

0.1.9 #

  • 解决Android 9.0上联网失败的问题

0.1.8 #

  • 增加异常上报过滤

0.1.7 #

  • 优化格式化异常信息上报时的逻辑

0.1.6+2 #

  • 修改iOS为返回InitResultInfo实体

0.1.6+1 #

  • 删除.idea及优化逻辑严谨性

0.1.6 #

  • sdk自带6.0以上动态权限,删除插件中的权限动态申请
  • 修改为返回InitResultInfo实体

0.1.5+1 #

  • 升级 crashreport_upgrade:1.3.7,适配8.0通知栏,以及androidx的应用升级弹窗说明

0.1.4+2 #

  • fix crash when FileProvider not find

0.1.4+1 #

  • migrate to androidx

example/README.md

flutter_bugly_example #

Demonstrates how to use the flutter_bugly plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_bugly: ^0.2.7

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_bugly/flutter_bugly.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
84
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
92
Learn more about scoring.

We analyzed this package on Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/flutter_bugly.dart.

Run flutter format to format lib/flutter_bugly.dart.

Format lib/src/bean/upgrade_info.dart.

Run flutter format to format lib/src/bean/upgrade_info.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8