My App is facing a really weird behavior:
- App is started normally;
- I leave the app for another one or back to the phone's home screen;
- When I try to go back to the previous app instance, it hangs until I get the "App is not responding, force it to close?";
I know it sounds like some memory leak or loop stuck problem, but this behavior is complety random (sometimes I perform the steps above twice and I get the problem, other times I do it like ten times until I get the error). No Exception is thrown in the logcat. In the Monitor, alocated memory never explodes and it keeps below the free memory. I've used the memory analizer and nothing weird is shown in report.
I've noticed already that when I use loader spinners in my Activity, the number of times needed performing the steps above in order for the App to crash decreases - sometimes doing them once makes the app crash.
Does anyone have a suggestion of what can I do in order to figure out what might be causing this problem?
Thank you.
EDIT
This behavior can happen in any of the App's activities, Logcat and code can be foundbelow:
All my activities are descendant of this template:
public abstract class ActivityTemplate extends AppCompatActivity {
private Boolean isRunning = Boolean.TRUE;
private ToolbarManager mToolbarManager;
private ActivitySetup mSetup;
public abstract ActivitySetup setUpActivity();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mToolbarManager = new ToolbarManager();
mSetup = setUpActivity();
setContentView(mSetup.getContentView());
ButterKnife.bind(this);
prepareToolbar();
registerForEvents();
this.startResources();
}
private void prepareToolbar() {
if (mSetup.getHasToolbar()) {
mToolbarManager.initToolbar(this, mSetup.getTitle(), R.id.toolbar, R.color.textPrimary);
if (mSetup.getDefaultReturnBehavior()) {
mToolbarManager.setNavigationReturnBehavior();
}
mToolbarManager.prepareNavigationBehavior(mSetup.getNavigationIcon(), mSetup.getOnNavigationItemClicked());
}
}
public void startResources() {
}
@Override
public void onDestroy() {
this.unregisterForEvents();
super.onDestroy();
}
@Override
protected void onPause() {
super.onPause();
this.isRunning = Boolean.FALSE;
}
@Override
protected void onResume() {
super.onResume();
this.isRunning = Boolean.TRUE;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return super.onCreateOptionsMenu(menu);
}
public void registerForEvents() {
Map<EventCatalog, TaskExecutor> executors = this.setEventHandlers();
if (null != executors && executors.size() > 0) {
for (EventCatalog event : executors.keySet()) {
NotificationCenter.RegistrationCenter.registerForEvent(event, executors.get(event));
}
}
}
public void unregisterForEvents() {
Map<EventCatalog, TaskExecutor> executors = this.setEventHandlers();
if (null != executors && executors.size() > 0) {
for (EventCatalog key : executors.keySet()) {
NotificationCenter.RegistrationCenter.unregisterForEvent(key, executors.get(key));
}
}
}
public boolean isRunning() {
return this.isRunning;
}
public Toolbar getToolbar() {
return mToolbarManager.getToolbar();
}
public Map<EventCatalog, TaskExecutor> setEventHandlers() {
return null;
}
}
06-13 10:39:11.258 25215-25271/br.com.gogame I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8974_LA.BF.1.1.3_RB1__release_AU (I3193f6e94a)
OpenGL ES Shader Compiler Version: E031.28.00.02
Build Date: 10/09/15 Fri
Local Branch: mybranch15039904
Remote Branch: quic/LA.BF.1.1.3_rb1.2
Local Patches: NONE
Reconstruct Branch: NOTHING
06-13 10:39:11.274 25215-25271/br.com.gogame I/OpenGLRenderer: Initialized EGL, version 1.4
06-13 10:39:11.315 25215-25215/br.com.gogame E/RecyclerView: No adapter attached; skipping layout
06-13 10:39:11.315 25215-25215/br.com.gogame E/RecyclerView: No adapter attached; skipping layout
06-13 10:39:11.601 25215-25215/br.com.gogame E/RecyclerView: No adapter attached; skipping layout
06-13 10:39:11.601 25215-25215/br.com.gogame E/RecyclerView: No adapter attached; skipping layout
06-13 10:39:11.640 25215-25215/br.com.gogame E/RecyclerView: No adapter attached; skipping layout
06-13 10:39:11.640 25215-25215/br.com.gogame E/RecyclerView: No adapter attached; skipping layout
06-13 10:39:20.864 25215-25241/br.com.gogame 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/br.com.gogame-1/base.apk"],nativeLibraryDirectories=[/data/app/br.com.gogame-1/lib/arm, /data/app/br.com.gogame-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
06-13 10:39:25.202 25575-25575/br.com.gogame:background_crash E/DynamiteModule: Failed to load module descriptor class: Didn't find class "com.google.android.gms.dynamite.descriptors.com.google.android.gms.crash.ModuleDescriptor" on path: DexPathList[[zip file "/data/app/br.com.gogame-1/base.apk"],nativeLibraryDirectories=[/data/app/br.com.gogame-1/lib/arm, /data/app/br.com.gogame-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
06-13 10:39:25.239 25575-25575/br.com.gogame:background_crash D/ChimeraCfgMgr: Reading stored module config
06-13 10:39:25.299 25575-25575/br.com.gogame:background_crash I/DynamiteModule: Considering local module com.google.android.gms.crash:0 and remote module com.google.android.gms.crash:2
06-13 10:39:25.299 25575-25575/br.com.gogame:background_crash I/DynamiteModule: Selected remote version of com.google.android.gms.crash, version >= 2
06-13 10:39:25.312 25575-25575/br.com.gogame:background_crash W/System: ClassLoader referenced unknown path: /data/user/0/com.google.android.gms/app_chimera/m/00000002/n/armeabi-v7a
06-13 10:39:25.312 25575-25575/br.com.gogame:background_crash W/System: ClassLoader referenced unknown path: /data/user/0/com.google.android.gms/app_chimera/m/00000002/n/armeabi
06-13 10:39:25.313 25575-25575/br.com.gogame:background_crash D/ChimeraFileApk: Primary ABI of requesting process is armeabi-v7a
06-13 10:39:25.314 25575-25575/br.com.gogame:background_crash D/ChimeraFileApk: Classloading successful. Optimized code found.
06-13 10:39:25.334 25575-25575/br.com.gogame:background_crash I/FirebaseCrashReceiverServiceImpl: FirebaseCrashReceiverServiceImpl created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/user/0/com.google.android.gms/app_chimera/m/00000002/DynamiteModulesC_GmsCore_prodmnc_xxhdpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000002/n/armeabi-v7a, /data/user/0/com.google.android.gms/app_chimera/m/00000002/n/armeabi, /vendor/lib, /system/lib]]]
06-13 10:39:25.340 25575-25575/br.com.gogame:background_crash D/FirebaseCrashReceiverServiceImpl: onCreate
06-13 10:39:25.345 25575-25575/br.com.gogame:background_crash I/DynamiteModule: Considering local module com.google.android.gms.flags:0 and remote module com.google.android.gms.flags:1
06-13 10:39:25.345 25575-25575/br.com.gogame:background_crash I/DynamiteModule: Selected remote version of com.google.android.gms.flags, version >= 1
06-13 10:39:25.379 25575-25575/br.com.gogame:background_crash I/FirebaseCrashSenderServiceImpl: FirebaseCrashSenderServiceImpl created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/user/0/com.google.android.gms/app_chimera/m/00000002/DynamiteModulesC_GmsCore_prodmnc_xxhdpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000002/n/armeabi-v7a, /data/user/0/com.google.android.gms/app_chimera/m/00000002/n/armeabi, /vendor/lib, /system/lib]]]
06-13 10:39:25.379 25575-25575/br.com.gogame:background_crash D/FirebaseCrashSenderServiceImpl: onCreate
06-13 10:40:46.438 25215-25215/br.com.gogame D/FirebaseApp: Notifying background state change listeners.
06-13 10:40:46.469 25215-25271/br.com.gogame E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb9fb34d0
06-13 10:40:47.348 25215-26924/br.com.gogame I/DynamiteModule: Considering local module com.google.android.gms.tagmanager:1 and remote module com.google.android.gms.tagmanager:2
06-13 10:40:47.348 25215-26924/br.com.gogame I/DynamiteModule: Selected remote version of com.google.android.gms.tagmanager, version >= 2
06-13 10:40:47.428 25215-25215/br.com.gogame D/FirebaseApp: Notifying background state change listeners.
06-13 10:40:47.738 25215-26924/br.com.gogame W/GoogleTagManager: Tag Manager's event handler WILL NOT be installed (no container loaded)
06-13 10:40:48.273 25215-25271/br.com.gogame E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb9f87b18
06-13 10:40:48.296 25215-25215/br.com.gogame D/FirebaseApp: Notifying background state change listeners.
06-13 10:44:08.361 25215-25221/br.com.gogame I/art: Thread[2,tid=25221,WaitingInMainSignalCatcherLoop,Thread*=0xb9ce2a10,peer=0x12d270a0,"Signal Catcher"]: reacting to signal 3
06-13 10:44:08.713 25215-25221/br.com.gogame I/art: Wrote stack traces to '/data/anr/traces.txt'
EDIT 2
It looks like this issue is related with the use of Firebase and Google Services, however, I need both in my App. The way I'm using them is:
On top gradle file: classpath 'com.google.gms:google-services:3.0.0'
On my App gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "br.com.gogame"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
// GOOGLE LIBRARIES
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.guava:guava:18.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.dagger:dagger:2.1'
compile 'com.android.volley:volley:1.0.0'
// APACHE LIBRARIES
compile 'org.apache.httpcomponents:httpmime:4.0-alpha3'
// OWN THIRD LIBRARIES
compile 'br.com.instachat:emoji-library:1.0.6'
compile 'br.com.edsilfer:kiwi:1.0.8'
// THIRD PART LIBRARIES
compile 'com.mikhaellopez:circularimageview:2.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.vajro:MaterialDesignLibrary:1.6'
compile 'com.ogaclejapan.smarttablayout:library:1.6.0@aar'
compile 'com.github.rey5137:material:1.2.2'
compile 'com.appyvet:materialrangebar:1.3'
compile 'com.github.afollestad.material-dialogs:core:0.8.5.6@aar'
compile 'com.wang.avi:library:1.0.5'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.mikepenz:aboutlibraries:5.6.5@aar'
compile 'com.jakewharton:butterknife:8.0.1'
compile 'com.wdullaer:materialdatetimepicker:2.3.0'
compile 'javax.inject:javax.inject:1'
compile 'com.github.satyan:sugar:1.5'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.15'
compile 'com.yalantis:ucrop:1.5.0'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
apt 'com.google.dagger:dagger-compiler:2.1'
provided 'javax.annotation:jsr250-api:1.0'
}
apply plugin: 'com.google.gms.google-services'