我最近从 gcm 升级到了 firebase。这迫使我升级我的构建工具等。该应用程序使用 Play 服务来检查订阅状态,否则它是一个基本的 Push To Talk 应用程序。使用构建工具 22 在 GCM 上一切正常。. 我已经很好地实现了firebase并且它工作正常。我遇到的问题是我现在启动的哪三个活动或从哪里(小部件、通知、图标)导致 ANR。请注意,当我第一次启动他们按预期运行的活动时。第二次启动的任何活动都会给出 ANR。这里发生了什么?
记录错误
06-11 02:45:49.913 32009-32009/com.cb3g.channel19 W/DisplayListCanvas: DisplayListCanvas is started on unbinded RenderNode (without mOwningView)
06-11 02:45:59.883 32009-32030/com.cb3g.channel19 E/DynamiteModule: Failed to load module descriptor class: Didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor" on path: DexPathList[[zip file "/data/app/com.cb3g.channel19-3/base.apk"],nativeLibraryDirectories=[/data/app/com.cb3g.channel19-3/lib/arm64, /vendor/lib64, /system/lib64]]
06-11 02:45:59.883 32009-32030/com.cb3g.channel19 W/ResourcesManager: getTopLevelResources: /data/app/com.google.android.gms-2/base.apk / 1.0 running in com.cb3g.channel19 rsrc of package com.google.android.gms
06-11 02:49:36.923 32009-32009/com.cb3g.channel19 W/AudioManager: setStreamMute is deprecated. adjustStreamVolume should be used instead.
构建.gradle:
android {
signingConfigs {
config {
}
}
defaultConfig {
applicationId "com.cb3g.channel19"
minSdkVersion 16
targetSdkVersion 23
versionCode 278
versionName "2.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileSdkVersion 23
buildToolsVersion '22.0.1'
}
dependencies {
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.google.android.gms:play-services-gcm:9.0.2'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.google.android.gms:play-services-ads:9.0.2'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:design:23.4.0'
}
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
显现:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cb3g.channel19">
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.CLEAR_APP_CACHE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="false"
android:icon="@drawable/smallicon"
android:label="@string/app_name"
android:persistent="true"
android:theme="@style/mytheme"
android:value="AIzaSyadfadfaLJKLKJkldfk">
<activity
android:name=".main_activity"
android:launchMode="singleTask"
android:stateNotNeeded="true"
android:windowSoftInputMode="adjustNothing|stateAlwaysHidden"/>
<activity
android:name=".settings_activity"
android:stateNotNeeded="true"
android:theme="@style/pmstyle"
android:windowSoftInputMode="adjustPan|stateAlwaysHidden"/>
<activity
android:name=".login_activity"
android:stateNotNeeded="true"
android:theme="@style/mytheme"
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:priority="247483647">
<action android:name="android.intent.action.VOICE_COMMAND" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service
android:name=".radio_service"
android:exported="false"/>
<service
android:name=".MyFcmListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver android:name=".channel19">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/channel19_info" />
</receiver>
</application>
</manifest>
返回 Activity 时会导致 ANR 的原因是什么?
更新:没有 Firebase 编译应用程序可以正常运行。我添加了 Firebase 崩溃编译以尝试获取 Firebase 的情况日志,但无济于事这里是依赖项。
`compile 'com.google.firebase:firebase-messaging:9.0.2'
`compile 'com.google.firebase:firebase-crash:9.0.2'