App stop working after push notification with firebase on ionic 3

2

I'm trying to make a push notification using cloudSettings with firebase, however when I send a message the app stops working and the following message appears:

app.module.ts:

constcloudSettings:CloudSettings={'core':{'app_id':'APP_ID',},'push':{'sender_id':'SENDER_ID','pluginConfig':{'ios':{'badge':true,'sound':true},'android':{'iconColor':'#343434'}}}};...imports:[BrowserModule,HttpModule,CloudModule.forRoot(cloudSettings)]...

app.component.ts:

....initialize(){this.registerDeviceToken();this.handlerNotifications();}registerDeviceToken(){this.push.register().then((t:PushToken)=>{returnthis.push.saveToken(t);}).then((t:PushToken)=>{console.log('Tokensaved:',t.token);});}handlerNotifications(){this.push.rx.notification().subscribe((msg)=>{alert(msg.title+':'+msg.text);});}

Inmypackage.jsonthelibisdefinedasfollows:

"phonegap-plugin-push": {
                "SENDER_ID": "SENDER_ID",
                "variables": "[object Object]"
}

And no config.xml:

<plugin name="phonegap-plugin-push" spec="^2.0.0">
        <variable name="SENDER_ID" value="SENDER_ID" />
        <variable name="variables" value="[object Object]" />
</plugin>

Ionic info:

local packages:

@ionic/app-scripts : 2.0.1
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.5.0

System:

Android SDK Tools : 26.0.2
Node              : v6.10.3
OS                : Linux 3.13
npm               : 3.10.10

Error log:

  

09-06 15: 09: 51,634 2829 22829 I ActivityManager: Start proc   19365: br.com.app/u0a138 for activity br.com.app/.MainActivity 09-06   15: 09: 51.675 19365 19365 W System: ClassLoader referenced unknown   path: /data/app/br.com.app-1/lib/arm 09-06 15: 09: 51.709 19365 19365 I   FA: adb shell setprop debug.firebase.analytics.app br.com.app   09-06 15: 09: 52,024 637 637 D SFPerfTracer: layers: (5: 8)   (StatusBar (0xa987ec00): 20: 31344)   (com.android.systemui.ImageWallpaper (0xa9d49400): 20: 20506) (Sprite   (0xa987b000): 0:34) * (DimLayerController / Stack = 0 (0xa9d4a800):   0: 1353) * (animation background stackId = 1 (0xa987d800): 0: 112) *   (com.google.android.googlequicksearchbox / com.google.android.launcher.GEL   (0xa9d4bc00): 20: 298) (StartingBar (0xa987c400): 20:46) (Starting   br.com.app (0xa986bc00): 20:24) 09-06 15: 09: 52,164 2829 4059 I   WindowManager: Switching to real app window: Window {da0e6a u0   br.com.app/br.com.app.MainActivity} 09-06 15: 09: 52,222 2829 2881 I   LaunchCheckinHandler: Displayed br.com.app/.MainActivity,cp,ca,600   09-06 15: 09: 52.223 2829 2881 I ActivityManager: Displayed   br.com.app/.MainActivity: + 600ms 09-06 15: 09: 54,942 637 637 D   SFPerfTracer: layers: (5:11) (StatusBar (0xa987ec00): 9: 31376)   (com.android.systemui.ImageWallpaper (0xa9d49400): 9: 20538) * (Sprite   (0xa987b000): 0:34) * (DimLayerController / Stack = 0 (0xa9d4a800):   0: 1353) * (animation background stackId = 1 (0xa987d800): 0: 112) *   (com.google.android.googlequicksearchbox / com.google.android.launcher.GEL   (0xa9d4bc00): 0: 309) - (NavigationBar (0xa987c400): 9:78) (Starting   br.com.app (0xa986bc00): 0:45) - (br.com.app/br.com.app.MainActivity   (0xa9d48000): 10:30) (br.com.app/br.com.app.MainActivity (0xa81d5000):   125: 163) (br.com.app/br.com.app.MainActivity (0xa81d6400): 28:45)   09-06 15: 10: 11,599 19365 19365 E AndroidRuntime: Process: br.com.app,   PID: 19365 09-06 15: 10: 11.599 19365 19365 E AndroidRuntime:   java.lang.NoSuchMethodError: No static method   zzJU () Lcom / google / firebase / iid / zzq; in class   Lcom / google / firebase / iid / zzq; or its super classes (declaration of   'com.google.firebase.iid.zzq' appears in   /data/app/br.com.app-1/base.apk) 09-06 15: 10: 11,601 2829 3751 W   ActivityManager: Force finishing activity br.com.app/.MainActivity   09-06 15:10:12,110 2829 2848 W ActivityManager: Activity pause   timeout for ActivityRecord {6c0658b u0 br.com.app/.MainActivity t98 f}   09-06 15: 10: 13,786 2829 3751 W ActivityManager: Force finishing   activity br.com.app/.MainActivity 09-06 15: 10: 13,797 637 637 D   SFPerfTracer: layers: (6:11) (StatusBar (0xa987ec00): 0: 31453)   (com.android.systemui.ImageWallpaper (0xa9d49400): 0: 20613) (Sprite   (0xa987b000): 0:34) * (DimLayerController / Stack = 0 (0xa9d4a800): 0: 1362)   (animation background stackId = 1 (0xa987d800): 0: 112) * (NavigationBar   (0xa987c400): 0: 165) (br.com.app/br.com.app.MainActivity (0xa9d48000):   0:39) - (br.com.app/br.com.app.MainActivity (0xa81d5000): 0: 165) -   (br.com.app/br.com.app.MainActivity (0xa81d6400): 0: 122) * (Application   Error: br.app (0xa9d48000): 3:70)   (com.google.android.googlequicksearchbox / com.google.android.launcher.GEL   (0xa81d5000): 0:31) 09-06 15: 10: 13,809 2829 3751 I ActivityManager:   Killing 19365: br.com.app/u0a138 (adj 0): crash

    
asked by anonymous 05.09.2017 / 23:25

1 answer

2

The problem was happening because of conflict between the libs. The lib% of_% was conflicting with another lib% of_%.

In the plugin.xml file that is generated inside the plugins / my_package folder I saw that the location plugin looks like this:

 <framework src="com.google.android.gms:play-services-location:11.+" />

The solution was to change this line, like this:

<framework src="com.google.android.gms:play-services-location:11.0.1" />

I left the same version of the plugin that was generated by phonegap-plugin-push .

Related topics:

link

link

    
08.09.2017 / 14:53