gradle_desugar_classes_test.dart 1.64 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:io';

import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';


Future<void> main() async {
  await task(() async {
    try {
      await runProjectTest((FlutterProject flutterProject) async {
        section('APK contains plugin classes');
18
        flutterProject.addPlugin('google_maps_flutter', value: '^1.0.10');
19 20 21 22 23 24 25 26 27

        await inDirectory(flutterProject.rootPath, () async {
          await flutter('build', options: <String>[
            'apk',
            '--debug',
            '--target-platform=android-arm',
          ]);
          final File apk = File('${flutterProject.rootPath}/build/app/outputs/flutter-apk/app-debug.apk');
          if (!apk.existsSync()) {
28
            throw TaskResult.failure("Expected ${apk.path} to exist, but it doesn't");
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
          }
          // https://github.com/flutter/flutter/issues/72185
          await checkApkContainsMethods(apk, <String>[
            'io.flutter.plugins.googlemaps.GoogleMapController void onFlutterViewAttached(android.view.View)',
            'io.flutter.plugins.googlemaps.GoogleMapController void onFlutterViewDetached()',
          ]);
        });
      });
      return TaskResult.success(null);
    } on TaskResult catch (taskResult) {
      return taskResult;
    } catch (e) {
      return TaskResult.failure(e.toString());
    }
  });
}