GithubHelp home page GithubHelp logo

user-23xyz / flutter_appcenter_bundle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hanabi1224/flutter_appcenter_bundle

1.0 0.0 0.0 349 KB

License: MIT License

Ruby 1.63% Objective-C 1.27% Kotlin 9.92% Dart 12.99% Swift 7.37% CMake 29.14% C++ 32.62% C 2.22% HTML 2.84%

flutter_appcenter_bundle's Introduction

AppCenter Plugin for flutter

pub package Build status

This plugin currently bundles appcenter analytics, crashes and distribute.

Getting Started

To get started, go to AppCenter and register your apps.

For detailed AppCenter API reference, go to https://aka.ms/appcenterdocs

Build

Appcenter distribute has an issue with pulishing apps to google play. To workaround

use flutter build --flavor googlePlay to build for googlePlay and flutter build --flavor appCenter for appCenter.

flutter build apk command will build both under build/app/outputs/flutter-apk by adding below section to android/app/build.gradle

android {
  ...

  flavorDimensions "distribute"
  productFlavors {
      appCenter {
          dimension "distribute"
      }

      googlePlay {
          dimension "distribute"
      }
  }

  // This is likely needed, see https://github.com/flutter/flutter/issues/58247
  lintOptions {
      disable 'InvalidPackage'
      checkReleaseBuilds false
  }
}

Already having flavor settings and want to merge? Checkout example project. Please note that flavor dimensions are orthogonal. You may just want to reuse distribute flavor for the best build performance. Check out this article for details.

android {
  flavorDimensions "dummy", "distribute"
  productFlavors {
      dummyFoo {
          dimension "dummy"
      }
      dummyBar {
          dimension "dummy"
      }
      appCenter {
          dimension "distribute"
      }

      googlePlay {
          dimension "distribute"
      }
  }
}

Try example project first when troubleshooting your local build issue.

Usage

Basic usage

import 'package:flutter_appcenter_bundle/flutter_appcenter_bundle.dart';

await AppCenter.startAsync(
    appSecretAndroid: '******',
    appSecretIOS: '******',
    enableAnalytics: true, // Defaults to true
    enableCrashes: true, // Defaults to true
    enableDistribute: true, // Defaults to false
    usePrivateDistributeTrack: false, // Defaults to false
    disableAutomaticCheckForUpdate: false, // Defaults to false
  );
  
AppCenter.trackEventAsync('my event', <String, String> {
  'prop1': 'prop1',
  'prop2': 'prop2',
});

Turn feature on / off at runtime

await AppCenter.configureAnalyticsAsync(enabled: true);

await AppCenter.configureCrashesAsync(enabled: true);

await AppCenter.configureDistributeAsync(enabled: true);

await AppCenter.configureDistributeDebugAsync(enabled: true); // Android Only

await AppCenter.checkForUpdateAsync(); // Manually check for update

Troubleshooting

  • iOS: [!] CocoaPods could not find compatible versions for pod "AppCenter"

    Manually delete podfile.lock and rebuild, this is a common issue when upgrading iOS native dependencies.

  • Android build issue

    Always check if example project builds first If it does not build, please report an issue If it builds, check the gradle setup Checkpoints:

    • Gradle version in gradle-wrapper.properties

    • Kotlin version in build.gradle

    • compileSdkVersion in build.gradle

    • com.android.tools.build:gradle version in build.gradle

    • lintOptions (in example) See issue

      Execution failed for task ':app:lintVitalAppCenterRelease'

    • build.gradle script (in example)

    • settings.gradle (in example)

  • jcenter retirement

    Replace jcenter since it will be retired on 1st of May, 2021.

    repositories {
         google()
         // jcenter()
         mavenCentral()
         gradlePluginPortal()
     }

flutter_appcenter_bundle's People

Contributors

hanabi1224 avatar user-23xyz avatar augustg avatar zazo032 avatar jhonatan-3a avatar mkobuolys avatar samarlavaloon avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.