Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all 7144 articles
Browse latest View live

ToggleButton prevents my app from starting

$
0
0

I am making a calculator for a minigame, everything worked fine until I added a toggleButton. The app crashes on start, but I could not find any errors.

JAVA code:

.
.
.    
    int colorOff = getResources().getColor(R.color.toggleOff);
    int colorOn = getResources().getColor(R.color.toggleOn);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_balot_calculator); }

//This method is supposed to change the color of the toggle button when it is checked and not checked.
    public void seraA(View view) {
        ToggleButton seraToggle = (ToggleButton) findViewById(R.id.sera_toggle);
            if (seraToggle.isChecked()) {
                seraToggle.setBackgroundColor(colorOn); }
            else
                seraToggle.setBackgroundColor(colorOff);
    }
.
.
.

XML code:

.
.
.
<ToggleButton
    android:id="@+id/sera_toggle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginHorizontal="8dp"
    android:layout_marginVertical="4dp"
    android:onClick="seraA"
    android:textOn="@string/sera_T"
    android:textOff="@string/sera_T"
    android:textColor="#E0F7FA"
    android:textSize="20sp" />
.
.
.

Problem with log file - iOS Symbolicated file - App crashes at launch

$
0
0

Some users report errors with my app, but I can't solve the problem. This is one of the logs they sent me.

The app crash on startup on iOS 12 but on iOS 13 it works correctly. I can't identify what part of the code causes this bug

Someone can help me understand the error log? Thank a lot

Here is the text of the symbolicated .crash file

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x20230aab8 __exceptionPreprocess + 232
1   libobjc.A.dylib                 0x20150fd00 objc_exception_throw + 59
2   CoreFoundation                  0x2022102f4 +[NSException raise:format:] + 119
3   UIFoundation                    0x20cc8c628 UINibDecoderDecodeObjectForValue + 427
4   UIFoundation                    0x20cc8c9ac UINibDecoderDecodeObjectForValue + 1327
5   UIFoundation                    0x20cc2a8fc -[UINibDecoder decodeObjectForKey:] + 319
6   UIKitCore                       0x22fbbb9e0 -[UIView initWithCoder:] + 631
7   UIKitCore                       0x22fb68354 -[UIScrollView initWithCoder:] + 87
8   UIKitCore                       0x22fa6a4dc -[UITextView initWithCoder:] + 75
9   UIFoundation                    0x20cc8c768 UINibDecoderDecodeObjectForValue + 747
10  UIFoundation                    0x20cc8c9ac UINibDecoderDecodeObjectForValue + 1327
11  UIFoundation                    0x20cc2a8fc -[UINibDecoder decodeObjectForKey:] + 319
12  UIKitCore                       0x22fbbb9e0 -[UIView initWithCoder:] + 631
13  UIFoundation                    0x20cc8c768 UINibDecoderDecodeObjectForValue + 747
14  UIFoundation                    0x20cc2a8fc -[UINibDecoder decodeObjectForKey:] + 319
15  UIKitCore                       0x22eee9a30 -[UIVisualEffectView initWithCoder:] + 579
16  UIFoundation                    0x20cc8c768 UINibDecoderDecodeObjectForValue + 747
17  UIFoundation                    0x20cc8c9ac UINibDecoderDecodeObjectForValue + 1327
18  UIFoundation                    0x20cc2a8fc -[UINibDecoder decodeObjectForKey:] + 319
19  UIKitCore                       0x22fbbb9e0 -[UIView initWithCoder:] + 631
20  UIFoundation                    0x20cc8c768 UINibDecoderDecodeObjectForValue + 747
21  UIFoundation                    0x20cc2a8fc -[UINibDecoder decodeObjectForKey:] + 319
22  UIKitCore                       0x22f3dcd48 -[UIRuntimeConnection initWithCoder:] + 139
23  UIKitCore                       0x22f3dd530 -[UIRuntimeOutletCollectionConnection initWithCoder:] + 67
24  UIFoundation                    0x20cc8c768 UINibDecoderDecodeObjectForValue + 747
25  UIFoundation                    0x20cc8c9ac UINibDecoderDecodeObjectForValue + 1327
26  UIFoundation                    0x20cc2a8fc -[UINibDecoder decodeObjectForKey:] + 319
27  UIKitCore                       0x22f3da558 -[UINib instantiateWithOwner:options:] + 1123
28  UIKitCore                       0x22f163ba4 -[UIViewController _loadViewFromNibNamed:bundle:] + 375
29  UIKitCore                       0x22f16458c -[UIViewController loadView] + 179
30  UIKitCore                       0x22f164868 -[UIViewController loadViewIfRequired] + 183
31  UIKitCore                       0x22f0d19b0 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 79
32  UIKitCore                       0x22f0d1cc0 -[UINavigationController _startTransition:fromViewController:toViewController:] + 175
33  UIKitCore                       0x22f0d2c04 -[UINavigationController _startDeferredTransitionIfNeeded:] + 1115
34  UIKitCore                       0x22f0d3edc -[UINavigationController __viewWillLayoutSubviews] + 167
35  UIKitCore                       0x22f0b65bc -[UILayoutContainerView layoutSubviews] + 227
36  UIKitCore                       0x22fbeb0a0 -[UIView+ 14340256 (CALayerDelegate) layoutSublayersOfLayer:] + 1307
37  libobjc.A.dylib                 0x20150b454 -[NSObject performSelector:withObject:] + 67
38  QuartzCore                      0x2068e3db4 -[CALayer layoutSublayers] + 187
39  QuartzCore                      0x2068e40a0 CA::Layer::layout_if_needed+ 1319072 (CA::Transaction*) + 335
40  QuartzCore                      0x20684b17c CA::Context::commit_transaction+ 692604 (CA::Transaction*) + 343
41  QuartzCore                      0x20687a218 CA::Transaction::commit+ 885272 () + 659
42  UIKitCore                       0x22f74f164 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 127
43  CoreFoundation                  0x20229a98c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 27
44  CoreFoundation                  0x20229a274 __CFRunLoopDoBlocks + 275
45  CoreFoundation                  0x202295074 __CFRunLoopRun + 1007
46  CoreFoundation                  0x202294964 CFRunLoopRunSpecific + 451
47  GraphicsServices                0x2044d5d8c GSEventRunModal + 107
48  UIKitCore                       0x22f735758 UIApplicationMain + 215
49  Reflex                          0x1043d4e7c main + 1265276 (main.m:14)
50  libdyld.dylib                   0x201d50fd8 start + 3


Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000201e9d0cc __pthread_kill + 8
1   libsystem_c.dylib               0x0000000201df614c abort + 144
2   libc++abi.dylib                 0x00000002014f7f78 __cxa_bad_cast + 0
3   libc++abi.dylib                 0x00000002014f813c default_unexpected_handler+ 8508 () + 0
4   libobjc.A.dylib                 0x0000000201510144 _objc_terminate+ 24900 () + 124
5   libc++abi.dylib                 0x00000002015049cc std::__terminate(void (*)+ 59852 ()) + 20
6   libc++abi.dylib                 0x00000002015045c4 __cxa_rethrow + 148
7   libobjc.A.dylib                 0x000000020150fee0 objc_exception_rethrow + 48
8   CoreFoundation                  0x00000002022949d0 CFRunLoopRunSpecific + 560
9   GraphicsServices                0x00000002044d5d8c GSEventRunModal + 108
10  UIKitCore                       0x000000022f735758 UIApplicationMain + 216
    11  Reflex                          0x00000001043d4e7c main + 1265276 (main.m:14)
    12  libdyld.dylib                   0x0000000201d50fd8 start + 4

In-App Purchases -- App crash with success message using SwiftyStoreKit

$
0
0

I use SwiftyStoreKit to create my In-App Purchase. RestorePurchases works properly but while using PurchaseProduct, App Crase with success message" Your purchase was successful." and crash displayed As below.I am not using any timeIntervalSince1970 and Boolean in my project.

**** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean timeIntervalSince1970]: unrecognized selector sent to instance 0x1f86f95f0'****

I implemented SwiftyStoreKit.completeTransactions block in AppDelegate in didFinishLaunchingWithOptions and My code for PurchaseProduct is--

SwiftyStoreKit.purchaseProduct(My_Purchase_Identifier, quantity: 1, atomically: true) { result in
            switch result {
            case .success(let purchase):
                print("Purchase Success: \(purchase.productId)")
                 SwiftyStoreKit.finishTransaction(purchase.transaction)
            case .error(let error):
                print("Purchase with error")
          }
}

Please help me. Any suggestion is appreciated. Thank you.

Read Apple crash reports without OS

$
0
0

So I built an app on expo with react native that run perfectly on android, I am using a Windows pc for my code and also uploaded with application uploader, So I got an an error report from apple, first of all how do I understand what is the reason my app is crashing? there is a way to understand the errors without Mac pc? Thanks!


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000191632ebc 0x19160e000 + 151228
1   libsystem_pthread.dylib         0x000000019154e790 0x19154c000 + 10128
2   libsystem_c.dylib               0x00000001914a28a0 0x19142f000 + 473248
3   libsystem_c.dylib               0x00000001914a2830 0x19142f000 + 473136
4   libc++abi.dylib                 0x00000001915fb7d4 0x1915fa000 + 6100
5   libc++abi.dylib                 0x00000001915fb9c4 0x1915fa000 + 6596
6   libobjc.A.dylib                 0x0000000191563358 0x19155d000 + 25432
7   libc++abi.dylib                 0x0000000191608304 0x1915fa000 + 58116
8   libc++abi.dylib                 0x000000019160829c 0x1915fa000 + 58012
9   libdispatch.dylib               0x0000000191508198 0x1914ac000 + 377240
10  libdispatch.dylib               0x00000001914bad14 0x1914ac000 + 60692
11  libdispatch.dylib               0x0000000191508184 0x1914ac000 + 377220
12  libdispatch.dylib               0x00000001914ba1d0 0x1914ac000 + 57808
13  CoreFoundation                  0x00000001917b83c4 0x19170f000 + 693188
14  CoreFoundation                  0x00000001917b33b8 0x19170f000 + 672696
15  CoreFoundation                  0x00000001917b28bc 0x19170f000 + 669884
16  GraphicsServices                0x000000019b61e328 0x19b61b000 + 13096
17  UIKitCore                       0x00000001958486d4 0x194e58000 + 10421972
18  ComGpLiminal                    0x0000000100818658 0x100814000 + 18008
19  libdyld.dylib                   0x000000019163d460 0x19163c000 + 5216

Thread 1:
0   libsystem_pthread.dylib         0x000000019155aad8 0x19154c000 + 60120

Thread 2:
0   libsystem_pthread.dylib         0x000000019155aad8 0x19154c000 + 60120

Thread 3:
0   libsystem_pthread.dylib         0x000000019155aad8 0x19154c000 + 60120

Thread 4:
0   libsystem_pthread.dylib         0x000000019155aad8 0x19154c000 + 60120

Thread 5 name:  Dispatch queue: com.facebook.react.ExceptionsManagerQueue
Thread 5:
0   libsystem_kernel.dylib          0x00000001916338b0 0x19160e000 + 153776
1   libdispatch.dylib               0x00000001914aecfc 0x1914ac000 + 11516
2   libdispatch.dylib               0x00000001914aeae0 0x1914ac000 + 10976
3   libdispatch.dylib               0x00000001914baee4 0x1914ac000 + 61156
4   libdispatch.dylib               0x00000001914bab00 0x1914ac000 + 60160
5   ComGpLiminal                    0x00000001009fa6b0 0x100814000 + 1992368
6   ComGpLiminal                    0x00000001009e5c70 0x100814000 + 1907824
7   ComGpLiminal                    0x0000000100ba92bc 0x100814000 + 3756732
8   ComGpLiminal                    0x0000000100bdf33c 0x100814000 + 3978044
9   CoreFoundation                  0x0000000191840d90 0x19170f000 + 1252752
10  CoreFoundation                  0x0000000191710bd0 0x19170f000 + 7120
11  CoreFoundation                  0x00000001917117a8 0x19170f000 + 10152
12  ComGpLiminal                    0x0000000100c07860 0x100814000 + 4143200
13  ComGpLiminal                    0x0000000100c0e0cc 0x100814000 + 4169932
14  ComGpLiminal                    0x0000000100c0de2c 0x100814000 + 4169260
15  libdispatch.dylib               0x0000000191507610 0x1914ac000 + 374288
16  libdispatch.dylib               0x0000000191508184 0x1914ac000 + 377220
17  libdispatch.dylib               0x00000001914b4464 0x1914ac000 + 33892
18  libdispatch.dylib               0x00000001914b4e58 0x1914ac000 + 36440
19  libdispatch.dylib               0x00000001914be340 0x1914ac000 + 74560
20  libsystem_pthread.dylib         0x0000000191557fa4 0x19154c000 + 49060
21  libsystem_pthread.dylib         0x000000019155aae0 0x19154c000 + 60128

Thread 6:
0   libsystem_pthread.dylib         0x000000019155aad8 0x19154c000 + 60120

Thread 7 name:  com.apple.uikit.eventfetch-thread
Thread 7:
0   libsystem_kernel.dylib          0x00000001916115f4 0x19160e000 + 13812
1   libsystem_kernel.dylib          0x0000000191610a60 0x19160e000 + 10848
2   CoreFoundation                  0x00000001917b8068 0x19170f000 + 692328
3   CoreFoundation                  0x00000001917b3188 0x19170f000 + 672136
4   CoreFoundation                  0x00000001917b28bc 0x19170f000 + 669884
5   Foundation                      0x0000000191af2994 0x191aeb000 + 31124
6   Foundation                      0x0000000191af2874 0x191aeb000 + 30836
7   UIKitCore                       0x00000001958e049c 0x194e58000 + 11043996
8   Foundation                      0x0000000191c230b0 0x191aeb000 + 1278128
9   libsystem_pthread.dylib         0x00000001915571ec 0x19154c000 + 45548
10  libsystem_pthread.dylib         0x000000019155aaec 0x19154c000 + 60140

Thread 8 name:  AVAudioSession Notify Thread
Thread 8:
0   libsystem_kernel.dylib          0x00000001916115f4 0x19160e000 + 13812
1   libsystem_kernel.dylib          0x0000000191610a60 0x19160e000 + 10848
2   CoreFoundation                  0x00000001917b8068 0x19170f000 + 692328
3   CoreFoundation                  0x00000001917b3188 0x19170f000 + 672136
4   CoreFoundation                  0x00000001917b28bc 0x19170f000 + 669884
5   AVFAudio                        0x000000019e213e68 0x19e1ae000 + 417384
6   AVFAudio                        0x000000019e264df0 0x19e1ae000 + 749040
7   libsystem_pthread.dylib         0x00000001915571ec 0x19154c000 + 45548
8   libsystem_pthread.dylib         0x000000019155aaec 0x19154c000 + 60140

Thread 9:
0   libsystem_pthread.dylib         0x000000019155aad8 0x19154c000 + 60120

Thread 10 name:  com.facebook.react.JavaScript
Thread 10:
0   libsystem_kernel.dylib          0x00000001916115f4 0x19160e000 + 13812
1   libsystem_kernel.dylib          0x0000000191610a60 0x19160e000 + 10848
2   CoreFoundation                  0x00000001917b8068 0x19170f000 + 692328
3   CoreFoundation                  0x00000001917b3188 0x19170f000 + 672136
4   CoreFoundation                  0x00000001917b28bc 0x19170f000 + 669884
5   ComGpLiminal                    0x0000000100bca6b4 0x100814000 + 3892916
6   Foundation                      0x0000000191c230b0 0x191aeb000 + 1278128
7   libsystem_pthread.dylib         0x00000001915571ec 0x19154c000 + 45548
8   libsystem_pthread.dylib         0x000000019155aaec 0x19154c000 + 60140

Thread 11 name:  com.apple.CoreMotion.MotionThread
Thread 11:
0   libsystem_kernel.dylib          0x00000001916115f4 0x19160e000 + 13812
1   libsystem_kernel.dylib          0x0000000191610a60 0x19160e000 + 10848
2   CoreFoundation                  0x00000001917b8068 0x19170f000 + 692328
3   CoreFoundation                  0x00000001917b3188 0x19170f000 + 672136
4   CoreFoundation                  0x00000001917b28bc 0x19170f000 + 669884
5   CoreFoundation                  0x00000001917b3608 0x19170f000 + 673288
6   CoreMotion                      0x000000019e0d264c 0x19dfec000 + 943692
7   libsystem_pthread.dylib         0x00000001915571ec 0x19154c000 + 45548
8   libsystem_pthread.dylib         0x000000019155aaec 0x19154c000 + 60140

Thread 12 name:  JavaScriptCore bmalloc scavenger
Thread 12:
0   libsystem_kernel.dylib          0x0000000191632c8c 0x19160e000 + 150668
1   libsystem_pthread.dylib         0x0000000191550204 0x19154c000 + 16900
2   libc++.1.dylib                  0x00000001916847a8 0x191676000 + 59304
3   JavaScriptCore                  0x00000001a04103fc 0x1a0388000 + 558076
4   JavaScriptCore                  0x00000001a0413dcc 0x1a0388000 + 572876
5   JavaScriptCore                  0x00000001a0413ab4 0x1a0388000 + 572084
6   JavaScriptCore                  0x00000001a0414dc0 0x1a0388000 + 576960
7   libsystem_pthread.dylib         0x00000001915571ec 0x19154c000 + 45548
8   libsystem_pthread.dylib         0x000000019155aaec 0x19154c000 + 60140

Thread 13 name:  com.apple.NSURLConnectionLoader
Thread 13:
0   libsystem_kernel.dylib          0x00000001916115f4 0x19160e000 + 13812
1   libsystem_kernel.dylib          0x0000000191610a60 0x19160e000 + 10848
2   CoreFoundation                  0x00000001917b8068 0x19170f000 + 692328
3   CoreFoundation                  0x00000001917b3188 0x19170f000 + 672136
4   CoreFoundation                  0x00000001917b28bc 0x19170f000 + 669884
5   CFNetwork                       0x0000000194a2de68 0x194a2c000 + 7784
6   Foundation                      0x0000000191c230b0 0x191aeb000 + 1278128
7   libsystem_pthread.dylib         0x00000001915571ec 0x19154c000 + 45548
8   libsystem_pthread.dylib         0x000000019155aaec 0x19154c000 + 60140

Thread 14 name:  Heap Helper Thread
Thread 14:
0   libsystem_kernel.dylib          0x0000000191632c8c 0x19160e000 + 150668
1   libsystem_pthread.dylib         0x0000000191550204 0x19154c000 + 16900
2   JavaScriptCore                  0x00000001a03d4b6c 0x1a0388000 + 314220
3   JavaScriptCore                  0x00000001a03baa18 0x1a0388000 + 207384
4   JavaScriptCore                  0x00000001a03932d4 0x1a0388000 + 45780
5   JavaScriptCore                  0x00000001a039365c 0x1a0388000 + 46684
6   JavaScriptCore                  0x00000001a03d27a4 0x1a0388000 + 305060
7   JavaScriptCore                  0x00000001a03d4314 0x1a0388000 + 312084
8   libsystem_pthread.dylib         0x00000001915571ec 0x19154c000 + 45548
9   libsystem_pthread.dylib         0x000000019155aaec 0x19154c000 + 60140

Thread 15 name:  Heap Helper Thread
Thread 15:
0   libsystem_kernel.dylib          0x0000000191632c8c 0x19160e000 + 150668
1   libsystem_pthread.dylib         0x0000000191550204 0x19154c000 + 16900
2   JavaScriptCore                  0x00000001a03d4b6c 0x1a0388000 + 314220
3   JavaScriptCore                  0x00000001a03baa18 0x1a0388000 + 207384
4   JavaScriptCore                  0x00000001a03932d4 0x1a0388000 + 45780
5   JavaScriptCore                  0x00000001a039365c 0x1a0388000 + 46684
6   JavaScriptCore                  0x00000001a03d27a4 0x1a0388000 + 305060
7   JavaScriptCore                  0x00000001a03d4314 0x1a0388000 + 312084
8   libsystem_pthread.dylib         0x00000001915571ec 0x19154c000 + 45548
9   libsystem_pthread.dylib         0x000000019155aaec 0x19154c000 + 60140

Thread 16 name:  JSC Heap Collector Thread
Thread 16:
0   libsystem_kernel.dylib          0x0000000191632c8c 0x19160e000 + 150668
1   libsystem_pthread.dylib         0x0000000191550204 0x19154c000 + 16900
2   JavaScriptCore                  0x00000001a03d4b6c 0x1a0388000 + 314220
3   JavaScriptCore                  0x00000001a03baa18 0x1a0388000 + 207384
4   JavaScriptCore                  0x00000001a03932d4 0x1a0388000 + 45780
5   JavaScriptCore                  0x00000001a039365c 0x1a0388000 + 46684
6   JavaScriptCore                  0x00000001a03d27a4 0x1a0388000 + 305060
7   JavaScriptCore                  0x00000001a03d4314 0x1a0388000 + 312084
8   libsystem_pthread.dylib         0x00000001915571ec 0x19154c000 + 45548
9   libsystem_pthread.dylib         0x000000019155aaec 0x19154c000 + 60140

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x0000000000000000   x5: 0x0000000000989680   x6: 0x000000000000006e   x7: 0xffffffffffffffec
    x8: 0x0000000102f69800   x9: 0x0000000000000000  x10: 0x00000000000003e8  x11: 0x000000000000000b
   x12: 0x00000001c708b080  x13: 0x0000000000000001  x14: 0x0000000000000010  x15: 0x000000000000004c
   x16: 0x0000000000000148  x17: 0x0000000000000000  x18: 0x0000000000000000  x19: 0x0000000000000006
   x20: 0x0000000000000407  x21: 0x000000016f5ea5e0  x22: 0x0000000102f698e0  x23: 0x0000000102f698e0
   x24: 0x0000000000000013  x25: 0x000000016f8a2390  x26: 0x0000000102f698e0  x27: 0x00000000000020ff
   x28: 0x0000000002ffffff   fp: 0x000000016f5ea500   lr: 0x000000019154e790
    sp: 0x000000016f5ea4e0   pc: 0x0000000191632ebc cpsr: 0x40000000
   esr: 0x56000080  Address size fault

Unity ads working in Android but not in iOS

$
0
0

My Unity Ads are working fine on Android but when I test my game on iOS TestFlight, the game crashed immediately.

I have checked and ensured the following:

  • I am using the correct GameId for iOS
  • UnityAds file are present in XCode build under "Link binaries with library"
  • App runs perfectly fine except the button that was supposed to show ads caused the crash in the game

I am wondering if only TestFlight would cause this issue but I highly doubt so. Still, I am waiting for Apple's review on whether the app would successfully launch to the app store.

May I get some help on how to solve this issue?

I followed the steps on how to implement the unity ads from here: https://unityads.unity3d.com/help/unity/integration-guide-unity#basic-implementation

PyGame window crashes during while loop - no error message

$
0
0
import pygame, sys, time, os
from scripts import UltraColor
from scripts import textures

pygame.init()

displayWidth = 1280
displayHeight = 720
black = (0,0,0)
white = (255,255,255)
menu = True
gender = True

display = pygame.display.set_mode((displayWidth, displayHeight))

pygame.display.set_caption("Blazing Badge")
clock = pygame.time.Clock()

warriorImage = pygame.image.load("warrior.png")
grassImage = pygame.image.load("grass.png")
playButton = pygame.image.load("play button.png")
durandal = pygame.image.load("durandal.png")
mainscreen = pygame.image.load("mainmenu.jpg")
logo = pygame.image.load("logo.png")

running = True
menu_viewed = False

def empty_screen():
    display.fill(white)

def text_objects(text, font, colour):
    textSurface = font.render(text, True, colour)
    return textSurface, textSurface.get_rect()


action = None

def game_menu():
    intro = True
    while intro:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()
        display.fill(white)
        largeText = pygame.font.Font("The Fighter.otf", 115)
        TextSurf, TextRect = text_objects("Tech Demo", largeText, black)
        TextSurf = pygame.transform.rotate(TextSurf, 15)
        TextRect.center = ((displayWidth*0.68), (displayHeight*0.4))
        playpos = (((displayWidth/2)-100), (displayHeight)*0.7)
        durandalpos = (((displayWidth/2)-280), (displayHeight*0.2))
        display.blit(mainscreen, (0,0))
        display.blit(playButton, playpos)
        durandalresized = pygame.transform.scale(durandal, (561, 333))
        display.blit(durandalresized, durandalpos)
        display.blit(logo, ((displayWidth*0.2), (displayHeight*0.35)))
        display.blit(TextSurf, TextRect)


        mouse = pygame.mouse.get_pos()
        click = pygame.mouse.get_pressed()

        print(click)
        print(mouse)


        if 580 < mouse[0] < 710 and 532 < mouse[1] < 674:
            if click[0] == 1:
                intro = False
                print("Start Game")
        pygame.display.update()
        clock.tick(15)

def character_creation():
    creation = True

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            quit()
    gender_symbols = pygame.image.load(os.path.join("graphics\Character Creation", "Gender Symbols.png"))
    creation_background = pygame.image.load(os.path.join("graphics\Character Creation", "creationbackground.jpg"))
    TextSurf, TextRect = text_objects("Choose your gender", pygame.font.Font("The Fighter.otf", 115), white)


    display.blit(creation_background, (0,0))
    display.blit(TextSurf, (((1280/2)-500), displayHeight*0.1))
    display.blit(gender_symbols,(340, (displayHeight*0.6)))
    pygame.display.update()

    mouse = pygame.mouse.get_pos()
    click = pygame.mouse.get_pressed()
    print(click)
    print(mouse)
    mcgender = "Null"
    creation = False
    gender = True

    while gender:
        print(click)
        print(mouse)
        if 365 < mouse[0] < 602 and 457 < mouse[1] < 702:
            if click[0] == 1:
                mcgender = "Female"
        elif 457 < mouse[1] < 702 and 677 < mouse[0] < 916:
            if click[0] == 1:
                mcgender = "Male"
        if mcgender != "Null":
            gender = False

    print(mcgender)

    display.blit(creation_background, (0,0))
    pygame.display.update()

stone1 = pygame.image.load(os.path.join("graphics", "stone1.png"))

#Game Loop follows -----------------------------------------------------------------------------------------------------

while running:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            quit()

        print(event)

    if menu_viewed == False:
        game_menu()
        menu_viewed = True

    clear_screen = True

    gender = True

    character_creation()


pygame.quit()
quit()

Can anyone provide some assistance? Running the following code, works will until the following section:

while gender:
    print(click)
    print(mouse)
    if 365 < mouse[0] < 602 and 457 < mouse[1] < 702:
        if click[0] == 1:
            mcgender = "Female"
    elif 457 < mouse[1] < 702 and 677 < mouse[0] < 916:
        if click[0] == 1:
            mcgender = "Male"
    if mcgender != "Null":
        gender = False

No error code is produced, but the game window stops responding with no sign of restoring. The mouse readings continue in the terminal, but no response comes from the window. The only way to exit the program is be forcefully stopping the code from Pycharm.

App crashed with "Fail to find supported surface info - CameraId:null" CameraX

$
0
0

I am using new CameraX API (alpha 5).

On devices like: LGE, Samsung, Motorola, OPPO crash with message:

Fail to find supported surface info - CameraId:null

occur.

This crashes are rare, but unacceptable.

Error occur in method:

     private fun initCamera(cameraMode: CameraMode) {
        val lensFacing = if (cameraMode == CameraMode.DEFAULT) CameraX.LensFacing.BACK else CameraX.LensFacing.FRONT
        val metrics = DisplayMetrics().also { textureView?.display?.getRealMetrics(it) }
        val resolution = Size(metrics.widthPixels, metrics.heightPixels)
        val previewConfig = PreviewConfig.Builder()
                .setTargetResolution(resolution)
                .setLensFacing(lensFacing)
                .build()

        preview?.let { CameraX.unbind(preview) }
        preview = Preview(previewConfig)
        preview?.setOnPreviewOutputUpdateListener { previewOutput ->
            val parent = textureView?.parent as ViewGroup
            parent.removeView(textureView)
            parent.addView(textureView, 0)
            textureView?.surfaceTexture = previewOutput.surfaceTexture
        }

        CameraX.bindToLifecycle(this, preview)
    }

in line:

preview = Preview(previewConfig)

It is looks like that it cannot create preview for this devices because cannot get camera.

Is anyone know the possible workaround for this problem?

P.S: I checked. This devices (device models in which crash occur) has both cameras (front, back).

User control always crashes Visual Studio

$
0
0

I'm trying to open a user control in one of our projects. It was created, I believe, in VS 2003, and the project has been converted to VS2008. I can view the code fine, but when I try to load the designer view, VS stops responding and I have to close it with the task manager. I have tried leaving it running for several minutes, but it does not do anything. I ran "devenv /log" but didn't see anything unusual in the log. I can't find a specific error message anywhere. Any idea what the problem might be? Is there a lightweight editing mode I might be able to use or something?

The reason I need to have a look at the visual representation of this control is to decide where to insert some new components.

I've tried googling it and searching SO, but either I don't know what to search or there is nothing out there about this. Any help is appreciated.

(The strangest thing is that the user control seems to load fine in another project which references, but VS crashes as soon as I even so much as click on it in that project.)

EDIT

The user control is a wrapper of a 3rd party HTML editor...so not exactly something which accesses a database.

I just tried putting the control on a new project and it crashed as soon as I dragged it onto the form.


Android Studio 3.0.1 crashes repeatedly

$
0
0

I have used Android Studio for some time. I last updated it to version 3 and used it last about a month ago with no serious issues. After about about a month absence I ran it to edit an app. It would then suddenly disappear as if I had not being running at all.I would then run it again and just as suddenly it would disappear again. When I say disappear, I mean literally disappear as if it never existed on screen.

These disappearances or crashes would happen randomly:

  • I could open Android Studio and then leave the room for a while and on returning, it is no longer running. It has disappeared!
  • I could be busy coding and suddenly it disappears!
  • I could be coding for a while and then select Run to install and run the app on my phone and suddenly Android Studio would disappear

There does not seem to be any pattern or specific trigger that causes it to crash (disappear). Also, when I restart it, there is no indication that there was a problem.

I have downloaded and reinstalled the latest version and the problem persists.

I can access the log files but have absolutely no idea how to interpret them.

Any help would be appreciated. It's driving me nuts.

android Oreo Crash error

$
0
0

The App works on previous versions of Android but not on Oreo, its a webview using Firebase Notifications. I am a bit new to this but have been researching this error and haven't found anything that is similar.

--------- beginning of crash

E/AndroidRuntime: FATAL EXCEPTION: main Process: net.oneteamit.tk, PID: 3171 java.lang.RuntimeException: Unable to start activity ComponentInfo{net.oneteamit.tk/net.oneteamit.tk.MainActivity}: java.lang.IllegalArgumentException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) Caused by: java.lang.IllegalArgumentException at android.os.Parcel.readException(Parcel.java:1946) at android.os.Parcel.readException(Parcel.java:1888) at android.app.INotificationManager$Stub$Proxy.createNotificationChannels(INotificationManager.java:1418) at android.app.NotificationManager.createNotificationChannels(NotificationManager.java:446) at android.app.NotificationManager.createNotificationChannel(NotificationManager.java:434) at net.oneteamit.tk.MainActivity.onCreate(MainActivity.java:47) at android.app.Activity.performCreate(Activity.java:6975) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)  at android.os.Handler.dispatchMessage(Handler.java:105)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6541)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)  W/cr_media: Requires BLUETOOTH permission Application terminated.

public class MainActivity extends AppCompatActivity {

private WebView mWebView;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView( R.layout.activity_main );






    //setContentView(R.layout.activity_main);


    mWebView = (WebView) findViewById(R.id.activity_main_webview);
    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    mWebView.loadUrl("My test URL");
    mWebView.setWebViewClient(new WebViewClient()); //I DISABLED THIS TO HAVE IT OPEN in browser
    mWebView.getSettings().setAppCacheEnabled(false);
    mWebView.clearCache(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        // Create channel to show notifications.
        String channelId  = getString(R.string.default_notification_channel_id);
        String channelName = getString(R.string.default_notification_channel_name);
        NotificationManager notificationManager =
                getSystemService(NotificationManager.class);
        notificationManager.createNotificationChannel(new NotificationChannel(channelId,
                channelName, NotificationManager.IMPORTANCE_LOW));
    }
    //webSettings.setDomStorageEnabled (true);
    //mWebView.getSettings().setDomStorageEnabled(true);
    //mWebView.getSettings().setDatabaseEnabled(true);
    //mWebView.getSettings().setAppCacheEnabled(true);
    //mWebView.getSettings().setJavaScriptEnabled(true);
    //mWebView.setFocusable(false);
    //mWebView.setFocusableInTouchMode(false);
    //mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
    // mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    //mWebView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
    //mWebView.setScrollbarFadingEnabled(false);
    //this.mWebView.setVerticalScrollBarEnabled(true);
    //this.mWebView.setHorizontalScrollBarEnabled(true);
    mWebView.getSettings().setUseWideViewPort(true);//setting wide view
    mWebView.getSettings().setLoadWithOverviewMode(true);//setting default zoomed out view
    mWebView.setInitialScale(1);
    mWebView.getSettings().setBuiltInZoomControls(true);//setting zoom controls

}

@Override
public void onBackPressed() {
    if(mWebView.canGoBack()) {
        mWebView.goBack();
    } else {
        super.onBackPressed();
    }
}



@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}

}

Manifest

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">


    <!-- Set custom default icon. This is used when no icon is set for incoming notification messages.

    <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@mipmap/ic_launcher" />
    <!-- the location above will tell the app where to look for your notification Icon -->


    <meta-data
        android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@color/colorAccent" />

    <meta-data
        android:name="com.google.firebase.messaging.default_notification_channel_id"
        android:value="@string/default_notification_channel_id"/>



    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="com.androidsrc.launchfrombrowser" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>

    </activity>





    <service android:name=".FirebaseInstanceIdService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>
    <service android:name=".FirebaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>
    <service android:name=".MyJobService"
             android:exported="false">
    <intent-filter>
        <action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE"/>
    </intent-filter>
    </service>
</application>
<uses-permission android:name="android.permission.INTERNET" />

RenderThread SIGABRT

$
0
0

I'm receiving a native crash using a shared element transition between activities, but only for Android 8.1 and on Google devices (Pixel, Pixel 2, Nexus 6P, etc...):

pid: 20499, tid: 22683, name: RenderThread  >>> [APPNAME] <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'sp<> assignment detected data race'
    x0   0000000000000000  x1   000000000000589b  x2   0000000000000006  x3   0000000000000008
    x4   0700007411003135  x5   0700007411003135  x6   0700007411003135  x7   3531ffffffffffff
    x8   0000000000000083  x9   0000000010000000  x10  0000007214bf4ca0  x11  0000000000000001
    x12  0000007214bf4dc0  x13  ffffffffffffffff  x14  ffffffffffff0000  x15  ffffffffffffffff
    x16  0000005c0f077fa8  x17  00000072b09c752c  x18  0000000000000008  x19  0000000000005013
    x20  000000000000589b  x21  0000000000000083  x22  00000072249f1f40  x23  00000072249f1f58
    x24  0000007214717590  x25  00000072248393a0  x26  00000072118d9220  x27  0000007214bf5350
    x28  0000007214bf5300  x29  0000007214bf4ce0  x30  00000072b097c760
    sp   0000007214bf4ca0  pc   00000072b097c788  pstate 0000000060000000
backtrace:
    #00 pc 000000000001d788  /system/lib64/libc.so (abort+120)
    #01 pc 0000000000007f08  /system/lib64/liblog.so (__android_log_assert+296)
    #02 pc 0000000000010af4  /system/lib64/libutils.so (android::sp_report_race()+28)
    #03 pc 00000000000fdd08  /system/lib64/libandroid_runtime.so (android::RootRenderNode::detachAnimators()+320)
    #04 pc 00000000000fbcac  /system/lib64/libandroid_runtime.so (android::AnimationContextBridge::destroy()+24)
    #05 pc 000000000006fbd0  /system/lib64/libhwui.so (android::uirenderer::renderthread::Bridge_destroy(android::uirenderer::renderthread::destroyArgs*)+12)
    #06 pc 00000000000718fc  /system/lib64/libhwui.so (android::uirenderer::renderthread::MethodInvokeRenderTask::run()+24)
    #07 pc 0000000000071c70  /system/lib64/libhwui.so (android::uirenderer::renderthread::SignalingRenderTask::run()+28)
    #08 pc 0000000000072a58  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+336)
    #09 pc 0000000000011478  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+280)
    #10 pc 00000000000a9814  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140)
    #11 pc 0000000000067d80  /system/lib64/libc.so (__pthread_start(void*)+36)
    #12 pc 000000000001ec18  /system/lib64/libc.so (__start_thread+68)

It crashes also if the app is on background. How can I solve this? It seems to happen only if the Hardware Acceleration is enable, but I really need it enabled on my app.

AVAudioPlayer crash in Xcode?

$
0
0

When I run my app in from Xcode to my iPhone7, it crashes at this line:

audioNSURL NSURL "file:///private/var/containers/Bundle/Application/016483D7-D06F-4639-A026-CCD0B1F4B31F/Solo%20Mission.app/spaceMusic.mp3" 0x000000028217eac0

Something to do with the AVAudioPlayer inside of the GameViewController which gives me this error message:

Thread 1: EXC_BAD_ACCESS (code=1, address=0x48)

Please help with this issue I have already checked the build phases and the file is there. Below is all of the code (Swift).

import UIKit import SpriteKit import AVFoundation

class GameViewController: UIViewController {

var backingAudio = AVAudioPlayer()


 override func viewDidLoad() {
        super.viewDidLoad()

    let filePath = Bundle.main.path(forResource: "spaceMusic", ofType: "mp3")
    let audioNSURL = NSURL(fileURLWithPath: filePath!)

    do { backingAudio = try AVAudioPlayer(contentsOf: audioNSURL as URL) }
    catch { return print("Cannot Find The Audio") }

    backingAudio.numberOfLoops = -1
    backingAudio.volume = 1
    backingAudio.play()

        if let view = self.view as! SKView? {

            // Load the SKScene from 'GameScene.sks'

            let scene = MainMenuScene(size: CGSize(width: 1536, height: 2048))

                // Set the scale mode to scale to fit the window

                scene.scaleMode = .aspectFill

                // Present the scene

                view.presentScene(scene)

            view.ignoresSiblingOrder = true

            view.showsFPS = false

            view.showsNodeCount = false
        }

    }

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    if UIDevice.current.userInterfaceIdiom == .phone {
        return .allButUpsideDown
    } else {
        return .all
    }
}

override var prefersStatusBarHidden: Bool {
    return true
}

}

Crash only caused since iOS13 which I can't reproduce

$
0
0

Crashlytics has been registering this crash which I can't seem to reproduce. I have looked at the code and I can't find anything that could cause this crash.

What is stranger is that it has only been showing up since the release of iOS13. All the crashes are on devices that have iOS13 installed. Prior to iOS13 this crash never happend. This particular piece of code has been there for over two years.

Can anyone come up with what might be causing this?

Thanks in advance.

Crashed: com.apple.main-thread
0  Spotted by                     0x104eaf2c0 partial apply for closure #1 in CitiesListViewController.tableSections.didset + 35 (CitiesListViewController.swift:35)
1  Spotted by                     0x104ee8508 thunk for @escaping @callee_guaranteed () -> () (<compiler-generated>)
2  libdispatch.dylib              0x1b48b1610 _dispatch_call_block_and_release + 24
3  libdispatch.dylib              0x1b48b2184 _dispatch_client_callout + 16
4  libdispatch.dylib              0x1b489535c _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 996
5  CoreFoundation                 0x1b4b623c4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
6  CoreFoundation                 0x1b4b5d3b8 __CFRunLoopRun + 2004
7  CoreFoundation                 0x1b4b5c8bc CFRunLoopRunSpecific + 464
8  GraphicsServices               0x1be9c8328 GSEventRunModal + 104
9  UIKitCore                      0x1b8bf26d4 UIApplicationMain + 1936
10 Spotted by                     0x104e95c00 main + 21 (SBLAppDelegate.swift:21)
11 libdyld.dylib                  0x1b49e7460 start + 4

This is the code I have (line 35 is self.tableView.reloadData()):

typealias TableData = [SectionData]
typealias SectionData = [String: [Any]]

private var tableSections = TableData() {
    didSet {
        DispatchQueue.main.async {
            self.tableView.reloadData()
        }
    }
}

The datasource code:

func setupData() {
    let sortPurchasedCitiesByAlpha: (CityID, CityID) -> Bool = { (cityId1, cityId2) -> Bool in
        guard
            let city1 = CitiesManager.shared.city(withId: cityId1),
            let city2 = CitiesManager.shared.city(withId: cityId2)
            else { assertionFailure("missing cities?"); return false }
        return city1.name.lowercased() <= city2.name.lowercased()
    }
    var sections = TableData()
    // reverse to show most recent purchase first
    let allPurchased = Array(CitiesManager.shared.purchasedCityIds())
    var purchased: [CityID] = []
    let lastUsedCityId = Defaults[.lastUsedCity]
    if let lastUsedCityId = lastUsedCityId {
        // put last used first
        let rest = Array(allPurchased.removing(lastUsedCityId))
        let restSorted = rest.sorted(by: sortPurchasedCitiesByAlpha)
        if allPurchased.contains(lastUsedCityId) { // may have been deleted
            purchased.append(lastUsedCityId)
        }
        purchased.append(contentsOf: restSorted)
    } else {
        purchased = allPurchased.sorted(by: sortPurchasedCitiesByAlpha)
    }
    installedSectionPresent = !purchased.isEmpty
    if installedSectionPresent {
        sections.append(["Installed": purchased])
    }
    let continents = CitiesManager.shared.allContinentsOfNotPurchasedCities()
    continents.forEach { continent in
        let cityIds = CitiesManager.shared.cityIdsNotPurchased(forContinent: continent)
        sections.append([continent: cityIds])
    }
    tableSections = sections
}

Question and Answer program crashes on release build, works fine on debug build

$
0
0

I have made a question and answer program (Console application) with 3 questions, it works just fine in CodeBlocks 17.12 (debug build), but on the release build ( the .exe file ) it crashes without any error when correctly answering the 3rd question. The program doesn't crash when putting in the wrong answer.

I tried to debug with WinDbg Preview but most of the time it didn't work and when it did the program did NOT crash when correctly answering the 3rd question and worked as normal. I also tried to remove the SetConsoleAttribute colors, but that didn't work either.

#include <iostream>
#include <cstdlib>
#include <stdlib.h>
#include <windows.h>

using namespace std;

int main()
{
SetConsoleTitle("Bloodrush: The Game");
cout << "Question 3"<< endl;
cout << "text"<< endl;
cout << "A)"<< endl;
cout << "B)"<< endl;
cout << "C)"<< endl;
cout << "D)"<< endl;
cout << "E)"<< endl;
string ANSWER3;
cin >> ANSWER3;
if ((ANSWER3 == "E") || (ANSWER3 == "e") || (ANSWER3 == "e)") || (ANSWER3 == "e)"))
 {
   if (system("CLS"))
        system("clear");
    cout << "text"<< endl;
    cout << "text"<< endl;
    cout << "text \n"<< endl;
    cout << "text"<< endl;
    return 0;
  }
    else
    {
            SetConsoleTitle("Wrong Answer");
            if (system("CLS")) system("clear");
            cout << "text \n"<< endl;
            cout << "Press ENTER to return to the MAIN MENU..."<< endl;
            cin.ignore();
            cin.get();
            cout << "no menu"<< endl;
    }
}

'throw' from within bsync.compare crashes node?

$
0
0

Okay. I'm sure this is going to come off as obvious and noobish. But I've only been having a go at learning express/node/react for a month or so now.

I'm just trying to make a simple node signin API call. Here's a snippet of code, with some pseudo-izing of the unimportant parts for brevity:

server.post('/signin', (request, response) => {
    const {user_email, password} = request.body

    // query db for user validation
    db('user_login')
    /* knex query building, blah blah blah */
    .then(res => {
        if (res.length == 0) {
            // if res.length == 0, user not found
            throw new Error("bad credentials")
        } else if (res.length > 1) {
            // if res.length > 1, duplicate user found - shouldn't ever happen
            throw new Error("CRITICAL: database error")
        } else {
            // everything should be ok - pass res on to bcrypt
            return res
        }
    })
    .then(res => {
        // bcrypt.compare doesn't return a promise because it is being given a cb
        bcrypt.compare(password, res[0].pw_hash, (err, match) => {
            if (match) {
                // delete pw_hash from any possible response(),
                // don't give client more info than it needs
                delete res[0].pw_hash

                // we have a match! inform the client
                response.json(res[0])
            } else {
                // we don't have a match
                throw new Error("bad credentials")  // WHY DOES THIS THROW CRASH!??!?!!?!?
            }
        })
    })
    // WHY ISNT THIS REACHED WHEN THERE'S A PASSWORD MISMATCH?
    .catch(err => {
        console.error('signin error: ', err)
        response.status(403).json({
            name: err.message,
            severity: 'auth error',
            code: 403
        })
    })
})

Ok so: - When a correct username and correct password is supplied, it functions as expected. - When an incorrect username is supplied, the .catch is reached (ie. functions as expected). - BUT: when a correct username and an incorrect password is supplied, the throw statement (with the comment // WHY DOES THIS THROW CRASH?)... crashes node.

Here's the call stack:

C:\.............\server.js:83
                throw new Error("bad credentials")      // WHY DOES THIS THROW CRASH!??!?!!?!?
                ^

Error: bad credentials
    at C:\.............\server.js:83:23
    at C:\.............\node_modules\bcrypt-nodejs\bCrypt.js:689:3
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
[nodemon] app crashed - waiting for file changes before starting...

I could "cheat" and just do a response.status(403).... instead of that throw. But in my mind, throwing that error ought to jump to the .catch, and handle any auth failure there.

Can anyone help me w/ what's going on here? It's very frustrating.

PS. This crash only seems to be happening when the throw is within the bcrypt.compare callback. I figure that has something to do with it. I've googled.. I've looked around on here.. I've wrapped things in try/catch blocks. I'm just beating my head against it at this point.

Thank you! :)


swift_initClassMetadataImpl EXC_BAD_ACCESS with Xcode 11.2.1

$
0
0

I recently updated to the Xcode 11 beta, and my code seems to crash at a Swift runtime function swift_initClassMetadataImpl with an EXC_BAD_ACCESS error.

Is there a temporary workaround for this?

Edit: This issue is still present on Xcode 11.2.1 GM.

Fatal Exception: java.lang.RuntimeException Failed to resolve attribute at index 96

$
0
0

I am using this library: com.github.sephiroth74:android-target-tooltip:2.0.4 for displaying tooltips. Min api level I support is 19 (Android 4.4+), but this library crashes on users with Android 4.4.2 & 5.0 on ZenFone mobile devices. With crash log:

Fatal Exception: java.lang.RuntimeException
Failed to resolve attribute at index 96


Fatal Exception: java.lang.RuntimeException
Failed to resolve attribute at index 96
android.content.res.TypedArray.getColor (TypedArray.java:401)
androidx.appcompat.widget.AppCompatTextView.<init> (AppCompatTextView.java:79)
it.sephiroth.android.library.xtooltip.Tooltip.preparePopup (Tooltip.kt:309)
it.sephiroth.android.library.xtooltip.Tooltip.show (Tooltip.kt:624)
com.companyName.view.activity.ShopTransactionBrowser.showGreenBar (ShopTransactionBrowser.java:1192)
com.companyName.view.activity.ShopTransactionBrowser.activateFrame (ShopTransactionBrowser.java:677)
com.companyName.view.activity.ShopTransactionBrowser.access$1100 (ShopTransactionBrowser.java:106)
com.companyName.view.activity.ShopTransactionBrowser$2.onPageFinished (ShopTransactionBrowser.java:610)
N6.b (PG:15)
ro.handleMessage (PG:43)

Link for the lib: https://github.com/sephiroth74/android-target-tooltip

This is how I call it from code, where crash happens:

    Tooltip infoTooltip = new Tooltip.Builder(this)
                            .overlay(false)
                            .anchor(top_panel_container, 0, 0, false)
                            .text(getResources().getString(R.string.active_tooltip_title))
                            .maxWidth(tooltipWidth)
                            .arrow(true)

 .closePolicy(ClosePolicy.Companion.getTOUCH_INSIDE_NO_CONSUME())                        .floatingAnimation(Tooltip.Animation.Companion.getSLOW())
                            .showDuration(5000)
                            .styleId(R.style.ToolTipAltGreenStyle)
                            .create();
                    infoTooltip.show(top_panel_container, Tooltip.Gravity.BOTTOM, true);

And this is my style.xml file:

<style name="ToolTipAltGreenStyle" parent="ToolTipLayoutDefaultStyle">
    <item name="ttlm_padding">16dp</item>
    <item name="ttlm_backgroundColor">@color/re_green</item>
    <item name="ttlm_cornerRadius">6dp</item>
    <item name="ttlm_arrowRatio">1.2</item>
    <item name="ttlm_overlayStyle">@style/ToolTipOverlayAltStyle</item>
    <item name="ttlm_animationStyle">@style/ToolTipAltAnimation</item>
    <item name="ttlm_textStyle">@style/ToolTipAltTextStyle</item>
</style>

<style name="ToolTipAltRedStyle" parent="ToolTipLayoutDefaultStyle">
    <item name="ttlm_padding">16dp</item>
    <item name="ttlm_backgroundColor">@color/re_red</item>
    <item name="ttlm_cornerRadius">6dp</item>
    <item name="ttlm_arrowRatio">1.2</item>
    <item name="ttlm_overlayStyle">@style/ToolTipOverlayAltStyle</item>
    <item name="ttlm_animationStyle">@style/ToolTipAltAnimation</item>
    <item name="ttlm_textStyle">@style/ToolTipAltTextStyle</item>
</style>

<style name="ToolTipAltTextStyle" parent="ToolTipTextStyle">
    <item name="android:textColor">@android:color/white</item>
</style>

<style name="ToolTipOverlayAltStyle" parent="ToolTipOverlayDefaultStyle">
    <item name="android:color">?attr/colorAccent</item>
    <item name="android:alpha">0.3</item>
</style>

<style name="ToolTipAltAnimation">
    <item name="android:windowEnterAnimation">@anim/custom_anim_enter</item>
    <item name="android:windowExitAnimation">@anim/custom_anim_exit</item>
</style>

Possible causes of Java VM EXCEPTION_ACCESS_VIOLATION?

$
0
0

When a Java VM crashes with an EXCEPTION_ACCESS_VIOLATION and produces an hs_err_pidXXX.log file, what does that indicate? The error itself is basically a null pointer exception. Is it always caused by a bug in the JVM, or are there other causes like malfunctioning hardware or software conflicts?

Edit: there is a native component, this is an SWT application on win32.

Android app crashes when trying to connect to CC receiver

$
0
0

Some of our users are experiencing issues with connection to the Chromecast receiver. When they select a CC device in the app from the list of available devices the app crashes. Here is the stacktrace of the crash, but Googles SDK seems so cryptic that we have no idea of what the actual code is calling.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'void com.google.android.gms.internal.cast.zzlp.zzhv()' on a null object reference
       at com.google.android.gms.internal.cast.zzmd.zza + 3(zzmd.java:3)
       at com.google.android.gms.internal.cast.zzmw.zze + 2519(zzmw.java:2519)
       at com.google.android.gms.internal.cast.zzlg$zzb.zzjd + 22(zzlg.java:22)
       at com.google.android.gms.internal.cast.zzlg$zzb.zzjf + 40(zzlg.java:40)
       at com.google.android.gms.internal.cast.zzlg$zzb.zzje + 25(zzlg.java:25)
       at com.google.android.gms.internal.cast.zzlg$zzb.zzjg + 41(zzlg.java:41)
       at com.google.android.gms.internal.cast.zzbc.zzb + 21(zzbc.java:21)
       at com.google.android.gms.internal.cast.zzba.onSessionResuming + 25(zzba.java:25)
       at com.google.android.gms.cast.framework.zzag.zzb + 35(zzag.java:35)
       at com.google.android.gms.cast.framework.zzz.dispatchTransaction + 37(zzz.java:37)
       at com.google.android.gms.internal.cast.zza.onTransact + 13(zza.java:13)
       at android.os.Binder.transact + 675(Binder.java:675)
       at kk.b + 13(kk.java:13)
       at sf.b + 28(sf.java:28)
       at sr.b + 31(sr.java:31)
       at ss.a + 89(ss.java:89)
       at rb.b + 8(rb.java:8)
       at st.handleMessage + 12(st.java:12)
       at android.os.Handler.dispatchMessage + 108(Handler.java:108)
       at zy.dispatchMessage + 5(zy.java:5)
       at android.os.Looper.loop + 216(Looper.java:216)
       at android.app.ActivityThread.main + 7625(ActivityThread.java:7625)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 524(RuntimeInit.java:524)
       at com.android.internal.os.ZygoteInit.main + 987(ZygoteInit.java:987)

Here is some more info on the SDK and versions: Project Android versions:

compileSdk: 28
buildTools: "28.0.3"
minSdk    : 21
targetSdk : 28

Dependencies for CC:

com.google.android.gms:play-services-cast-framework:17.1.0
androidx.mediarouter:mediarouter:1.1.0

We use androidx extensions(Jetpack) with koin and livedata:

implementation "org.koin:koin-android:1.0.2"
implementation "org.koin:koin-androidx-viewmodel:1.0.2"
implementation "org.koin:koin-androidx-scope:1.0.2"
implementation "androidx.core:core-ktx:1.1.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.1.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0"
implementation "androidx.lifecycle:lifecycle-livedata:2.1.0"

I should note that the stacktrace is originating from kk.java class, but other devices have another name like lp.java or ke.java. This is most probably because of different Google play-services implementations.

Any help would be appreciated :-)

Crashing JSON Parsing Android App

$
0
0

Im trying to create an app that gets a json object from a url. This is proving to be unnecessarily frustrating as it keeps crashing on the activity that is supposed to load and parse the json object. It just pops up the message "Unfortunately, (AppName) has stopped." and then exits the application. The data from the JSON is never shown on the screen. Here is the code with the activity and the JSON parsing

package com.example.Accomplist;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.RemoteException;
import android.widget.TextView;
import android.widget.Toast;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: DESAI_628IL
 * Date: 3/1/13
 * Time: 7:34 PM
 * To change this template use File | Settings | File Templates.
 */
public class MainScreen extends Activity{
    TextView myTextView;
   // HttpClient client;
    // url to make request
    final static String url = "http://accomplist.herokuapp.com/api/v1/sharedevent/2/?format=json";

    private static final String TAG_EVENT="event"; //A JSON object within the JSON object that will be returned by JSONParse()
    private static final String TAG_DESCRIPTION="description"; //A JSON tag within the JSON object EVENT
    private static String eventString="Yo";
    static JSONObject json;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_screen);
        new JSONParse().execute(url);
    }
private class JSONParse extends AsyncTask<String, String, String> {
    HttpClient client;
    JSONObject jsonObj= null;
    @Override
    protected String doInBackground(String... jsonurl) {
        StringBuilder url= new StringBuilder(String.valueOf(jsonurl));
        HttpGet get= new HttpGet(url.toString());
        HttpResponse r= null;
        try {
            r = client.execute(get);
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        int status= r.getStatusLine().getStatusCode();
        if (status==200){
            HttpEntity e=r.getEntity();
            String data= null;
            try {
                data = EntityUtils.toString(e);
            } catch (IOException e1) {
                e1.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
            try {
                jsonObj = new JSONObject(data);
            } catch (JSONException e1) {
                e1.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
            try {
                JSONObject eventJson= jsonObj.getJSONObject(TAG_EVENT);
                eventString= eventJson.getString(TAG_DESCRIPTION);
            }
            catch (JSONException e1) {
                eventString="Couldn't Parse Data";
            }
            return eventString;
        }
        else{
            return eventString;
        }
    }
    protected void onProgressUpdate(String... progress) {
        Toast loadingToast= Toast.makeText(getApplicationContext(), "Loading", Toast.LENGTH_LONG);
        loadingToast.show();
    }
    protected void onPostExecute(String result) {
        eventString=result;
        myTextView = (TextView)findViewById(R.id.textView1);
        myTextView.setText(eventString);
    }
}
}

I hope someone can help. Ive been stuck on this for the longest time. Ive tried many things. Ive tried different ways of getting the JSON object from the url, putting the parsing code in a different class, and lots of other small things. Any help would be appreciated. Here is the LogCat error report

02-26 12:18:46.691: ERROR/ThrottleService(324): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)
02-26 12:19:53.601: WARN/dalvikvm(4073): threadid=11: thread exiting with uncaught exception (group=0x40a71930)
02-26 12:19:55.121: WARN/dalvikvm(4073): threadid=12: thread exiting with uncaught exception (group=0x40a71930)
02-26 12:19:57.632: WARN/InputMethodManagerService(324): Got RemoteException sending setActive(false) notification to pid 4073 uid 10048
02-26 12:20:03.452: WARN/dalvikvm(4094): threadid=11: thread exiting with uncaught exception (group=0x40a71930)
02-26 12:20:04.744: ERROR/AndroidRuntime(4094): FATAL EXCEPTION: AsyncTask #1
        java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:299)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
        at java.util.concurrent.FutureTask.run(FutureTask.java:239)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:856)
        Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 0: [Ljava.lang.String;@40d12070
        at java.net.URI.create(URI.java:727)
        at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:75)
        at com.example.Accomplist.MainScreen$JSONParse.doInBackground(MainScreen.java:84)
        at com.example.Accomplist.MainScreen$JSONParse.doInBackground(MainScreen.java:78)
        at android.os.AsyncTask$2.call(AsyncTask.java:287)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        ... 4 more
02-26 12:20:10.512: WARN/InputMethodManagerService(324): Got RemoteException sending setActive(false) notification to pid 4094 uid 10048
02-26 12:20:24.401: WARN/dalvikvm(4111): threadid=11: thread exiting with uncaught exception (group=0x40a71930)
02-26 12:20:24.441: ERROR/AndroidRuntime(4111): FATAL EXCEPTION: AsyncTask #1
        java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:299)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
        at java.util.concurrent.FutureTask.run(FutureTask.java:239)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:856)
        Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 0: [Ljava.lang.String;@40d12038
        at java.net.URI.create(URI.java:727)
        at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:75)
        at com.example.Accomplist.MainScreen$JSONParse.doInBackground(MainScreen.java:84)
        at com.example.Accomplist.MainScreen$JSONParse.doInBackground(MainScreen.java:78)
        at android.os.AsyncTask$2.call(AsyncTask.java:287)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        ... 4 more
02-26 12:20:29.411: WARN/InputMethodManagerService(324): Got RemoteException sending setActive(false) notification to pid 4111 uid 10048
Viewing all 7144 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>