Skip to content

Firebase-Cloud-Messaging #2688

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

Closed
tronantonio opened this issue Jun 2, 2020 · 8 comments
Closed

Firebase-Cloud-Messaging #2688

tronantonio opened this issue Jun 2, 2020 · 8 comments
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. closed-by-bot Stale Issue with no recent activity

Comments

@tronantonio
Copy link

I add firebase messaging version 6.0.16 from the pub.dev website and follow the instructions. When I add the java class Application.java I get various errors when import io.flutter.pluggins.firebasemessaging which is not found or resolved.

To Reproduce
1 Create new application using android studio with flutter and dart.
2 Create an application in firebase console and configure your app in android studio following the instrucctions.
3 Add Firebase Messaging 6.0.16 in pubspec.yaml file from https://pub.dev/packages/firebase_messaging#android-integration
4 Follow the instructions to the point 4 and continue with "Optionally handle background messages" apart next.
5 This apart have 6 points. In point 2, when I add java class named Application.java I found the errors described (see picture). At this point 2, android studio dont resolve "import io.flutter.plugins.firebasemessaging....". If I complete the steps the errors persists and It's impposible continue with the app.

Expected behavior
I expected to correctly configure the plugin but I cant.

Additional context
In Application.java in line "import io.flutter.plugins.firebasemessaging...." Android Studio show the error: "cannot resolve simbol firebasemessaging".
In Application.java, in line " FlutterFirebaseMessagingService.setPluginRegistrant(this);" Android Studio show the error: "cannot resolve simbol FlutterFirebaseMessagingService"
And in line "GeneratedPluginRegistrant.registerWith(registry);" (Application.java) Android Studio show another error.

Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.17.2, on Microsoft Windows [Versión 10.0.18363.836], locale es-ES)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[√] VS Code (version 1.45.1)
[√] Connected device (1 available)

• No issues found!

Picture show errors when add Application.java
application screen
build.gradle android level
buildscript {
repositories {
google()
jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.3'
    classpath 'com.google.gms:google-services:4.3.2'
}

}

allprojects {
repositories {
google()
jcenter()
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gradle on app level
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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'

dependencies {
// add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-messaging:20.2.0'
// add SDKs for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
}

android {
compileSdkVersion 28

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.canovasconsulting.serpol"
    minSdkVersion 28
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

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.debug
    }
}

}

flutter {
source '../..'
}
Others
I change data in AndroidManifest.xml acording with instruccions:
....
Is gradle problem? Or plugin problem? I need help with this. Thanks

@TahaTesser
Copy link

TahaTesser commented Jun 3, 2020

Hi @tronantonio
Please make sure you've this in your AndroidManifest.xml and don't forget o Application.java in your manifest and uninstall previous version and run again

        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />

Can you please provide your flutter doctor -v, your flutter run --verbose and a minimal complete reproducible code sample.
Thank you

@TahaTesser TahaTesser added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Jun 3, 2020
@tronantonio
Copy link
Author

tronantonio commented Jun 3, 2020

Hi, I really have these lines in my android manifest xml file.
The problem is that compile procces stops when arrived to Application.java file because it cannot resolve some dependencies (see the picture up)

my Main.dart:

import 'dart:async';

import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';

Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) {
  if (message.containsKey('data')) {
    // Handle data message
    final dynamic data = message['data'];
  }

  if (message.containsKey('notification')) {
    // Handle notification message
    final dynamic notification = message['notification'];
  }

  // Or do other work.
}

void main() {

  WidgetsFlutterBinding.ensureInitialized();

  FirebaseMessaging _fb = FirebaseMessaging();

  _fb.configure(
    onMessage: (Map<String, dynamic> message) async {
      print("onMessage: $message");
     // _showItemDialog(message);
    },
    onBackgroundMessage: myBackgroundMessageHandler,
    onLaunch: (Map<String, dynamic> message) async {
      print("onLaunch: $message");
      //_navigateToItemDetail(message);
    },
    onResume: (Map<String, dynamic> message) async {
      print("onResume: $message");
     // _navigateToItemDetail(message);
    },
  );

  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
          ],
        ),
      ),
    );
  }
}
**Flutter doctor -v**
Microsoft Windows [Versión 10.0.18363.836]
(c) 2019 Microsoft Corporation. Todos los derechos reservados.
n\Documents\FlutterProjects\serpol>flutter doctor -v
[√] Flutter (Channel stable, v1.17.2, on Microsoft Windows [Versión 10.0.18363.836], locale es-ES)
    • Flutter version 1.17.2 at C:\flutter
    • Framework revision 5f21edf8b6 (6 days ago), 2020-05-28 12:44:12 -0700
    • Engine revision b851c71829
    • Dart version 2.8.3


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\Tron\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.45.1)
    • VS Code at C:\Users\Tron\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.10.2

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!

Run -verbose

[  +15 ms] executing: [C:\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +44 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 5f21edf8b66e31a39133177319414395cc5b5f48
[        ] executing: [C:\flutter/] git tag --contains HEAD
[ +161 ms] Exit code 0 from: git tag --contains HEAD
[        ] 1.17.2
[   +6 ms] executing: [C:\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +26 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\flutter/] git ls-remote --get-url origin
[  +25 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +72 ms] executing: [C:\flutter/] git rev-parse --abbrev-ref HEAD
[  +26 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +24 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +20 ms] executing: C:/Users/Tron/AppData/Local/Android/Sdk\platform-tools\adb.exe devices -l
[  +30 ms] List of devices attached
           emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1
[   +4 ms] C:/Users/Tron/AppData/Local/Android/Sdk\platform-tools\adb.exe -s emulator-5554 shell getprop
[  +33 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +59 ms] Found plugin firebase_core at C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.5\
[   +5 ms] Found plugin firebase_core_web at C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core_web-0.1.1+2\
[   +1 ms] Found plugin firebase_messaging at C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-6.0.16\
[  +70 ms] Found plugin firebase_core at C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.5\
[   +1 ms] Found plugin firebase_core_web at C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core_web-0.1.1+2\
[   +1 ms] Found plugin firebase_messaging at C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-6.0.16\
[  +51 ms] Generating C:\Users\Tron\Documents\FlutterProjects\serpol\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[  +33 ms] ro.hardware = ranchu
[  +46 ms] Launching lib\main.dart on Android SDK built for x86 in debug mode...
[   +6 ms] C:\flutter\bin\cache\dart-sdk\bin\dart.exe C:\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root C:\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names -Ddart.developer.causal_async_stacks=true --output-dill C:\Users\Tron\AppData\Local\Temp\flutter_tool.16d5c6b9-a58b-11ea-a5cc-c0b5d78b0a26\app.dill --packages C:\Users\Tron\Documents\FlutterProjects\serpol\.packages -Ddart.vm.profile=false -Ddart.vm.product=false --bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts --track-widget-creation --initialize-from-dill build\cache.dill
[  +14 ms] executing: C:/Users/Tron/AppData/Local/Android/Sdk\build-tools\29.0.3\aapt dump xmltree C:\Users\Tron\Documents\FlutterProjects\serpol\build\app\outputs\apk\app.apk AndroidManifest.xml
[  +16 ms] Exit code 0 from: C:/Users/Tron/AppData/Local/Android/Sdk\build-tools\29.0.3\aapt dump xmltree C:\Users\Tron\Documents\FlutterProjects\serpol\build\app\outputs\apk\app.apk AndroidManifest.xml
[        ] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1c
               A: android:compileSdkVersionCodename(0x01010573)="9" (Raw: "9")
               A: package="com.canovasconsulting.serpol" (Raw: "com.canovasconsulting.serpol")
               A: platformBuildVersionCode=(type 0x10)0x1c
               A: platformBuildVersionName=(type 0x10)0x9
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x1c
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: uses-permission (line=15)
                 A: android:name(0x01010003)="android.permission.ACCESS_NETWORK_STATE" (Raw: "android.permission.ACCESS_NETWORK_STATE")
               E: uses-permission (line=16)
                 A: android:name(0x01010003)="android.permission.WAKE_LOCK" (Raw: "android.permission.WAKE_LOCK")
               E: uses-permission (line=17)
                 A: android:name(0x01010003)="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" (Raw: "com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE")
               E: uses-permission (line=18)
                 A: android:name(0x01010003)="com.google.android.c2dm.permission.RECEIVE" (Raw: "com.google.android.c2dm.permission.RECEIVE")
               E: application (line=27)
                 A: android:label(0x01010001)="serpol" (Raw: "serpol")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:name(0x01010003)="com.canovasconsulting.serpol.Application" (Raw: "com.canovasconsulting.serpol.Application")
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=33)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="com.canovasconsulting.serpol.MainActivity" (Raw: "com.canovasconsulting.serpol.MainActivity")
                   A: android:launchMode(0x0101001d)=(type 0x10)0x1
                   A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                   A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                   A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                   E: meta-data (line=47)
                     A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
                     A: android:resource(0x01010025)=@0x7f0a0001
                   E: meta-data (line=57)
                     A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
                     A: android:resource(0x01010025)=@0x7f040015
                   E: intent-filter (line=61)
                     E: action (line=62)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=64)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                   E: intent-filter (line=66)
                     E: action (line=67)
                       A: android:name(0x01010003)="FLUTTER_NOTIFICATION_CLICK" (Raw: "FLUTTER_NOTIFICATION_CLICK")
                     E: category (line=69)
                       A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
                 E: meta-data (line=76)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x1
                 E: service (line=80)
                   A: android:name(0x01010003)="com.google.firebase.components.ComponentDiscoveryService" (Raw: "com.google.firebase.components.ComponentDiscoveryService")
                   A: android:exported(0x01010010)=(type 0x12)0x0
                   A: android:directBootAware(0x01010505)=(type 0x12)0xffffffff
                   E: meta-data (line=84)
                     A: android:name(0x01010003)="com.google.firebase.components:io.flutter.plugins.firebase.core.FlutterFirebaseAppRegistrar" (Raw: "com.google.firebase.components:io.flutter.plugins.firebase.core.FlutterFirebaseAppRegistrar")
                     A: android:value(0x01010024)="com.google.firebase.components.ComponentRegistrar" (Raw: "com.google.firebase.components.ComponentRegistrar")
                   E: meta-data (line=87)
                     A: android:name(0x01010003)="com.google.firebase.components:io.flutter.plugins.firebasemessaging.FlutterFirebaseAppRegistrar" (Raw: "com.google.firebase.components:io.flutter.plugins.firebasemessaging.FlutterFirebaseAppRegistrar")
                     A: android:value(0x01010024)="com.google.firebase.components.ComponentRegistrar" (Raw: "com.google.firebase.components.ComponentRegistrar")
                   E: meta-data (line=90)
                     A: android:name(0x01010003)="com.google.firebase.components:com.google.firebase.messaging.FirebaseMessagingRegistrar" (Raw: "com.google.firebase.components:com.google.firebase.messaging.FirebaseMessagingRegistrar")
                     A: android:value(0x01010024)="com.google.firebase.components.ComponentRegistrar" (Raw: "com.google.firebase.components.ComponentRegistrar")
                   E: meta-data (line=93)
                     A: android:name(0x01010003)="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar" (Raw: "com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar")
                     A: android:value(0x01010024)="com.google.firebase.components.ComponentRegistrar" (Raw: "com.google.firebase.components.ComponentRegistrar")
                   E: meta-data (line=96)
                     A: android:name(0x01010003)="com.google.firebase.components:com.google.firebase.iid.Registrar" (Raw: "com.google.firebase.components:com.google.firebase.iid.Registrar")
                     A: android:value(0x01010024)="com.google.firebase.components.ComponentRegistrar" (Raw: "com.google.firebase.components.ComponentRegistrar")
                   E: meta-data (line=99)
                     A: android:name(0x01010003)="com.google.firebase.components:com.google.firebase.datatransport.TransportRegistrar" (Raw: "com.google.firebase.components:com.google.firebase.datatransport.TransportRegistrar")
                     A: android:value(0x01010024)="com.google.firebase.components.ComponentRegistrar" (Raw: "com.google.firebase.components.ComponentRegistrar")
                   E: meta-data (line=102)
                     A: android:name(0x01010003)="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar" (Raw: "com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar")
                     A: android:value(0x01010024)="com.google.firebase.components.ComponentRegistrar" (Raw: "com.google.firebase.components.ComponentRegistrar")
                 E: service (line=106)
                   A: android:name(0x01010003)="io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService" (Raw: "io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService")
                   E: intent-filter (line=107)
                     E: action (line=108)
                       A: android:name(0x01010003)="com.google.firebase.MESSAGING_EVENT" (Raw: "com.google.firebase.MESSAGING_EVENT")
                 E: service (line=115)
                   A: android:name(0x01010003)="com.google.firebase.messaging.FirebaseMessagingService" (Raw: "com.google.firebase.messaging.FirebaseMessagingService")
                   A: android:exported(0x01010010)=(type 0x12)0x0
                   A: android:directBootAware(0x01010505)=(type 0x12)0xffffffff
                   E: intent-filter (line=119)
                     A: android:priority(0x0101001c)=(type 0x10)0xfffffe0c
                     E: action (line=120)
                       A: android:name(0x01010003)="com.google.firebase.MESSAGING_EVENT" (Raw: "com.google.firebase.MESSAGING_EVENT")
                 E: receiver (line=124)
                   A: android:name(0x01010003)="com.google.android.gms.measurement.AppMeasurementReceiver" (Raw: "com.google.android.gms.measurement.AppMeasurementReceiver")
                   A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                   A: android:exported(0x01010010)=(type 0x12)0x0
                 E: receiver (line=129)
                   A: android:name(0x01010003)="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver" (Raw: "com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver")
                   A: android:permission(0x01010006)="android.permission.INSTALL_PACKAGES" (Raw: "android.permission.INSTALL_PACKAGES")
                   A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                   A: android:exported(0x01010010)=(type 0x12)0xffffffff
                   E: intent-filter (line=134)
                     E: action (line=135)
                       A: android:name(0x01010003)="com.android.vending.INSTALL_REFERRER" (Raw: "com.android.vending.INSTALL_REFERRER")
                 E: service (line=139)
                   A: android:name(0x01010003)="com.google.android.gms.measurement.AppMeasurementService" (Raw: "com.google.android.gms.measurement.AppMeasurementService")
                   A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                   A: android:exported(0x01010010)=(type 0x12)0x0
                 E: service (line=143)
                   A: android:name(0x01010003)="com.google.android.gms.measurement.AppMeasurementJobService" (Raw: "com.google.android.gms.measurement.AppMeasurementJobService")
                   A: android:permission(0x01010006)="android.permission.BIND_JOB_SERVICE" (Raw: "android.permission.BIND_JOB_SERVICE")
                   A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                   A: android:exported(0x01010010)=(type 0x12)0x0
                 E: receiver (line=149)
                   A: android:name(0x01010003)="com.google.firebase.iid.FirebaseInstanceIdReceiver" (Raw: "com.google.firebase.iid.FirebaseInstanceIdReceiver")
                   A: android:permission(0x01010006)="com.google.android.c2dm.permission.SEND" (Raw: "com.google.android.c2dm.permission.SEND")
                   A: android:exported(0x01010010)=(type 0x12)0xffffffff
                   E: intent-filter (line=153)
                     E: action (line=154)
                       A: android:name(0x01010003)="com.google.android.c2dm.intent.RECEIVE" (Raw: "com.google.android.c2dm.intent.RECEIVE")
                 E: provider (line=158)
                   A: android:name(0x01010003)="com.google.firebase.provider.FirebaseInitProvider" (Raw: "com.google.firebase.provider.FirebaseInitProvider")
                   A: android:exported(0x01010010)=(type 0x12)0x0
                   A: android:authorities(0x01010018)="com.canovasconsulting.serpol.firebaseinitprovider" (Raw: "com.canovasconsulting.serpol.firebaseinitprovider")
                   A: android:initOrder(0x0101001a)=(type 0x10)0x64
                 E: activity (line=164)
                   A: android:theme(0x01010000)=@0x01030010
                   A: android:name(0x01010003)="com.google.android.gms.common.api.GoogleApiActivity" (Raw: "com.google.android.gms.common.api.GoogleApiActivity")
                   A: android:exported(0x01010010)=(type 0x12)0x0
                 E: meta-data (line=169)
                   A: android:name(0x01010003)="com.google.android.gms.version" (Raw: "com.google.android.gms.version")
                   A: android:value(0x01010024)=@0x7f060000
                 E: service (line=173)
                   A: android:name(0x01010003)="com.google.android.datatransport.runtime.backends.TransportBackendDiscovery" (Raw: "com.google.android.datatransport.runtime.backends.TransportBackendDiscovery")
                   A: android:exported(0x01010010)=(type 0x12)0x0
                   E: meta-data (line=176)
                     A: android:name(0x01010003)="backend:com.google.android.datatransport.cct.CctBackendFactory" (Raw: "backend:com.google.android.datatransport.cct.CctBackendFactory")
                     A: android:value(0x01010024)="cct" (Raw: "cct")
                 E: service (line=180)
                   A: android:name(0x01010003)="com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService" (Raw: "com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService")
                   A: android:permission(0x01010006)="android.permission.BIND_JOB_SERVICE" (Raw: "android.permission.BIND_JOB_SERVICE")
                   A: android:exported(0x01010010)=(type 0x12)0x0
                 E: receiver (line=186)
                   A: android:name(0x01010003)="com.google.android.datatransport.runtime.scheduling.jobscheduling.AlarmManagerSchedulerBroadcastReceiver" (Raw: "com.google.android.datatransport.runtime.scheduling.jobscheduling.AlarmManagerSchedulerBroadcastReceiver")
                   A: android:exported(0x01010010)=(type 0x12)0x0
[   +7 ms] executing: C:/Users/Tron/AppData/Local/Android/Sdk\platform-tools\adb.exe -s emulator-5554 shell -x logcat -v time -t 1
[  +45 ms] Exit code 0 from: C:/Users/Tron/AppData/Local/Android/Sdk\platform-tools\adb.exe -s emulator-5554 shell -x logcat -v time -t 1
[        ] --------- beginning of main
           06-03 11:12:18.584 I/MicroDetectionWorker( 3521): #onError(false)
[   +9 ms] <- compile package:serpol/main.dart
[   +7 ms] executing: C:/Users/Tron/AppData/Local/Android/Sdk\platform-tools\adb.exe version
[  +33 ms] Android Debug Bridge version 1.0.41
           Version 30.0.1-6435776
           Installed as C:\Users\Tron\AppData\Local\Android\Sdk\platform-tools\adb.exe
[   +2 ms] executing: C:/Users/Tron/AppData/Local/Android/Sdk\platform-tools\adb.exe start-server
[  +22 ms] Building APK
Running Gradle task 'assembleDebug'...
[  +17 ms] gradle.properties already sets `android.enableR8`
[   +3 ms] Using gradle from C:\Users\Tron\Documents\FlutterProjects\serpol\android\gradlew.bat.
[        ] C:\Users\Tron\Documents\FlutterProjects\serpol\android\gradlew.bat mode: 33279 rwxrwxrwx.
[   +8 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[  +71 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[        ] openjdk version "1.8.0_212-release"
           OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
           OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
[   +2 ms] executing: [C:\Users\Tron\Documents\FlutterProjects\serpol\android/] C:\Users\Tron\Documents\FlutterProjects\serpol\android\gradlew.bat -q -Ptarget-platform=android-x86 -Ptarget=C:\Users\Tron\Documents\FlutterProjects\serpol\lib\main.dart -Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root assembleDebug
[+3321 ms] C:\Users\Tron\Documents\FlutterProjects\serpol\android\app\src\main\java\com\canovasconsulting\serpol\Application.java:18: error: incompatible types: PluginRegistry cannot be converted to FlutterEngine
[   +1 ms]         GeneratedPluginRegistrant.registerWith(registry);
[        ]                                                ^
[  +60 ms] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
[        ] 1 error
[        ] FAILURE: Build failed with an exception.
[        ] * What went wrong:
[        ] Execution failed for task ':app:compileDebugJavaWithJavac'.
[        ] > Compilation failed; see the compiler error output for details.
[        ] * Try:
[        ] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[        ] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 3s
[ +349 ms] Exception: Gradle task assembleDebug failed with exit code 1

@TahaTesser TahaTesser removed the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Jun 8, 2020
@TahaTesser
Copy link

Hi @tronantonio

Please create a new project with kotlin support and add this to your mainactivity

import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
import io.flutter.view.FlutterMain

class MainActivity : FlutterActivity(), PluginRegistry.PluginRegistrantCallback {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        FlutterFirebaseMessagingService.setPluginRegistrant(this);
        FlutterMain.startInitialization(this)
    }

    override fun registerWith(registry: PluginRegistry?) {
        if (!registry!!.hasPlugin("io.flutter.plugins.firebasemessaging")) {
            FirebaseMessagingPlugin.registerWith(registry!!.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
        }
    }

}

@TahaTesser TahaTesser added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Jun 8, 2020
@heidji
Copy link

heidji commented Jul 4, 2020

@TahaTesser
could you please add the Kotlin variant to the docs? Flutter creates Kotlin apps afaik by default nowadays and scraping the issues for clues was a bit confusing.

@TahaTesser
Copy link

@heidji #2311

@heidji
Copy link

heidji commented Jul 6, 2020

@TahaTesser yes I am aware the info is widely available in bug reports, but that's exactly what i was criticizing

@google-oss-bot
Copy link

Hey @tronantonio. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot google-oss-bot added the Stale Issue with no recent activity label Jul 30, 2020
@google-oss-bot
Copy link

Since there haven't been any recent updates here, I am going to close this issue.

@tronantonio if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@firebase firebase locked and limited conversation to collaborators Sep 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. closed-by-bot Stale Issue with no recent activity
Projects
None yet
Development

No branches or pull requests

4 participants