[Android Q&A, Help & Troubleshooting] mKenfenheuer:
Hi guys,

i'm currently facing a weird problem in my app.

I'm trying to create Previews of my android Wear Watchface, so everybody can see how his settings will look like.

--screens attached--

However, the app crashes if i change the fragment...

This is my code to change the fragment:

private void changeFragment(int index)
{
if(index != 7 && index != 0) {
showAd();
}
FragmentTransaction ft = getFragmentManager().beginTransaction();
switch (index) {
case 0:
WizardFrameHello fragment = new WizardFrameHello();
fragment.setParentActivity(this);
if (lastFragment != null)
ft.remove(lastFragment);
ft.add(R.id.frameWizard, (Fragment) fragment);
ft.commit();
lastFragment = fragment;
break;
case 7:
WizardFrameSelectProcedure fragment7 = new WizardFrameSelectProcedure();
fragment7.setParentActivity(this);
if (lastFragment != null)
ft.remove(lastFragment);
ft.add(R.id.frameWizard, (Fragment) fragment7);
ft.commit();
lastFragment = fragment7;
break;
[...]
case 11:
WizardFrameLanguages fragment11 = new WizardFrameLanguages();
fragment11.setParentActivity(this);
if (lastFragment != null)
ft.remove(lastFragment);
ft.add(R.id.frameWizard, (Fragment) fragment11);
ft.commit();
lastFragment = fragment11;
break;

}
}
public void prevStep() {
if (index == 5 && textResource.USE_SPECIFIC) {
index = 3;
changeFragment(index);
} else if (index == 4 || index == 3) {
index = 2;
changeFragment(index);
} else if (index > 0) {
index--;
changeFragment(index);
}
}
public void setStep(int step)
{
index = step;
changeFragment(index);
}
public void nextStep() {
if (index == 3)
index = 4;
if (index < maxindex) {
index++;
changeFragment(index);
}
}

These are the dumps i got:

10-10 13:12:05.681 19246-19246/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-10 13:12:05.681 19246-19246/? A/DEBUG: Build fingerprint: 'OnePlus/OnePlus2/OnePlus2:6.0.1/MMB29M/1447840920:user/release-keys'
10-10 13:12:05.681 19246-19246/? A/DEBUG: Revision: '0'
10-10 13:12:05.681 19246-19246/? A/DEBUG: ABI: 'arm64'
10-10 13:12:05.681 19246-19246/? A/DEBUG: pid: 19033, tid: 19040, name: FinalizerDaemon >>> com.kenfenheuer.fancytextwatchlite <<<
10-10 13:12:05.681 19246-19246/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x50
10-10 13:12:05.681 19246-19246/? A/DEBUG: x0 0000007f64ac3268 x1 0000000000000000 x2 0000000000000001 x3 0000000000000001
10-10 13:12:05.681 19246-19246/? A/DEBUG: x4 0000000000000000 x5 0000000000000001 x6 0000000000000000 x7 0000007f868d1560
10-10 13:12:05.681 19246-19246/? A/DEBUG: x8 0000007f64ac3200 x9 0000000000000000 x10 0000000000000000 x11 0000007f84a3e398
10-10 13:12:05.681 19246-19246/? A/DEBUG: x12 0000000000000001 x13 0000000000000000 x14 0000007f84a435bc x15 0000000000000000
10-10 13:12:05.681 19246-19246/? A/DEBUG: x16 0000007f883ce660 x17 0000007f88319340 x18 0000007f7ab1ee00 x19 0000007f6fe53e40
10-10 13:12:05.681 19246-19246/? A/DEBUG: x20 0000007f6fe53e40 x21 0000007f7ab1ee00 x22 00000000718bad10 x23 00000000132d22b0
10-10 13:12:05.681 19246-19246/? A/DEBUG: x24 0000007f83cc62a8 x25 000030dc09c11582 x26 0000000071f55947 x27 0000000071affdf0
10-10 13:12:05.681 19246-19246/? A/DEBUG: x28 0000007f7ab09900 x29 0000007f83cc5eb0 x30 0000007f88319420
10-10 13:12:05.681 19246-19246/? A/DEBUG: sp 0000007f83cc5eb0 pc 0000007f8831938c pstate 0000000080000000
10-10 13:12:05.683 19246-19246/? A/DEBUG: backtrace:
10-10 13:12:05.683 19246-19246/? A/DEBUG: #00 pc 00000000000eb38c /system/lib64/libandroid_runtime.so (_ZN7android6Bitmap12doFreePixelsEv+76)
10-10 13:12:05.683 19246-19246/? A/DEBUG: #01 pc 00000000000eb41c /system/lib64/libandroid_runtime.so (_ZN7android6BitmapD1Ev+16)
10-10 13:12:05.683 19246-19246/? A/DEBUG: #02 pc 00000000000eb4f4 /system/lib64/libandroid_runtime.so (_ZN7android6Bitmap14detachFromJavaEv+52)
10-10 13:12:05.683 19246-19246/? A/DEBUG: #03 pc 00000000022e87f0 /system/framework/arm64/boot.oat (offset 0x1f30000)

10-10 09:08:25.147 30686-30686/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-10 09:08:25.147 30686-30686/? A/DEBUG: Build fingerprint: 'OnePlus/OnePlus2/OnePlus2:6.0.1/MMB29M/1447840920:user/release-keys'
10-10 09:08:25.147 30686-30686/? A/DEBUG: Revision: '0'
10-10 09:08:25.147 30686-30686/? A/DEBUG: ABI: 'arm64'
10-10 09:08:25.148 30686-30686/? A/DEBUG: pid: 30593, tid: 30601, name: FinalizerDaemon >>> com.kenfenheuer.fancytextwatchlite <<<
10-10 09:08:25.148 30686-30686/? A/DEBUG: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7f61544160
10-10 09:08:25.149 30686-30686/? A/DEBUG: x0 0000007f61544160 x1 0000007f83cc5f04 x2 0000007f61544160 x3 0000000000570000
10-10 09:08:25.149 30686-30686/? A/DEBUG: x4 0000000000430000 x5 0000000000000000 x6 0000007f84a3a000 x7 0000007f84a3c9a8
10-10 09:08:25.149 30686-30686/? A/DEBUG: x8 0000000000000035 x9 0000007f7abafba8 x10 0000000000000001 x11 0000007f84a3e398
10-10 09:08:25.149 30686-30686/? A/DEBUG: x12 0000000000000002 x13 0000000000000000 x14 0000007f83cc5f90 x15 0000000000000000
10-10 09:08:25.149 30686-30686/? A/DEBUG: x16 0000007f883cc920 x17 0000007f88096df8 x18 0000007f7abafa00 x19 0000007f61544160
10-10 09:08:25.149 30686-30686/? A/DEBUG: x20 0000007f88319514 x21 0000007f7abafa00 x22 00000000718bad10 x23 0000000012c07970
10-10 09:08:25.150 30686-30686/? A/DEBUG: x24 0000007f83cc62a8 x25 00002392d5941beb x26 0000000071f55947 x27 0000000071affdf0
10-10 09:08:25.150 30686-30686/? A/DEBUG: x28 0000007f7ab09900 x29 0000007f83cc5eb0 x30 0000007f883194d4
10-10 09:08:25.150 30686-30686/? A/DEBUG: sp 0000007f83cc5eb0 pc 0000007f88096e00 pstate 0000000020000000
10-10 09:08:25.156 30686-30686/? A/DEBUG: backtrace:
10-10 09:08:25.156 30686-30686/? A/DEBUG: #00 pc 0000000000066e00 /system/lib64/libc.so (pthread_mutex_lock+8)
10-10 09:08:25.157 30686-30686/? A/DEBUG: #01 pc 00000000000eb4d0 /system/lib64/libandroid_runtime.so (_ZN7android6Bitmap14detachFromJavaEv+16)
10-10 09:08:25.157 30686-30686/? A/DEBUG: #02 pc 00000000022e87f0 /system/framework/arm64/boot.oat (offset 0x1f30000)

10-10 12:31:11.088 11195-11195/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-10 12:31:11.089 11195-11195/? A/DEBUG: Build fingerprint: 'OnePlus/OnePlus2/OnePlus2:6.0.1/MMB29M/1447840920:user/release-keys'
10-10 12:31:11.089 11195-11195/? A/DEBUG: Revision: '0'
10-10 12:31:11.089 11195-11195/? A/DEBUG: ABI: 'arm64'
10-10 12:31:11.089 11195-11195/? A/DEBUG: pid: 10958, tid: 10966, name: FinalizerDaemon >>> com.kenfenheuer.fancytextwatchlite <<<
10-10 12:31:11.089 11195-11195/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x50
10-10 12:31:11.089 11195-11195/? A/DEBUG: x0 0000007f65453e68 x1 0000000000000000 x2 0000000000000001 x3 0000000000000001
10-10 12:31:11.089 11195-11195/? A/DEBUG: x4 0000000000000000 x5 0000000000000001 x6 0000000000000000 x7 0000007f868d1560
10-10 12:31:11.089 11195-11195/? A/DEBUG: x8 0000007f65453e00 x9 0000000000000000 x10 0000000000000000 x11 0000007f84a3e398
10-10 12:31:11.089 11195-11195/? A/DEBUG: x12 0000000000000001 x13 0000000000000000 x14 0000007f84a435bc x15 0000000000000000
10-10 12:31:11.089 11195-11195/? A/DEBUG: x16 0000007f883ce660 x17 0000007f88319340 x18 0000007f84efe200 x19 0000007f6fe53e40
10-10 12:31:11.089 11195-11195/? A/DEBUG: x20 0000007f6fe53e40 x21 0000007f84efe200 x22 00000000718bad10 x23 00000000130e5b50
10-10 12:31:11.089 11195-11195/? A/DEBUG: x24 0000007f83cc62a8 x25 00002ea373d55b2b x26 0000000071f55947 x27 0000000071affdf0
10-10 12:31:11.089 11195-11195/? A/DEBUG: x28 0000007f7ab09900 x29 0000007f83cc5eb0 x30 0000007f88319420
10-10 12:31:11.089 11195-11195/? A/DEBUG: sp 0000007f83cc5eb0 pc 0000007f8831938c pstate 0000000080000000
10-10 12:31:11.092 11195-11195/? A/DEBUG: backtrace:
10-10 12:31:11.092 11195-11195/? A/DEBUG: #00 pc 00000000000eb38c /system/lib64/libandroid_runtime.so (_ZN7android6Bitmap12doFreePixelsEv+76)
10-10 12:31:11.092 11195-11195/? A/DEBUG: #01 pc 00000000000eb41c /system/lib64/libandroid_runtime.so (_ZN7android6BitmapD1Ev+16)
10-10 12:31:11.092 11195-11195/? A/DEBUG: #02 pc 00000000000eb4f4 /system/lib64/libandroid_runtime.so (_ZN7android6Bitmap14detachFromJavaEv+52)
10-10 12:31:11.092 11195-11195/? A/DEBUG: #03 pc 00000000022e87f0 /system/framework/arm64/boot.oat (offset 0x1f30000)

i've already tried to get some info with android ndk-stack but no luck.

This is the output:

********** Crash dump: **********
Build fingerprint: 'OnePlus/OnePlus2/OnePlus2:6.0.1/MMB29M/1447840920:user/release-keys'
pid: 19033, tid: 19040, name: FinalizerDaemon >>> com.kenfenheuer.fancytextwatchlite <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x50
Stack frame 10-10 13:12:05.683 19246-19246/? A/DEBUG: #00 pc 00000000000eb38c /system/lib64/libandroid_runtime.so (_ZN7android6Bitmap12doFreePixelsEv+76)
Stack frame 10-10 13:12:05.683 19246-19246/? A/DEBUG: #01 pc 00000000000eb41c /system/lib64/libandroid_runtime.so (_ZN7android6BitmapD1Ev+16)
Stack frame 10-10 13:12:05.683 19246-19246/? A/DEBUG: #02 pc 00000000000eb4f4 /system/lib64/libandroid_runtime.so (_ZN7android6Bitmap14detachFromJavaEv+52)
Stack frame 10-10 13:12:05.683 19246-19246/? A/DEBUG: #03 pc 00000000022e87f0 /system/framework/arm64/boot.oat (offset 0x1f30000)

which is quite saying nothing to me. it should look more like this (example):

********** Crash dump: **********
Build fingerprint: 'generic/google_sdk/generic/:2.2/FRF91/43546:eng/test-keys'
pid: 351, tid: 351 >>> /data/local/ndk-tests/crasher <<<
signal 11 (SIGSEGV), fault addr 0d9f00d8
Stack frame #00 pc 0000841e /data/local/ndk-tests/crasher : Routine zoo in /tmp/foo/crasher/jni/zoo.c:13
Stack frame #01 pc 000083fe /data/local/ndk-tests/crasher : Routine bar in /tmp/foo/crasher/jni/bar.c:5
Stack frame #02 pc 000083f6 /data/local/ndk-tests/crasher : Routine my_comparison in /tmp/foo/crasher/jni/foo.c:9
Stack frame #03 pc 000191ac /system/lib/libc.so
Stack frame #04 pc 000083ea /data/local/ndk-tests/crasher : Routine foo in /tmp/foo/crasher/jni/foo.c:14
Stack frame #05 pc 00008458 /data/local/ndk-tests/crasher : Routine main in /tmp/foo/crasher/jni/main.c:19
Stack frame #06 pc 0000d362 /system/lib/libc.so

Can you help me ?

Getting the function thats causing the error would be great.

Thanks,

Maximilian