我正在修改ChatSecure以获得推送通知功能,我尝试使用h[k] << k
或GCM
进行此操作,但一旦我将FCM
添加到项目{{} 1}}文件应用程序崩溃。
我尝试了com.google.gms:google-services:3.0.0
和build.gradle
,但是一旦我添加了这一行,应用就会崩溃:
GCM
我的应用FCM
文件:
06-08 03:05:37.414: E/AndroidRuntime(3157): FATAL EXCEPTION: main
06-08 03:05:37.414: E/AndroidRuntime(3157): Process: info.guardianproject.otr.app.im, PID: 3157
06-08 03:05:37.414: E/AndroidRuntime(3157): java.lang.RuntimeException: Unable to start activity ComponentInfo{info.guardianproject.otr.app.im/info.guardianproject.otr.app.im.app.NewChatActivity}: android.view.InflateException: Binary XML file line #50: Error inflating class fragment
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.app.ActivityThread.access$800(ActivityThread.java:135)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.os.Handler.dispatchMessage(Handler.java:102)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.os.Looper.loop(Looper.java:136)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.app.ActivityThread.main(ActivityThread.java:5017)
06-08 03:05:37.414: E/AndroidRuntime(3157): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 03:05:37.414: E/AndroidRuntime(3157): at java.lang.reflect.Method.invoke(Method.java:515)
06-08 03:05:37.414: E/AndroidRuntime(3157): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-08 03:05:37.414: E/AndroidRuntime(3157): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-08 03:05:37.414: E/AndroidRuntime(3157): at dalvik.system.NativeStart.main(Native Method)
06-08 03:05:37.414: E/AndroidRuntime(3157): Caused by: android.view.InflateException: Binary XML file line #50: Error inflating class fragment
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:714)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.view.LayoutInflater.rInflate(LayoutInflater.java:759)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.view.LayoutInflater.rInflate(LayoutInflater.java:759)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.view.LayoutInflater.rInflate(LayoutInflater.java:759)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
06-08 03:05:37.414: E/AndroidRuntime(3157): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.app.Activity.setContentView(Activity.java:1929)
06-08 03:05:37.414: E/AndroidRuntime(3157): at info.guardianproject.otr.app.im.app.NewChatActivity.onCreate(NewChatActivity.java:195)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.app.Activity.performCreate(Activity.java:5231)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
06-08 03:05:37.414: E/AndroidRuntime(3157): ... 11 more
06-08 03:05:37.414: E/AndroidRuntime(3157): Caused by: java.lang.IllegalArgumentException: Binary XML file line #50: Must specify unique android:id, android:tag, or have a parent with an id for info.guardianproject.otr.app.im.app.AccountsFragment
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2205)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:278)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:31)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:78)
06-08 03:05:37.414: E/AndroidRuntime(3157): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
06-08 03:05:37.414: E/AndroidRuntime(3157): ... 24 more
删除依赖项后,它工作正常,但我需要实现通知功能,该怎么办?
答案 0 :(得分:1)
我使用旧版com.google.gms:google-services
修复了它。
也许它不是最好的解决方案但是有效:
classpath 'com.google.gms:google-services:1.5.0-beta2'