A Flutter plugin for XUpdate -- Android Update Library

Overview

flutter_xupdate

Version Build Status Issue Star

A Flutter plugin for XUpdate -- Android Update Library。See the use Chinese Document for details。

About me

WeChat public number juejin zhihu CSDN jianshu segmentfault bilibili toutiao
我的Android开源之旅 Click me Click me Click me Click me Click me Click me Click me

Video tutorial

How to use flutter_xupdate

Stargazers over time

Stargazers over time

Getting Started

You should ensure that you add the flutter_xupdate as a dependency in your flutter project.

// pub 集成
dependencies:
  flutter_xupdate: ^2.0.2

//github  集成
dependencies:
  flutter_xupdate:
    git:
      url: git://github.com/xuexiangjys/flutter_xupdate.git
      ref: master

Setting up

Modify the Main App Theme to AppCompat,For example:

@drawable/launch_background ">

    

UseCase

Initialization

message) async { print(message); setState(() { _message = "$message"; }); }); } else { updateMessage("ios暂不支持XUpdate更新"); } } ">
  ///初始化
   void initXUpdate() {
     if (Platform.isAndroid) {
       FlutterXUpdate.init(
         ///是否输出日志
         debug: true,
         ///是否使用post请求
         isPost: false,
         ///post请求是否是上传json
         isPostJson: false,
         ///请求响应超时时间
         timeout: 25000,
         ///是否开启自动模式
         isWifiOnly: false,
         ///是否开启自动模式
         isAutoMode: false,
         ///需要设置的公共参数
         supportSilentInstall: false,
         ///在下载过程中,如果点击了取消的话,是否弹出切换下载方式的重试提示弹窗
         enableRetry: false
       ).then((value) {
         updateMessage("初始化成功: $value");
       }).catchError((error) {
         print(error);
       });

       FlutterXUpdate.setErrorHandler(
           onUpdateError: (Map message) async {
         print(message);
         setState(() {
           _message = "$message";
         });
       });
     } else {
       updateMessage("ios暂不支持XUpdate更新");
     }
   }

JSON Format

{
  "Code": 0, //0代表请求成功,非0代表失败
  "Msg": "", //请求出错的信息
  "UpdateStatus": 1, //0代表不更新,1代表有版本更新,不需要强制升级,2代表有版本更新,需要强制升级
  "VersionCode": 3,
  "VersionName": "1.0.2",
  "ModifyContent": "1、优化api接口。\r\n2、添加使用demo演示。\r\n3、新增自定义更新服务API接口。\r\n4、优化更新提示界面。",
  "DownloadUrl": "https://raw.githubusercontent.com/xuexiangjys/XUpdate/master/apk/xupdate_demo_1.0.2.apk",
  "ApkSize": 2048
  "ApkMd5": "..."  //md5值没有的话,就无法保证apk是否完整,每次都会重新下载。框架默认使用的是md5加密。
}

CheckUpdate

  ///默认App更新
  void checkUpdateDefault() {
    FlutterXUpdate.checkUpdate(url: _updateUrl);
  }

  ///默认App更新 + 支持后台更新
  void checkUpdateSupportBackground() {
    FlutterXUpdate.checkUpdate(url: _updateUrl, supportBackgroundUpdate: true);
  }

  ///调整宽高比
  void checkUpdateRatio() {
    FlutterXUpdate.checkUpdate(url: _updateUrl, widthRatio: 0.6);
  }

  ///强制更新
  void checkUpdateForce() {
    FlutterXUpdate.checkUpdate(url: mUpdateUrl2);
  }

  ///自动模式, 如果需要完全无人干预,自动更新,需要root权限【静默安装需要】
  void checkUpdateAutoMode() {
    FlutterXUpdate.checkUpdate(url: _updateUrl, isAutoMode: true);
  }

  ///下载时点击取消允许切换下载方式
  void enableChangeDownLoadType() {
    FlutterXUpdate.checkUpdate(
      url: _updateUrl,
      overrideGlobalRetryStrategy: true,
      enableRetry: true,
      retryContent: "Github下载速度太慢了,是否考虑切换蒲公英下载?",
      retryUrl: "https://www.pgyer.com/flutter_learn");
  }

Custom JSON Format

1.Setting up a custom update parser

FlutterXUpdate.setCustomParseHandler(onUpdateParse: (String json) async {
//Here is the custom JSON parsing
return customParseJson(json);
});

///Resolve the custom JSON content to the UpdateEntity entity class
UpdateEntity customParseJson(String json) {
  AppInfo appInfo = AppInfo.fromJson(json);
  return UpdateEntity(
      hasUpdate: appInfo.hasUpdate,
      isIgnorable: appInfo.isIgnorable,
      versionCode: appInfo.versionCode,
      versionName: appInfo.versionName,
      updateContent: appInfo.updateLog,
      downloadUrl: appInfo.apkUrl,
      apkSize: appInfo.apkSize);
}

2.Set the parameter isCustomParse to true

FlutterXUpdate.checkUpdate(url: _updateUrl3, isCustomParse: true);

Update By UpdateEntity Directly

///直接传入UpdateEntity进行更新提示
void checkUpdate8() {
    FlutterXUpdate.updateByInfo(updateEntity: customParseJson(_customJson));
}

Custom Update Prompt Style

Currently, only theme color and top picture customization are supported!

1.Configure top picture, Path: android/app/src/main/res/values/drawable, For example:

2.Set the parameter themeColortopImageRes and buttonTextColor

///自定义更新弹窗样式
void customPromptDialog() {
    FlutterXUpdate.checkUpdate(url: _updateUrl, themeColor: '#FFFFAC5D', topImageRes: 'bg_update_top', buttonTextColor: '#FFFFFFFF');
}

【Note】: When you use the command flutter build apk to make a release package, If you use the topImageRes property, you must configure shrinkResources to false, otherwise the pop-up window will display an exception!

Property value

Initialization

Name Type Default Description
debug bool false Whether Output log
isPost bool false Whether use post request
isPostJson bool false Whether post request upload json format
timeout int 20000(ms) Request response timeout
isWifiOnly bool true Whether update only under WiFi
isAutoMode bool false Whether to turn on automatic mode
supportSilentInstall bool false Whether to support silent installation requires that the device has root permission
enableRetry bool false In the process of downloading, if you click Cancel, whether the pop-up window for retrying to switch the download mode will pop up
retryContent String '' Try the prompt content of the prompt pop-up window again
retryUrl String '' Retrying prompt pop-up URL to jump after clicking
params Map / Public parameters to be set

CheckUpdate

Name Type Default Description
url String / URL of version check
params Map / Parameters
supportBackgroundUpdate bool false Whether to support background updates
isAutoMode bool false Whether to turn on automatic mode
isCustomParse bool false Is it a custom resolution protocol
themeColor String '' Apply pop-up theme color
topImageRes String '' The name of the top picture resource in the pop-up window
buttonTextColor String '' The color of the button text
widthRatio double / Proportion of version update Prompter width to screen
heightRatio double / Proportion of version update Prompter height to screen
overrideGlobalRetryStrategy bool false Whether to override the global retry policy
enableRetry bool false In the process of downloading, if you click Cancel, whether the pop-up window for retrying to switch the download mode will pop up
retryContent String '' Try the prompt content of the prompt pop-up window again
retryUrl String '' Retrying prompt pop-up URL to jump after clicking
Comments
  • 打正式包失败

    打正式包失败

    问题描述(必填) 正式包会提示缺失图片文件

    使用的flutter_xupdate版本(必填) 2.0.2

    如何重现(必填) 集成后无论是--release --verbose还是build apk,都会报缺失文件,但是开发不会

    截图 错误信息 image

    不知道是不是解决办法的解决办法是 image 我把这个注释了打包就没有问题了。更新貌似正常

    flutter 2.8.1

    opened by SilentlyYc 5
  • 关于传入对象下载时 下载进度条不更新的问题

    关于传入对象下载时 下载进度条不更新的问题

    下载进度条不更新的问题 我在使用你这个插件的时候 用的版本是 flutter_xupdate: ^0.0.3,下载方法是使用FlutterXUpdate.updateByInfo(updateEntity: customParseJson(urlJson)); 点击升级,如果没有权限,就弹出权限提示对话框,后面再点击升级,就出现有进度条,下载过程中进度条一直显示是0%。

    flutter_xupdate: ^0.0.3

    点击对话框中的升级按钮 重现的步骤: 点击更新对话中的升级按钮

    期望的效果 能够看到进度条的百分比和进度都有更新。

    @截图 `void showUploadDialog(AppVersionEntity appVersionEntity,bool isForce){ Map<String,dynamic> data = new Map(); data['hasUpdate'] = true; data['isForce'] = isForce; data['versionCode'] = 2; data['versionName'] = '${appVersionEntity.version}'; data['updateLog'] = '${appVersionEntity.modifyContent}'; data['apkUrl'] = '${appVersionEntity.androidDownUrl}'; data['apkSize'] = 4096; String urlJson = json.encode(data);

    FlutterXUpdate.updateByInfo(updateEntity: customParseJson(urlJson));
    

    }`

    设备信息 请填写一下你运行设备的信息,信息越全越有助于我理解问题

    • 设备名: [魅族pro6]
    • Android版本: [e.g. Android 7.1.1]
    • 设备型号 [e.g. ]
    • 系统版本(手机厂商定制rom)

    附加信息 在此处添加任何有关该问题的任何其他说明。

    opened by lgj860123 5
  • 查询失败:解析Json错误!

    查询失败:解析Json错误!

    .flutter_v1_example/cache/xupdate', mMd5='89341b4e1b484585252b91967b907b07', mSize=81000, mIsShowNotification=false}, mIsSilent=false, mIsAutoInstall=true, mIUpdateHttpService=com.xuexiang.flutter_xupdate.OKHttpUpdateHttpService@dc6aaa} E/ThemeUtils(14484): View class androidx.appcompat.widget.AppCompatImageView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant). E/ThemeUtils(14484): View class androidx.appcompat.widget.AppCompatImageView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant). W/System.err(14484): java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. W/System.err(14484): at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:843) W/System.err(14484): at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:806) W/System.err(14484): at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:684) W/System.err(14484): at androidx.appcompat.app.AppCompatDialog.setContentView(AppCompatDialog.java:100) W/System.err(14484): at com.xuexiang.xupdate.widget.BaseDialog.init(BaseDialog.java:79) W/System.err(14484): at com.xuexiang.xupdate.widget.BaseDialog.init(BaseDialog.java:75) W/System.err(14484): at com.xuexiang.xupdate.widget.BaseDialog.(BaseDialog.java:64) W/System.err(14484): at com.xuexiang.xupdate.widget.BaseDialog.(BaseDialog.java:51) W/System.err(14484): at com.xuexiang.xupdate.widget.UpdateDialog.(UpdateDialog.java:128) W/System.err(14484): at com.xuexiang.xupdate.widget.UpdateDialog.newInstance(UpdateDialog.java:119) W/System.err(14484): at com.xuexiang.flutter_xupdate.FlutterUpdatePrompter.showPrompt(FlutterUpdatePrompter.java:60) W/System.err(14484): at com.xuexiang.xupdate.UpdateManager.findNewVersion(UpdateManager.java:344) W/System.err(14484): at com.xuexiang.xupdate.utils.UpdateUtils.processUpdateEntity(UpdateUtils.java:92) W/System.err(14484): at com.xuexiang.xupdate.proxy.impl.DefaultUpdateChecker.processCheckResult(DefaultUpdateChecker.java:137) W/System.err(14484): at com.xuexiang.xupdate.proxy.impl.DefaultUpdateChecker.onCheckSuccess(DefaultUpdateChecker.java:102) W/System.err(14484): at com.xuexiang.xupdate.proxy.impl.DefaultUpdateChecker.access$000(DefaultUpdateChecker.java:46) W/System.err(14484): at com.xuexiang.xupdate.proxy.impl.DefaultUpdateChecker$1.onSuccess(DefaultUpdateChecker.java:65) W/System.err(14484): at com.xuexiang.flutter_xupdate.OKHttpUpdateHttpService$1.onResponse(OKHttpUpdateHttpService.java:82) W/System.err(14484): at com.xuexiang.flutter_xupdate.OKHttpUpdateHttpService$1.onResponse(OKHttpUpdateHttpService.java:74) W/System.err(14484): at com.zhy.http.okhttp.OkHttpUtils$3.run(OkHttpUtils.java:186) W/System.err(14484): at android.os.Handler.handleCallback(Handler.java:938) W/System.err(14484): at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err(14484): at android.os.Looper.loop(Looper.java:263) W/System.err(14484): at android.app.ActivityThread.main(ActivityThread.java:7810) W/System.err(14484): at java.lang.reflect.Method.invoke(Native Method) W/System.err(14484): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) W/System.err(14484): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952) I/flutter (14484): {code: 2006, detailMsg: Code:2006, msg:查询失败:解析Json错误!(You need to use a Theme.AppCompat theme (or descendant) with this activity.), message: 查询失败:解析Json错误!(You need to use a Theme.AppCompat theme (or descendant) with this activity.)}

    bug 
    opened by GuoGuoX 4
  • release版本升级的问题。

    release版本升级的问题。

    您好,我在IDE中调试运行的时候可以升级,把应用使用flutter build apk --release打包成release版本后,就没有升级提示,但是能获取版本信息的json。 { "Code": 0, "Msg": "", "UpdateStatus": 2, "VersionCode": 3, "VersionName": "3.0.0", "UploadTime": "2020-02-20 08:00:00", "ModifyContent": "\r\n1、增加了账号系统。\r\n2、增加了语言和皮肤主题的切换功能。\r\n3、还有更多新增的案例待你去发现。", "DownloadUrl": "https://wap.rzport.com/exam/android/exam.apk", "ApkSize": 23338, "ApkMd5": "D07D86E9C8C57715145D1E64AFAFB1EE" }

    我新建了一个页面内容如下:

      void initState() {
        super.initState();
        _initXUpdate();
      }
    
      ///初始化
      Future _initXUpdate() async {
        print(Platform.isAndroid);
        if (Platform.isAndroid) {
          FlutterXUpdate.init(
                  debug: true,
                  isPost: false,
                  isPostJson: false,
                  isWifiOnly: false,
                  isAutoMode: false,
                  supportSilentInstall: false,
                  enableRetry: false)
              .then((value) {
            print("exam初始化成功: $value");
          }).catchError((error) {
            print(error);
          });
          FlutterXUpdate.setCustomParseHandler(onUpdateParse: (String json) async {
            return customParseJson(json);
          });
    
          FlutterXUpdate.setUpdateHandler(
            onUpdateError: (Map<String, dynamic> message) async {
              print(message);
            },
            onUpdateParse: (String json) async {
              return customParseJson(json);
            },
          );
        } else {
          print("ios暂不支持XUpdate更新");
        }
      }
    
      UpdateEntity customParseJson(String json) {
        VersionInfo appInfo = VersionInfo.fromJson(json);
        print(appInfo);
        return UpdateEntity(
            hasUpdate: appInfo.hasUpdate,
            isIgnorable: appInfo.isIgnorable,
            versionCode: appInfo.versionCode,
            versionName: appInfo.versionName,
            updateContent: appInfo.updateLog,
            downloadUrl: appInfo.apkUrl,
            apkSize: appInfo.apkSize);
      }```
    
    

    创建了一个按钮,点击调用 FlutterXUpdate.checkUpdate( url: "https://xxxxxx/version.json"); },

    release版本后,点击按钮,没有更新提示,不知道什么地方出问题了,请指教。谢谢了。

    opened by xdnice 4
  • 在调用FlutterXUpdate.updateByInfo控制台打印W/libEGL  (19625): EGLNativeWindowType 0x76e978a010 disconnect failed  界面无反应

    在调用FlutterXUpdate.updateByInfo控制台打印W/libEGL (19625): EGLNativeWindowType 0x76e978a010 disconnect failed 界面无反应

    这是我调用初始化的方法 FlutterXUpdate.init(

              ///是否输出日志
              debug: true,
    
              ///是否使用post请求
              isPost: false,
    
              ///post请求是否是上传json
              isPostJson: false,
    
              ///请求响应超时时间
              timeout: 25000,
    
              ///是否开启自动模式
              isWifiOnly: true,
    
              ///是否开启自动模式
              isAutoMode: false,
    
              ///需要设置的公共参数
              supportSilentInstall: false,
    
              ///在下载过程中,如果点击了取消的话,是否弹出切换下载方式的重试提示弹窗
              enableRetry: false)
          .then((value) {
        print("初始化成功: $value");
      }).catchError((error) {
        print(error);
      });
    

    控制台打印
    [GETX] Instance "HomeLogic" has been created DXUpdate: 设置全局是否使用的是Get请求:true DXUpdate: 设置全局是否只在wifi下进行版本更新检查:true DXUpdate: 设置全局是否是自动版本更新模式:false DXUpdate: 设置全局参数, key:versionCode, value:1 DXUpdate: 设置全局参数, key:appKey, value:com.hykc.cityfreight DXUpdate: 设置请求超时响应时间:25000ms, 是否使用json:false DXUpdate: 设置全局更新网络请求服务:com.xuexiang.flutter_xupdate.OKHttpUpdateHttpService I/flutter (19625): 初始化成功: {isPostJson: false, isGet: true, debug: true, retryContent: , isWifiOnly: true, isAutoMode: false, supportSilentInstall: false, retryUrl: , params: null, enableRetry: false, timeout: 25000}

    下面是我调用更新的方法 FlutterXUpdate.updateByInfo( updateEntity: UpdateEntity( hasUpdate: true, updateContent: _upgradeInfo.newFeature, downloadUrl: _upgradeInfo.apkUrl, versionCode: _upgradeInfo.versionCode, versionName: _upgradeInfo.versionName, isForce: _upgradeInfo.upgradeType == 2, apkSize: _upgradeInfo.fileSize), supportBackgroundUpdate: true, topImageRes: 'bg_update_top', themeColor: '#FFFF9800', buttonTextColor: '#FFFFFFFF', ); apkUrl
    apkUrl = https://outexp-beta.cdn.qq.com/outbeta/2022/02/18/comhykccityfreight_1.0.1_327d179c-089c-52f8-9d09-583e18a51b04.apk 安卓也进行配置 项目运行的配置环境 [✓] Flutter (Channel stable, 2.10.1, on macOS 12.1 21C52 darwin-x64, locale zh-Hans-US) • Flutter version 2.10.1 at /Users/hanqiang/Desktop/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision db747aa133 (9 days ago), 2022-02-09 13:57:35 -0600 • Engine revision ab46186b24 • Dart version 2.16.1 • DevTools version 2.9.2 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn

    [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0-rc1) • Android SDK at /Users/hanqiang/Library/Android/sdk • Platform android-31, build-tools 32.0.0-rc1 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822) • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2

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

    [✓] Android Studio (version 2021.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 11.0.11+0-b60-7590822) [✓] VS Code (version 1.64.2) • VS Code at /Users/hanqiang/Desktop/Visual Studio Code.app/Contents • Flutter extension version 3.34.0

    [✓] Connected device (3 available) • HUAWEI NXT AL10 (mobile) • CJL7N15C15007365 • android-arm64 • Android 8.0.0 (API 26) • macOS (desktop) • macos • darwin-x64 • macOS 12.1 21C52 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69 运行的手机 HUAWEI NXT AL10 (mobile) • CJL7N15C15007365 • android-arm64 • Android 8.0.0 (API 26)

    bug 
    opened by qq627314025 3
  • 更新依据会判断versionName吗,versionCode我应该如何处理

    更新依据会判断versionName吗,versionCode我应该如何处理

    问题描述(必填) VersionCode如何手动设置,比如我一开始是链接下载的,他其实和线上是相同版本,但是点击查询更新,因为本地的VersionCode没有,他就会认为是需要更新

    使用的flutter_xupdate版本(必填) 2.0.2

    如何重现(必填) 重现的步骤:

    1. 链接下载1.1.0版本APP
    2. 线上update.json文件 为{"VersionName": "1.1.0","VersionCode": 4,"UpdateStatus": 1,}
    3. 点击查询更新
    4. 展示需要更新

    期望的效果 1.需要能够本地设置code 2.或者是我的使用方式不正确

    截图 image

    bug 
    opened by cn1001wang 3
  • 您好,请问一下有没有

    您好,请问一下有没有"点击"升级按钮后的回调事件

    问题描述(必填) 需求:需要在点击"升级"按钮后,调用后端升级数量 + 1的接口 我在文档里没有找到类似的回调事件

    使用的flutter_xupdate版本(必填) 2.0.1

    期望的效果 希望有一个点击"升级"按钮的回调

    设备信息 请填写一下你运行设备的信息,信息越全越有助于我理解问题

    • 设备名: 华为P20
    • Android版本: Android10
    bug 
    opened by hg542006810 3
  • 更新 flutter 后打包正式版本无法更新

    更新 flutter 后打包正式版本无法更新

    更新 flutter 后打包正式版本无法更新

    对问题进行清晰而简明的描述,把握问题的关键点。

    使用的flutter_xupdate版本:1.0.2

    如何重现(必填) 重现的步骤: cd ./android ./gradlew assembleRelease 打包成功 输出

    Configure project :flutter_xupdate WARNING: The option setting 'android.enableR8=true' is deprecated. It will be removed in version 5.0 of the Android Gradle plugin. You will no longer be able to disable R8 Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings BUILD SUCCESSFUL in 34s

    我的一些相关配置 如wiki-常见问题 我使用了原生打包,无论是否主动关闭R8压缩,都没有解决在手机上无法更新的问题 我的 build.grade :

    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"
    apply plugin: 'com.google.gms.google-services'
    
    def keystorePropertiesFile = rootProject.file("key.properties")
    def keystoreProperties = new Properties()
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    
    android {
        compileSdkVersion 30
    
        sourceSets {
            main.java.srcDirs += 'src/main/kotlin'
        }
    
        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "com.yuque.vyan"
            minSdkVersion 17
            targetSdkVersion 30
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
            // testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    
            ndk {
                abiFilters "arm64-v8a" //abiFilters "armeabi-v7a", "armeabi", "arm64-v8a", "x86"
            }
        }
    
        signingConfigs {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile file(keystoreProperties['storeFile'])
                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
            }
            debug {
                // signingConfig signingConfigs.release
            }
        }
    }
    
    flutter {
        source '../..'
    }
    
    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation 'com.google.firebase:firebase-analytics:17.2.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test:runner:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    }
    
    

    我的 gradle.properties

    org.gradle.jvmargs=-Xmx1536M
    android.enableD8=true
    android.useAndroidX=true
    android.enableJetifier=true
    # android.enableR8=false
    

    期望的效果 希望打包成功且release安装在手机上可以支持更新

    设备信息

    • 设备名: vivo iqoo z1
    • Android版本: Android 10
    • 设备型号 V1986A
    • 系统版本 IQOOUI OD1986C_A_1.10.18
    bug 
    opened by aboutmydreams 3
  • > 希望能够支持压缩后的Apk,否则太大了影响用户下载

    > 希望能够支持压缩后的Apk,否则太大了影响用户下载

    你如果用的是flutter build apk --release命令的话,建议增加如下配置试一下:

        buildTypes {
            release {
                minifyEnabled false
                shrinkResources false
                signingConfig signingConfigs.debug
            }
        }
    

    能兼容 压缩资源跟压缩代码那

    Originally posted by @li305263 in https://github.com/xuexiangjys/flutter_xupdate/issues/3#issuecomment-603121160

    opened by aboutmydreams 3
  • updateHttpService == null

    updateHttpService == null

    我使用: FlutterXUpdate.updateByInfo(updateEntity: customParseJson(data));

    ///将自定义的json内容解析为UpdateEntity实体类 UpdateEntity customParseJson(dynamic json) { UpdateInfoModel appInfo = UpdateInfoModel.fromJson(json); return UpdateEntity( hasUpdate: true, versionCode: 1, versionName: appInfo.newVersion, updateContent: appInfo.updateDescription, downloadUrl: appInfo.apkUrl, ); }

    提示错误信息如下:

    E/MethodChannel#com.xuexiang/flutter_xupdate(12255): Failed to handle method call E/MethodChannel#com.xuexiang/flutter_xupdate(12255): java.lang.NullPointerException: [UpdateManager.Builder] : updateHttpService == null E/MethodChannel#com.xuexiang/flutter_xupdate(12255): at com.xuexiang.xupdate.utils.UpdateUtils.requireNonNull(UpdateUtils.java:111) E/MethodChannel#com.xuexiang/flutter_xupdate(12255): at com.xuexiang.xupdate.UpdateManager$Builder.build(UpdateManager.java:837) E/MethodChannel#com.xuexiang/flutter_xupdate(12255): at com.xuexiang.flutter_xupdate.FlutterXUpdatePlugin.updateByInfo(FlutterXUpdatePlugin.java:222) E/MethodChannel#com.xuexiang/flutter_xupdate(12255): at com.xuexiang.flutter_xupdate.FlutterXUpdatePlugin.onMethodCall(FlutterXUpdatePlugin.java:77) E/MethodChannel#com.xuexiang/flutter_xupdate(12255): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262) E/MethodChannel#com.xuexiang/flutter_xupdate(12255): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296) E/MethodChannel#com.xuexiang/flutter_xupdate(12255): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320) E/MethodChannel#com.xuexiang/flutter_xupdate(12255): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)

    bug 
    opened by huanlirui 2
  • Could not resolve com.github.xuexiangjys:XUpdate:2.0.7.

    Could not resolve com.github.xuexiangjys:XUpdate:2.0.7.

    image

    Could not determine the dependencies of task ':app:lintVitalRelease'.

    Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'. Could not resolve com.github.xuexiangjys:XUpdate:2.0.7. quired by: project :app > project :flutter_xupdate > Could not resolve com.github.xuexiangjys:XUpdate:2.0.7. > Could not get resource 'https://dl.bintray.com/umsdk/release/com/github/xuexiangjys/XUpdate/2.0.7/XUpdate-2.0.7.pom'. > Could not HEAD 'https://dl.bintray.com/umsdk/release/com/github/xuexiangjys/XUpdate/2.0.7/XUpdate-2.0.7.pom'. Received status code 502 from server: Bad Gateway

    opened by SinoMiles 2
  • Configure Renovate

    Configure Renovate

    Mend Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • .github/workflows/issue_check.yml (github-actions)
    • .github/workflows/pub_publish.yml (github-actions)
    • android/gradle.properties (gradle)
    • android/settings.gradle (gradle)
    • android/build.gradle (gradle)
    • example/android/gradle.properties (gradle)
    • example/android/settings.gradle (gradle)
    • example/android/build.gradle (gradle)
    • example/android/app/build.gradle (gradle)
    • android/gradle/wrapper/gradle-wrapper.properties (gradle-wrapper)
    • example/android/gradle/wrapper/gradle-wrapper.properties (gradle-wrapper)
    • example/pubspec.yaml (pub)
    • pubspec.yaml (pub)

    Configuration Summary

    Based on the default config's presets, Renovate will:

    • Start dependency updates only once this onboarding PR is merged
    • Enable Renovate Dependency Dashboard creation.
    • If Renovate detects semantic commits, it will use semantic commit type fix for dependencies and chore for all others.
    • Ignore node_modules, bower_components, vendor and various test/tests directories.
    • Autodetect whether to pin dependencies or maintain ranges.
    • Rate limit PR creation to a maximum of two per hour.
    • Limit to maximum 10 open PRs at any time.
    • Group known monorepo packages together.
    • Use curated list of recommended non-monorepo package groupings.
    • A collection of workarounds for known problems with packages.

    🔡 Would you like to change the way Renovate is upgrading your dependencies? Simply edit the renovate.json in this branch with your custom config and the list of Pull Requests in the "What to Expect" section below will be updated the next time Renovate runs.


    What to Expect

    With your current configuration, Renovate will create 15 Pull Requests:

    Update dependency gradle to v5.6.4
    • Schedule: ["at any time"]
    • Branch name: renovate/gradle-5.x
    • Merge into: master
    • Upgrade gradle to 5.6.4
    Update dependency androidx.appcompat:appcompat to v1.5.1
    • Schedule: ["at any time"]
    • Branch name: renovate/androidx.appcompat-appcompat-1.x
    • Merge into: master
    • Upgrade androidx.appcompat:appcompat to 1.5.1
    Update dependency androidx.test.espresso:espresso-core to v3.5.0
    • Schedule: ["at any time"]
    • Branch name: renovate/androidx.test.espresso-espresso-core-3.x
    • Merge into: master
    • Upgrade androidx.test.espresso:espresso-core to 3.5.0
    Update dependency androidx.test:runner to v1.5.1
    • Schedule: ["at any time"]
    • Branch name: renovate/androidx.test-runner-1.x
    • Merge into: master
    • Upgrade androidx.test:runner to 1.5.1
    Update dependency com.android.tools.build:gradle to v3.6.4
    • Schedule: ["at any time"]
    • Branch name: renovate/com.android.tools.build-gradle-3.x
    • Merge into: master
    • Upgrade com.android.tools.build:gradle to 3.6.4
    Update dependency com.google.code.gson:gson to v2.10
    • Schedule: ["at any time"]
    • Branch name: renovate/com.google.code.gson-gson-2.x
    • Merge into: master
    • Upgrade com.google.code.gson:gson to 2.10
    Update dependency com.squareup.okhttp3:okhttp to v3.14.9
    • Schedule: ["at any time"]
    • Branch name: renovate/com.squareup.okhttp3-okhttp-3.x
    • Merge into: master
    • Upgrade com.squareup.okhttp3:okhttp to 3.14.9
    Update dependency junit:junit to v4.13.2
    • Schedule: ["at any time"]
    • Branch name: renovate/junit-junit-4.x
    • Merge into: master
    • Upgrade junit:junit to 4.13.2
    Update sakebook/actions-flutter-pub-publisher action to v1.4.1
    Update actions/checkout action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-checkout-3.x
    • Merge into: master
    • Upgrade actions/checkout to v3
    Update dependency com.android.tools.build:gradle to v7
    • Schedule: ["at any time"]
    • Branch name: renovate/com.android.tools.build-gradle-7.x
    • Merge into: master
    • Upgrade com.android.tools.build:gradle to 7.3.1
    Update dependency com.squareup.okhttp3:okhttp to v4
    • Schedule: ["at any time"]
    • Branch name: renovate/com.squareup.okhttp3-okhttp-4.x
    • Merge into: master
    • Upgrade com.squareup.okhttp3:okhttp to 4.10.0
    Update dependency cupertino_icons to v1
    • Schedule: ["at any time"]
    • Branch name: renovate/cupertino_icons-1.x
    • Merge into: master
    • Upgrade cupertino_icons to ^1.0.0
    Update dependency gradle to v7
    • Schedule: ["at any time"]
    • Branch name: renovate/gradle-7.x
    • Merge into: master
    • Upgrade gradle to 7.6
    Update dependency package_info_plus to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/package_info_plus-3.x
    • Merge into: master
    • Upgrade package_info_plus to ^3.0.0

    🚸 Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • 升级时下载了安装包后没有弹出xupdate的安装窗口

    升级时下载了安装包后没有弹出xupdate的安装窗口

    问题描述(必填) 下载完apk文件后没有弹出安装窗口. 尝试了发布多个版本的APK, 有一个(1.0.8)可以成功安装,但其他的(如1.0.7和1.0.9)全卡在了升级之后的步骤. apkMD5已设置且用官方demoapk确认计算无误 APK签名均为release签名,且经过人工的keytool命令查询确认 versionCode分别为107(失败),108(成功)和109(失败) 所有版本均可以人工下载安装 在另外的鸿蒙和Android9的手机下测试都是同样的结果 所有APK打包方式均相同,唯一区别是 pubspec.yaml 下 version 字段不同, 分别为 1.0.7+107, 1.0.8+108 和 1.0.9+109

    使用的flutter_xupdate版本(必填) 1.0.8

    如何重现(必填) 重现的步骤:

    1. 进入APP
    2. 弹出升级窗口,点击升级
    3. 下载完成后无后续响应

    期望的效果 下载完成后弹出安装窗口

    设备信息 请填写一下你运行设备的信息,信息越全越有助于我理解问题

    • 设备名: 华为 HONOR Play4T Pro
    • Android版本: HarmonyOS 2.0.0
    • 设备型号 AQM-AL10
    • 系统版本 2.0.0.269

    附加信息

    opened by hmlss 3
  • 不支持flutter3.0.0

    不支持flutter3.0.0

    提Bug前需要做的事情

    1.如果是集成问题的话,请保证仔细按照集成指南的步骤,一步一步来,不要跳步骤! 2.详细阅读过使用手册,并且确保是框架的问题。 3.参考常见问题,可以解决你出现的绝大多数问题!

    如果以上都不能解决你的问题,那么请按照以下说明仔细填写信息,这里需要说明的是:不符合填写要求的issue一律不予理会,希望这样能节约大家的时间!


    问题描述(必填) 对问题进行清晰而简明的描述,把握问题的关键点。

    使用的flutter_xupdate版本(必填)

    如何重现(必填) 重现的步骤:

    1. Go to '...'
    2. Click on '....'
    3. Scroll down to '....'
    4. See error

    期望的效果 对你期望的效果进行清晰而简明的描述。

    截图 如果方便的话,贴一下程序截图和代码片段以帮助解释您的问题。

    设备信息 请填写一下你运行设备的信息,信息越全越有助于我理解问题

    • 设备名: [e.g. 华为P20]
    • Android版本: [e.g. Android 7.0]
    • 设备型号 [e.g. ]
    • 系统版本(手机厂商定制rom)

    附加信息 在此处添加任何有关该问题的任何其他说明。

    bug 
    opened by gcming 0
  • 遇到问题如何解决?

    遇到问题如何解决?

    遇到问题如何解决?

    这里我简单提供几个解决问题的方法:

    • 查阅文档,寻找相关的使用说明:https://github.com/xuexiangjys/flutter_xupdate/wiki
    • 查阅常见问题,是否有类似问题的解决方法: https://github.com/xuexiangjys/flutter_xupdate/wiki/常见问题
    • 观看flutter_xupdate系列视频: https://space.bilibili.com/483850585/channel/detail?cid=168279
    • 在flutter_xupdate的官方Discussions中寻求帮助: https://github.com/xuexiangjys/flutter_xupdate/discussions
    • 如果确认是问题,可在issue里面按模板填写出错信息,我将在一周之内予以解决!
    opened by xuexiangjys 0
Owner
薛翔
微信公众号:我的Android开源之旅。 知行合一,上善若水
薛翔
A Flutter plugin that exposes Monet (Material You, Material 3) system colors on Android 12.

Monet Colors A Flutter plugin that exposes Monet (Material You, Material 3) system colors on Android 12. Returns null on unsupported platforms and lea

İhsan Işık 3 Aug 26, 2022
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Luke Pighetti 3.5k Jan 4, 2023
Scribble is a lightweight library for freehand drawing in Flutter supporting pressure, variable line width and more!

Scribble Scribble is a lightweight library for freehand drawing in Flutter supporting pressure, variable line width and more! A

Tim Created It. 73 Dec 16, 2022
The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

null 2 Oct 8, 2021
Redux Compact is a library that aims to reduce the massive amount of boilerplate that follows maintaining a Flutter Redux application.

Redux Compact Redux Compact is a library that aims to reduce the massive amount of boilerplate that follows maintaining a Flutter Redux application. T

Ómar Óskarsson 9 Apr 8, 2022
A Flutter library to make Rest API clients more easily. Inspired by Java Feing.

A Flutter library to make Rest API clients more easily. Inspired by Java Feing. Features Facilitated JSON encode and decode using common interfaces. F

null 2 Mar 15, 2022
Flutter library to add gestures and animations to each Shape you draw on your canvas in your CustomPainter

Flutter library to bring your CustomPainter ?? to Life ✨ ⚡️ touchable library gives you the ability to add various gestures and animations to each Sha

Natesh Bhat 190 Jan 7, 2023
Flutter library that handles BLE operations for multiple devices

Flutter reactive BLE library Flutter library that handles BLE operations for multiple devices. Usage The reactive BLE lib supports the following: BLE

null 1 Apr 12, 2022
A Dart library to parse Portable Executable (PE) format

pefile A Dart library to parse Portable Executable (PE) format Usage A simple usage example: var pe = pefile.parse('C:\\Windows\\System32\\notepad.exe

null 4 Sep 12, 2022
This library contains methods that make it easy to consume Mpesa Api.

This library contains methods that make it easy to consume Mpesa Api. It's multi-platform, and supports CLI, server, mobile, desktop, and the browser.

Eddie Genius 3 Dec 15, 2021
An alternative random library for Dart.

Randt Randt library for Dart... Description Use Randt to get a random integer from a list, generate random integer in a specific range and generate ra

Bangladesh Coding Soldierz 3 Nov 21, 2021
A library for YAML manipulation with comment and whitespace preservation.

Yaml Editor A library for YAML manipulation while preserving comments. Usage A simple usage example: import 'package:yaml_edit/yaml_edit.dart'; void

Dart 17 Dec 26, 2022
A comprehensive, cross-platform path manipulation library for Dart.

A comprehensive, cross-platform path manipulation library for Dart. The path package provides common operations for manipulating paths: joining, split

Dart 159 Dec 29, 2022
Boilerplate-free form validation library

Valform Boilerplate-free form validation library. Preface Why? Why not Formz? Why Valform? Getting started Simple Usage Inspiration Why? There is no c

Alexander Farkas 3 Nov 14, 2021
Boilerplate-free form validation library

Trigger Boilerplate-free form validation library. Preface Why? Why not Formz? Why Trigger? Getting started Simple Usage Inspiration Why? There is no c

Alexander Farkas 3 Nov 14, 2021
A fast algorithm for finding polygon pole of inaccessibility implemented as a Dart library.

polylabel Dart port of https://github.com/mapbox/polylabel. A fast algorithm for finding polygon pole of inaccessibility implemented as a Dart library

André Sousa 2 Nov 13, 2021
Dart library for unescaping HTML-encoded strings

html_unescape A Dart library for unescaping HTML-encoded strings. Supports: Named Character References ( ) 2099 of them Decimal Character Referen

Filip Hracek 36 Dec 20, 2022
The `TypedEventNotifier` library allows notifying listeners with an object.

The TypedEventNotifier library allows notifying listeners with an object. listeners can be subscribed to only a special type or group of objects.

Evgeniy Ilyin 0 Nov 13, 2021
A utility library to automate mobile emulators.

emulators A utility library to automate mobile emulators. Can be used to automate screenshots on multiple devices. Example project https://github.com/

Tim 21 Nov 13, 2022