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

Android : Branch SDK Crash Issue in production build

$
0
0

I am using Branch SDK in my application (latest version of Android Branch SDK (v4.3.2)) Since last update I am facing class not found issue in production release. But in development it works without any issues. Here is the crash log from firebase.

Fatal Exception: java.lang.RuntimeException
Unable to instantiate receiver io.branch.referral.InstallListener: java.lang.ClassNotFoundException: Didn't find class "io.branch.referral.InstallListener" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/gman.vedicastro-dnsDZX6uCyAilVBlCp8zjQ==/base.apk"],nativeLibraryDirectories=[/data/app/gman.vedicastro-dnsDZX6uCyAilVBlCp8zjQ==/lib/arm64, /system/lib64]]

Caused by java.lang.ClassNotFoundException
Didn't find class "io.branch.referral.InstallListener" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/gman.vedicastro-dnsDZX6uCyAilVBlCp8zjQ==/base.apk"],nativeLibraryDirectories=[/data/app/gman.vedicastro-dnsDZX6uCyAilVBlCp8zjQ==/lib/arm64, /system/lib64]]

As per the document from branch, I have removed this code from Android Manifest file

<receiver android:name="io.branch.referral.InstallListener" android:exported="true">
  <intent-filter>
  <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>
</receiver>

Any idea why this issue happened?

Please help me to resolve this. Thanks.


Why does my ble app crash when I move a function call to a different button?

$
0
0

I am currently attempting to make the app I am developing more simple to use but I am running into an issue trying to consolidate the amount of buttons needed to establish connection to a PSoC 4 BLE. In the end I want one button to handle searching, connecting, and discovery of services. But when I copy and past the code (for search, connecting, and discovering) under the method that handles activating the Bluetooth radio, the app crash when it encounters the scan callback. I am still new to Android app development and I am trying to use the debugger but I seem to be stuck. The first snippet of code is what I am trying to do, the second snippet is the scan function that is being called. The following snippet is the debugger output.

//what I am trying to do
    public void startBluetooth(View view) {

        /** Find BLE service and adapter */
        final BluetoothManager bluetoothManager =
                (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
        BluetoothAdapter mBluetoothAdapter = bluetoothManager.getAdapter();

        /** Ensures Bluetooth is enabled on the device.  If Bluetooth is not currently enabled,
        // fire an intent to display a dialog asking the user to grant permission to enable it. */
        if (!mBluetoothAdapter.isEnabled()) {
            Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
            startActivityForResult(enableBtIntent, REQUEST_ENABLE_BLE);
        }

        /** Start the BLE Service */
        Log.d(TAG, "Starting BLE Service");
        Intent gattServiceIntent = new Intent(this, PSoCCapSenseLEDService.class);
        bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);


        /** Disable the start button and turn on the search  button */
        start_button.setEnabled(false);
        search_button.setEnabled(true);
        Log.d(TAG, "Bluetooth is Enabled");



        // search function does not crash app
        // cannot force step into if statement, is mServiceConnected true?
        // no mServiceConnected appears to false
        // okay let's force this if statement to be executed
        // but first setting code back to normal and seeing how mServiceConnected is set

       mPSoCCapSenseLedService.scan(); // causes crash
        mPSoCCapSenseLedService.connect(); // crash
        mPSoCCapSenseLedService.discoverServices();
    }
    public void scan() {
        /** Scan for devices and look for the one with the service that we want
         *   UUID ending in F0 i.e. the ledcapsense service*/
        UUID capsenseLedService = UUID.fromString(capsenseLedServiceUUID);
        UUID[] capsenseLedServiceArray = {capsenseLedService};

        /** Use old scan method for versions for different platform versions */
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            /** noinspection deprecation */
            mBluetoothAdapter.startLeScan(capsenseLedServiceArray, mLeScanCallback);
        } else { /** New BLE scanning introduced in LOLLIPOP */
            ScanSettings settings;
            List<ScanFilter> filters;
            mLEScanner = mBluetoothAdapter.getBluetoothLeScanner();
            settings = new ScanSettings.Builder()
                    .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
                    .build();
            filters = new ArrayList<>();
            /** We will scan just for the CAR's UUID */
            ParcelUuid PUuid = new ParcelUuid(capsenseLedService);
            ScanFilter filter = new ScanFilter.Builder().setServiceUuid(PUuid).build();
            filters.add(filter);
            mLEScanner.startScan(filters, settings, mScanCallback);
        }
    }
this.mResolvedMethod = No such instance field: 'mResolvedMethod'
this = {MainActivity@9661} 
view = {AppCompatButton@9664} "android.support.v7.widget.AppCompatButton{60e52c VF.D..C.. ...P..ID 64,64-1376,256 #7f07008a app:id/start_button}"
bluetoothManager = {BluetoothManager@9665} 
 mAdapter = {BluetoothAdapter@9666} 
 shadow$_klass_ = {Class@3343} "class android.bluetooth.BluetoothManager"
 shadow$_monitor_ = 0
mBluetoothAdapter = {BluetoothAdapter@9666} 
 mBleExtSupportArr = {boolean[1]@9772} 
 mBleSupportArr = {boolean[6]@9773} 
 mBluetoothDisableBleCallback = {BluetoothAdapter$4@9774} 
 mBluetoothStateChangeCallback = {BluetoothAdapter$3@9775} 
 mContext = {Application@9688} 
 mIsBleExtSupportArrSet = false
 mIsBleSupportArrSet = false
 mLeScanClients = {HashMap@9776}  size = 0
 mLock = {Object@9777} 
 mManagerCallback = {BluetoothAdapter$2@9778} 
 mManagerService = {IBluetoothManager$Stub$Proxy@9779} 
 mMyPid = 32668
 mMyUid = 10025
 mPackageName = "iantempleton0.gmail.com.fromscratch"
 mProxyServiceStateCallbacks = {ArrayList@9781}  size = 0
 mService = {IBluetooth$Stub$Proxy@9782} 
 mServiceLock = {ReentrantReadWriteLock@9783} "java.util.concurrent.locks.ReentrantReadWriteLock@366f373[Write locks = 0, Read locks = 0]"
 mStateChangedCallbacks = {ArrayList@9784}  size = 0
 mSwitchingUser = false
 mToken = {Binder@9785} 
 packageNameforEnable = ""
 shadow$_klass_ = {Class@5364} "class android.bluetooth.BluetoothAdapter"
 shadow$_monitor_ = 0
gattServiceIntent = {Intent@9667} "Intent { cmp=iantempleton0.gmail.com.fromscratch/.PSoCCapSenseLEDService }"
 mAction = null
 mCategories = null
 mClipData = null
 mComponent = {ComponentName@9789} "ComponentInfo{iantempleton0.gmail.com.fromscratch/iantempleton0.gmail.com.fromscratch.PSoCCapSenseLEDService}"
 mContentUserHint = -2
 mData = null
 mExtras = null
 mFlags = 0
 mForceLaunchOverTargetTask = false
 mIdentifier = null
 mLaunchOverTargetTaskId = 0
 mLaunchToken = null
 mPackage = null
 mPairActivityUserId = 0
 mPairWindowingMode = 0
 mSelector = null
 mSourceBounds = null
 mType = null
 shadow$_klass_ = {Class@3753} "class android.content.Intent"
 shadow$_monitor_ = 0
search_button = {AppCompatButton@9668} "android.support.v7.widget.AppCompatButton{b1d2bf5 VFED..C.. ......ID 64,256-1376,448 #7f070072 app:id/search_button}"
 mBackgroundTintHelper = {AppCompatBackgroundHelper@9792} 
 mTextHelper = {AppCompatTextHelper@9793} 
 mIsThemeDeviceDefault = false
 HOVER_INTERVAL = 300
 SEC_CLIPBOARD_DISABLED = 0
 SEC_CLIPBOARD_ENABLED = 1
 SEC_CLIPBOARD_UNKNOWN = -1
 TOUCH_DELTA = 12.0
 mActionModeFlags = 241664
 mAllowTransformationLengthChange = false
 mAttachedWindow = false
 mAutoLinkMask = 0
 mAutoSizeMaxTextSizeInPx = -1.0
 mAutoSizeMinTextSizeInPx = -1.0
 mAutoSizeStepGranularityInPx = -1.0
 mAutoSizeTextSizesInPx = {int[0]@9725} 
 mAutoSizeTextType = 0
 mBoring = {BoringLayout$Metrics@9794} "FontMetricsInt: top=-60 ascent=-52 descent=14 bottom=16 leading=0 width=441"
 mBreakStrategy = 0
 mBufferType = {TextView$BufferType@9727} "NORMAL"
 mButtonShapeAlpha = 0
 mButtonShapeColor = -570425344
 mButtonShapeLuminance = 0.0
 mButtonShapeOutlineRadius = 0
 mButtonShapeOutlineStrokeBottom = 0
 mButtonShapeOutlineStrokeDisabled = 0
 mButtonShapeOutlineStrokeEnabled = 0
 mButtonShapeOutlineStrokeHorizontal = 0
 mButtonShapeOutlineStrokeTop = 0
 mButtonShapePaint = null
 mButtonShapeRect = null
 mButtonShapeSettingEnabled = false
 mButtonShapeTextColor = null
 mButtonShapeTextColorDark = 0
 mButtonShapeTextColorLight = 0
 mCanPaste = false
 mCanTextMultiSelection = false
 mChangeWatcher = null
 mChangedSelectionBySIP = false
 mCharWrapper = null
 mClipboardChangeListener = null
 mClipboardDataFormat = 1
 mCoverManager = null
 mCurHintTextColor = 1627389952
 mCurTextColor = -570425344
 mCurrentSpellCheckerLocaleCache = null
 mCursorDrawable = null
 mCursorDrawableRes = 17304300
 mDPIMaxLength = -1
 mDPITextBuffer = null
 mDeferScroll = -1
 mDesiredHeightAtMeasure = 192
 mDeviceProvisionedState = 0
 mDisplayText = null
 mDrawStrikeAnimationValue = 0.0
 mDrawTextStrikeAnimator = null
 mDrawables = null
 mEditableFactory = {Editable$Factory@9728} 
 mEditor = null
 mEllipsisKeywordCount = -1
 mEllipsisKeywordStart = -1
 mEllipsize = null
 mEnableLinkPreview = false
 mEnableMultiSelection = true
 mFakeBold = {Boolean@9729} false
 mFilters = {InputFilter[0]@9730} 
 mFlagForGlobalLayout = false
 mFreezesText = false
 mGlobalLayoutListener = null
 mGravity = 17
 mHasPresetAutoSizeValues = false
 mHighlightColor = 1728004225
 mHighlightPaint = {Paint@9795} 
 mHighlightPath = null
 mHighlightPathBogus = true
 mHint = null
 mHintBoring = null
 mHintLayout = null
 mHintTextColor = {ColorStateList@9732} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[16842910, 16842919], []]mColors=[-1979711488, 1627389952]mDefaultColor=1627389952}"
 mHorizontallyScrolling = false
 mHoverEnterTime = -1
 mHoverExitTime = -1
 mHoveredSpan = null
 mHyphenationFrequency = 0
 mIncludePad = true
 mIsButtonShapeTarget = false
 mIsDebugTextClock = false
 mIsSecClipboardEnabled = -1
 mIsShowingLinkPreview = false
 TextView.mIsThemeDeviceDefault = false
 mIsThemeDeviceDefaultDark = false
 mIsTouchDown = false
 mJustificationMode = 0
 mKeycodeDpadCenterStatus = false
 mLastLayoutDirection = 0
 mLastScroll = 0
 mLastValueSentToAutofillManager = null
 mLayout = {BoringLayout@9796} 
 mLineIsDrawed = false
 mLinkTextColor = {ColorStateList@9734} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[]]mColors=[-49023]mDefaultColor=-49023}"
 mLinksClickable = true
 mListenerChanged = false
 mListeners = null
 mLocalesChanged = false
 mMarquee = null
 mMarqueeFadeMode = 0
 mMarqueeRepeatLimit = 3
 mMaxMode = 1
 mMaxWidth = 2147483647
 mMaxWidthMode = 2
 mMaximum = 2147483647
 mMinMode = 2
 mMinWidth = 352
 mMinWidthMode = 2
 mMinimum = 192
 mMovement = null
 mMultiHighlightColor = -1728022343
 mMultiHighlightPaint = null
 mMultiSelectPopupWindow = {MultiSelectPopupWindow@9735} 
 mNeedsAutoSizeText = false
 mOldMaxMode = 1
 mOldMaximum = 2147483647
 mPasteEventListener = null
 mPenSelectionController = null
 mPreDrawListenerDetached = false
 mPreDrawRegistered = false
 mPrecomputed = null
 mPreventDefaultMovement = false
 mRestartMarquee = false
 mRestrictionPolicy = null
 mSavedHintLayout = null
 mSavedLayout = {BoringLayout@9796} 
 mSavedMarqueeModeLayout = null
 mScroller = null
 mSemClipboardManager = null
 mShadowColor = 0
 mShadowDx = 0.0
 mShadowDy = 0.0
 mShadowRadius = 0.0
 mSingleLine = false
 mSkipUpdateDisplayText = false
 mSoftInputEnabled = true
 mSpacingAdd = 0.0
 mSpacingMult = 1.0
 mSpannable = null
 mSpannableFactory = {Spannable$Factory@9736} 
 mStrikeThroughPaint = null
 mStylusEventListener = null
 mTempRect = null
 mTempTextPaint = null
 mText = "Search for Device"
 mTextClassificationContext = null
 mTextClassificationSession = null
 mTextClassifier = null
 mTextColor = {ColorStateList@9738} "ColorStateList{mThemeAttrs=nullmChangingConfigurations=0mStateSpecs=[[-16842910], []]mColors=[1107296256, -570425344]mDefaultColor=-570425344}"
 mTextDir = {TextDirectionHeuristics$TextDirectionHeuristicInternal@9739} 
 mTextEditSuggestionContainerLayout = 17367391
 mTextEditSuggestionHighlightStyle = 16974826
 mTextEditSuggestionItemLayout = 17367393
 mTextEffect = {SFText@9798} 
 mTextEffectFontFamily = "sans-serif-medium"
 mTextEffectLines = 0
 mTextId = 2131427338
 mTextOperationUser = null
 mTextPaint = {TextPaint@9799} 
 mTextSelectHandle = null
 mTextSelectHandleLeft = null
 mTextSelectHandleLeftRes = 17304305
 mTextSelectHandleRes = 17304307
 mTextSelectHandleRight = null
 mTextSelectHandleRightRes = 17304309
 mTextSetFromXmlOrResourceId = true
 mTextStrikeThroughEnabled = false
 mToolType = 0
 mTransformation = null
 mTransformed = "Search for Device"
 mUseDisplayText = false
 mUseFallbackLineSpacing = true
 mUseInternationalizedInput = true
 mUserSetTextScaleX = false
 mWordIteratorForMultiSelection = null
 mhasMultiSelection = false
 isPenSideButton = false
 mAccessibilityCursorPosition = -1
 mAccessibilityDelegate = null
 mAccessibilityPaneTitle = null
 mAccessibilityTraversalAfterId = -1
 mAccessibilityTraversalBeforeId = -1
 mAccessibilityViewId = 7
 mAnimator = null
 mAppRespTracker = null
 mAttachInfo = {View$AttachInfo@9743} 
 mAttributeResolutionStacks = null
 mAttributeSourceResId = null
 mAttributes = null
 mAutofillHints = null
 mAutofillId = null
 mAutofillViewId = -1
 mBackground = {RippleDrawable@9800} 
 mBackgroundRenderNode = {RenderNode@9801} 
 mBackgroundResource = 0
 mBackgroundSizeChanged = false
 mBackgroundTint = null
 mBixbyTouchFoundText = null
 mBottom = 448
 mBottomLeftRound = null
 mBottomLeftRoundColor = 0
 mBottomRightRound = null
 mBottomRightRoundColor = 0
 mCachedContentCaptureSession = null
 mCachingFailed = false
 mClipBounds = null
 mContentCaptureSession = null
 mContentDescription = null
 mContext = {MainActivity@9661} 
 mCurrentAnimation = null
 mDefaultFocusHighlight = null
 mDefaultFocusHighlightCache = null
 mDefaultFocusHighlightEnabled = true
 mDefaultFocusHighlightSizeChanged = true
 mDefaultRoundedCornerColor = 0
 mDeviceRadius = 0
 mDirectPenInput = null
 mDisablePenGestureforfactorytest = true
 mDrawableState = {int[4]@9802} 
 mDrawingCache = null
 mDrawingCacheBackgroundColor = 0
 mExplicitStyle = 0
 mExtraPaddingBottomForPreference = 0
 mFloatingTreeObserver = null
 mForegroundInfo = null
 mFrameMetricsObservers = null
 mGhostView = null
 mHasPerformedLongPress = false
 mHorizontalScrollbarPosition = 0
 mHoverPopup = null
 mHoverPopupToolTypeByApp = 0
 mHoverPopupType = 0
 mHoveringTouchDelegate = false
 mID = 2131165298
 mIgnoreNextUpEvent = false
 mImageFilterBridge = null
 mInContextButtonPress = false
 mInputEventConsistencyVerifier = null
 mIsAllowedPokeDrawLock = false
 mIsDirectPenInputEnabled = false
 mIsSetFingerHoveredInAppWidget = true
 mKeyedTags = null
 mLabelForId = -1
 mLastIsOpaque = false
 mLayerPaint = null
 mLayerType = 0
 mLayoutInsets = null
 mLayoutParams = {LinearLayout$LayoutParams@9803} 
 mLeft = 64
 mLeftPaddingDefined = false
 mListenerInfo = {View$ListenerInfo@9804} 
 mLongClickX = NaN
 mLongClickY = NaN
 mMatchIdPredicate = null
 mMatchLabelForPredicate = null
 mMeasureCache = {LongSparseLongArray@9805} "{4611691655571966032=5634997092544}"
 mMeasuredHeight = 192
 mMeasuredWidth = 1312
 mMinHeight = 192
 View.mMinWidth = 352
 mNeededToChangedScrollBarPosition = false
 mNestedScrollingParent = null
 mNextClusterForwardId = -1
 mNextFocusDownId = -1
 mNextFocusForwardId = -1
 mNextFocusLeftId = -1
 mNextFocusRightId = -1
 mNextFocusUpId = -1
 mOldHeightMeasureSpec = -2147481520
 mOldWidthMeasureSpec = 1073743136
 mOutlineProvider = {ViewOutlineProvider$1@9750} 
 mOverScrollMode = 1
 mOverlay = null
 mPaddingBottom = 40
 mPaddingLeft = 48
 mPaddingRight = 48
 mPaddingTop = 40
 mParent = {LinearLayout@9751} "android.widget.LinearLayout{dab43e2 V.E...... .......D 0,0-1440,2448}"
 mPendingCheckForLongPress = null
 mPendingCheckForTap = null
 mPerformClick = null
 mPointerIcon = null
 mPointerIconForMouse = null
 mPointerIconForStylus = null
 mPrivateFlags = -2128607216
 mPrivateFlags2 = 1611867688
 mPrivateFlags3 = 537395220
 mRecreateDisplayList = false
 mRenderNode = {RenderNode@9806} 
 mRenderNodeImageFilter = null
 mRenderNodeImageFilterClipRects = {ArrayList@9807}  size = 0
 mResources = {Resources@9707} 
 mRight = 1376
 mRightPaddingDefined = false
 mRoundRadius = -1
 mRoundScrollbarRenderer = null
 mRoundedCornerBounds = {Rect@9808} "Rect(0, 0 - 0, 0)"
 mRoundedCornerMode = 0
 mRoundedCornerRadius = 0
 mRunQueue = null
 mScrollBarPositionPadding = 0
 mScrollCache = null
 mScrollIndicatorDrawable = null
 mScrollX = 0
 mScrollY = 0
 mScrollbarVerticalPadding = 0
 mSemHorizontalScrollbarRect = {Rect@9809} "Rect(0, 0 - 0, 0)"
 mSemOffsetRequesterBounds = null
 mSemOffsetRequesterExpirer = null
 mSemOffsetRequesterTrimer = null
 mSemOnAddRemoveListener = null
 mSemSFState = 0
 mSemScrollingByScrollbar = false
 mSemScrollingVertical = true
 mSemVerticalChildOffset = 0
 mSemVerticalScrollbarRect = {Rect@9810} "Rect(0, 0 - 0, 0)"
 mSemViewFlags = 0
 mSendViewScrolledAccessibilityEvent = null
 mSendingHoverAccessibilityEvents = false
 mSmartClipDataExtractionListener = null
 mSmartClipDataTag = null
 mSourceLayoutId = 2131296284
 mStartActivityRequestWho = null
 mStateListAnimator = {StateListAnimator@9811} 
 mSystemUiVisibility = 0
 mTag = null
 mTempNestedScrollConsumed = null
 mTooltipInfo = null
 mTop = 256
 mTopLeftRound = null
 mTopLeftRoundColor = 0
 mTopRightRound = null
 mTopRightRoundColor = 0
 mTouchDelegate = null
 mTouchSlop = 32
 mTransformationInfo = null
 mTransientStateCount = 0
 mTransitionName = null
 mUnscaledDrawingCache = null
 mUnsetPressedState = null
 mUserPaddingBottom = 40
 mUserPaddingEnd = -2147483648
 mUserPaddingLeft = 48
 mUserPaddingLeftInitial = 48
 mUserPaddingRight = 48
 mUserPaddingRightInitial = 48
 mUserPaddingStart = -2147483648
 mVerticalScrollFactor = 0.0
 mVerticalScrollbarPosition = 0
 mViewFlags = 402669569
 mVisibilityChangeForAutofillHandler = null
 mWindowAttachCount = 1
 shadow$_klass_ = {Class@9494} "class android.support.v7.widget.AppCompatButton"
 shadow$_monitor_ = -1961022475
mPSoCCapSenseLedService = null

Android Studio debugger crashes/stops on breakpoint, when debugging on my Huawei phone

$
0
0

After the debugger reaches the breakpoint, the app process stops and after a little time (2-3 seconds) the debugger disconnect itself. But only if i debug with my Huawei phone (EMUI 10).

These are the last 3 lines from the log:

D/: [ZeroHung]zrhung_send_event: wp = 257, ret = 0
D/:[ZeroHung]zrhung_send_event: wp = 258, ret = 0
Disconnected from the target VM, address: 'localhost:8629', transport: 'socket'

If I debug the same app with the same breakpoint on an emulator, everything works fine. The debugger stops at the breakpoint, and doesn´t disconnect itself.

NSString sizeWithAttributes Crash on iOS 12

$
0
0

I recently encountered a strange Crash when using a lyrics component. Language is Objective-C. This stupid crash has been bothering me for many days...

Here's the code:

CGFloat charWidth = [character.character sizeWithAttributes:@{NSFontAttributeName:displayFont}].width;

and my crash log stack:

0 CoreText 0x0000000234f09938 __ZNK12TSplicedFont23GetOpticalSizeComponentEd + 148
1 CoreText 0x0000000234e7ffcc __ZL28DerivedOpticalFontDescriptorPK18__CTFontDescriptorPK9TBaseFontd + 120
2 CoreText 0x0000000234e88008 __ZN12TFontCascade26InitCascadeFallbackAtIndexElRj + 252
3 CoreText 0x0000000234e87a70 __ZNK12TFontCascade14CreateFallbackEPK8__CTFontPK10__CFString13CTEmojiPolicy + 728
4 CoreText 0x0000000234e54e40 __ZN13TGlyphEncoder21AppendUnmappedCharRunEjR6TCFRefIP5CTRunEPK8__CTFontR7CFRangeS8_R10TGlyphListI18TDeletedGlyphIndexESD_RK12TFontCascadeNS_15ClusterMatchingEb + 704
5 CoreText 0x0000000234e54900 __ZN13TGlyphEncoder28RunUnicodeEncoderRecursivelyEjO6TCFRefIP5CTRunEPK8__CTFont7CFRangeR10TGlyphListI18TDeletedGlyphIndexESC_PK12TFontCascadeNS_15ClusterMatchingEb + 1900
6 CoreText 0x0000000234e54114 __ZN13TGlyphEncoder17RunUnicodeEncoderEO6TCFRefIP5CTRunEPK8__CTFont7CFRangeR10TGlyphListI18TDeletedGlyphIndexEPK12TFontCascade + 128
7 CoreText 0x0000000234e53c30 __ZN13TGlyphEncoder11EncodeCharsE7CFRangeRK11TAttributesNS_9FallbacksE + 1240
8 CoreText 0x0000000234e6acb0 __ZN21TTypesetterAttrString10InitializeEPK20__CFAttributedString + 304
9 CoreText 0x0000000234e6ab6c __ZN21TTypesetterAttrStringC2EPK20__CFAttributedStringPK14__CFDictionary + 200
10 CoreText 0x0000000234e58070 CTLineCreateWithAttributedString + 60
11 UIFoundation 0x000000023b72be2c -[NSCoreTypesetter _stringDrawingCoreTextEngineWithOriginalString:rect:padding:context:forceClipping:styledTextOptions:attributes:stringDrawingOptions:drawingContext:wantsTextLineFragments:validatedAttributedString:firstNonRenderedCharacterIndex:foundSoftHyphenAtEOL:enginePathUsed:] + 1344
12 UIFoundation 0x000000023b7aae38 ___NSStringDrawingEngine + 3104
13 UIFoundation 0x000000023b72eb04 -[NSString(NSExtendedStringDrawing) boundingRectWithSize:options:attributes:context:] + 160
14 UIFoundation 0x000000023b7307dc -[NSString(NSStringDrawing) sizeWithAttributes:] + 120

How can I used link to webSite for android [closed]

$
0
0

my app crash for link to web

Im used

   txtLink.setText(Html.fromHtml("<ahref=\"http://www.google.com\">Google</a>"));
    txtLink.setMovementMethod(LinkMovementMethod.getInstance());

but this not working

IMAGE :

IMAGE1

Why does finite recursive behaviour cause a crash ? (free(): invalid pointer)

$
0
0

Below is my code just a function called kk that will be recursively called for 10 times so impossible to cause stack overflow, but it crashes with

Error in `./3': free(): invalid pointer: 0x0000000000602100

Who knows the reason??

string kk(string &s)
{
    static  int i=0;
    s+="q";
    i++;
    cout<<"i="<<i<<endl;
    if(i>=10) return s;
    kk(s);
}

int main()
{
    string s="wer";

    cout<<"s="<<kk(s)<<endl;
}

EXC_BAD_INSTRUCTION (SIGILL) crash - cocoa swift

$
0
0

I manage on temporary list in my app to avoid EXC_BAD_ACCESS (SIGSEGV) issue with outline view on OS versions below 10.12. I have explained why I need to do so in another question. So whenever I need to remove items from temporary list I do so with below code.

func freeupUnUsedListItems() {
    concurrentListQueue.async(flags: .barrier) { [weak self] in
        DispatchQueue.main.async {
            self?.tempItems.removeAll { (item) -> Bool in
                return self?.outlineView.row(forItem: item) == -1
            }
        }
    }
}

Now the problem is I got EXC_BAD_INSTRUCTION (SIGILL) crash with the above code. I think using main queue inside my private queue lead to this problem. But I don't know how to access the outline view other than main queue. Is there any other way to do this? I want to remove the items only when row for item returns -1 (which means the item is not used by NSOutlineView any more). Working on this issue for more than a week. Any suggestions would really help me.

Crash log for reference:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.test.app    0x0000000109c2374b closure #1 in closure #1 in ListViewController.freeupUnUsedListItems() (in App) (<compiler-generated>:0)
1   com.test.app    0x0000000109c34dbc partial apply for closure #1 in closure #1 in ListViewController.freeupUnUsedListItems() (in App) (<compiler-generated>:0)
2   com.test.app    0x0000000109c01090 thunk for @escaping @callee_guaranteed () -> () (in App) (<compiler-generated>:0)
3   libdispatch.dylib               0x00007fff85332700 _dispatch_call_block_and_release + 12
4   libdispatch.dylib               0x00007fff8532ee73 _dispatch_client_callout + 8
5   libdispatch.dylib               0x00007fff8533f767 _dispatch_main_queue_callback_4CF + 861
6   com.apple.CoreFoundation        0x00007fff85a51319 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
7   com.apple.CoreFoundation        0x00007fff85a0c4af __CFRunLoopRun + 2159
8   com.apple.CoreFoundation        0x00007fff85a0b9f8 CFRunLoopRunSpecific + 296
9   com.apple.HIToolbox             0x00007fff8d78f56f RunCurrentEventLoopInMode + 235
10  com.apple.HIToolbox             0x00007fff8d78f2ea ReceiveNextEventCommon + 431
11  com.apple.HIToolbox             0x00007fff8d78f12b _BlockUntilNextEventMatchingListInModeWithFilter + 71
12  com.apple.AppKit                0x00007fff8ee258ab _DPSNextEvent + 978
13  com.apple.AppKit                0x00007fff8ee24e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
14  com.apple.AppKit                0x00007fff8ee1aaf3 -[NSApplication run] + 594
15  com.apple.AppKit                0x00007fff8ed97244 NSApplicationMain + 1832
16  com.prosoftnet.remotepcSuite    0x0000000109afd3d9 main (in App) (AppDelegate.swift:12)
17  libdyld.dylib                   0x00007fff893845c9 start + 1

Process with protobuf ParseFromString crash

$
0
0

On production machine only I have a crash in a process. I was able to isolate this to a ParseFromString call. When ParseFromString isn't called the process doesn't crash. When called, process will crash eventually: not in ParseFromString but after several stack exits on the same thread (so I have pinpointed the exact crash location, where nothing interesting actually happens) so this probably seems to be a bad memory allocation problem. This does not reproduce in the lab nor on the production machine using WinDbg. Input to ParseFromString as seen in the pretty-print dump (clear text, not the actual binary input to the method) seems normal with no special characters or redundant spaces. The binary in the input std::string of-course has special characters.

I would like to have suggestions on how to continue investigating this

Thank you


Native Crash and how to solve it

$
0
0

I am testing my android application on firebase test lab and for some mobile devices I am getting Native Crash. I am not getting any idea what is the reason for Native Crash and why it occurs.

Here is the report of the firebase test issue

Native crash of com.example.myapp

 A native crash was detected.

 *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
 Build fingerprint: 'generic/gce_x86_phone/gce_x86:5.0.2/LRX22L.LXG52/3751174:userdebug/test-keys'
 Revision: '0'
 ABI: 'x86'
 pid: 6799, tid: 6932, name: RenderThread  >>> com.example.myappi <<<
 signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------

Getting this crash on crashlytics. Don’t understand what it means

$
0
0

Admob version: 4.2.0 Unity version: 18.4.8 Firebase version :6.7

Getting this crash in lots of devices

1073.75 MB of file backed memory dirtied over 186 seconds (5770.75 KB per second average), exceeding limit of 12.43 KB per second over 86400 seconds

$
0
0

iOS crash

Look the crash stack, is it the icloud backup get something error? I don't know what is this error.

Help, thanks.

1073.75 MB of file backed memory dirtied over 186 seconds (5770.75 KB per second average), exceeding limit of 12.43 KB per second over 86400 seconds
Command:          HelloTalk_Binary
Path:             
Identifier:       
Version:          3.6.4 (6)
Beta Identifier:  5D4C1274-7310-4015-9227-B2190563BAE3
PID:              623

Event:            disk writes
Action taken:     none
Writes:           1073.75 MB of file backed memory dirtied over 186 seconds (5770.75 KB per second average), exceeding limit of 12.43 KB per second over 86400 seconds
Writes limit:     1073.74 MB
Limit duration:   86400s
Writes caused:    1073.75 MB
Writes duration:  186s
Duration:         186.07s
Duration Sampled: 45.98s
Steps:            60 ( (10.49 MB/step))

Hardware model:   iPhone10,3
Active cpus:      6


Heaviest stack for the target process:
  60  ??? (libsystem_pthread.dylib + 48008) [0x18271eb88]
  60  ??? (libdispatch.dylib + 275516) [0x1826b643c]
  60  ??? (libdispatch.dylib + 237864) [0x1826ad128]
  60  ??? (libdispatch.dylib + 235280) [0x1826ac710]
  60  ??? (libdispatch.dylib + 377220) [0x1826cf184]
  60  ??? (libdispatch.dylib + 374288) [0x1826ce610]
  57  ??? (HelloTalk_Binary + 23667476) [0x105792314]
  23  ??? (HelloTalk_Binary + 23665404) [0x105791afc]
  23  ??? (HelloTalk_Binary + 32163208) [0x105fac588]
  23  ??? (<7F66DDA9-9EB4-3CA9-94BF-2E87E9B8B20C> + 47812) [0x108cffac4]
  23  ??? (<7F66DDA9-9EB4-3CA9-94BF-2E87E9B8B20C> + 48280) [0x108cffc98]
  23  ??? (libsystem_c.dylib + 245252) [0x182631e04]
  20  ??? (libsystem_c.dylib + 244268) [0x182631a2c]
  20  ??? (libsystem_c.dylib + 5588) [0x1825f75d4]
  20  ??? (libsystem_kernel.dylib + 154316) [0x1827faacc]


Powerstats for:   [623]
Bundle ID:        
Adam ID:          0
Is first party:   No
App version:      3.6.4
Build version:    6
Is Beta:          No
Share with Devs:  Yes
UUID:             8A9B6AAB-F4F1-3ADA-9CDF-0C0D23A46AF1
Path:             
Architecture:     arm64
Footprint:        217.66 MB -> 171.48 MB (-46.17 MB) (max 362.86 MB )
Pageins:          399 pages
Start time:       2019-11-28 08:58:06 +0800
End time:         2019-11-28 08:58:52 +0800
Num samples:      60 (100%)
CPU Time:         13.931s
Primary state:    59 samples Frontmost App, Non-Suppressed, Kernel mode, Effective Thread QoS User Initiated, Requested Thread QoS User Initiated, Override Thread QoS Unspecified
User Activity:    0 samples Idle, 60 samples Active
Power Source:     60 samples on Battery, 0 samples on AC
  60  ??? (libsystem_pthread.dylib + 48008) [0x18271eb88]
    60  ??? (libdispatch.dylib + 275516) [0x1826b643c]
      60  ??? (libdispatch.dylib + 237864) [0x1826ad128]
        60  ??? (libdispatch.dylib + 235280) [0x1826ac710]
          60  ??? (libdispatch.dylib + 377220) [0x1826cf184]
            60  ??? (libdispatch.dylib + 374288) [0x1826ce610]
              57  __31-[HTBackupToIcloudModel backup]_block_invoke (HTBackupToIcloudModel.m:358 in HelloTalk_Binary + 23667476) [0x105792314]
                23  -[HTBackupToIcloudModel createBackupFile] (HTBackupToIcloudModel.m:271 in HelloTalk_Binary + 23665404) [0x105791afc]
                  23  -[ZipWriteStream writeData:] (ZipWriteStream.m:53 in HelloTalk_Binary + 32163208) [0x105fac588]
                    23  zipWriteInFileInZip (zip.c:1464 in SSZipArchive + 47812) [0x108cffac4]
                      23  zip64FlushWriteBuffer (zip.c:1381 in SSZipArchive + 48280) [0x108cffc98]
                        23  ??? (libsystem_c.dylib + 245252) [0x182631e04]
                          20  ??? (libsystem_c.dylib + 244268) [0x182631a2c]
                            20  ??? (libsystem_c.dylib + 5588) [0x1825f75d4]
                              20  ??? (libsystem_kernel.dylib + 154316) [0x1827faacc]
                          3   ??? (libsystem_c.dylib + 244316) [0x182631a5c]
                            3   ??? (libsystem_c.dylib + 235260) [0x18262f6fc]
                              3   ??? (libsystem_c.dylib + 5588) [0x1825f75d4]
                                3   ??? (libsystem_kernel.dylib + 154316) [0x1827faacc]
                20  -[HTBackupToIcloudModel createBackupFile] (HTBackupToIcloudModel.m:272 in HelloTalk_Binary + 23665416) [0x105791b08]
                  20  -[ZipWriteStream finishedWriting] (ZipWriteStream.m:61 in HelloTalk_Binary + 32163424) [0x105fac660]
                    18  zipCloseFileInZipRaw64 (zip.c:1589 in SSZipArchive + 48540) [0x108cffd9c]
                      18  zip64FlushWriteBuffer (zip.c:1381 in SSZipArchive + 48280) [0x108cffc98]
                        18  ??? (libsystem_c.dylib + 245252) [0x182631e04]
                          18  ??? (libsystem_c.dylib + 244268) [0x182631a2c]
                            18  ??? (libsystem_c.dylib + 5588) [0x1825f75d4]
                              18  ??? (libsystem_kernel.dylib + 154316) [0x1827faacc]
                    2   zipCloseFileInZipRaw64 (zip.c:1718 in SSZipArchive + 49524) [0x108d00174]
                      2   ??? (libsystem_c.dylib + 5144) [0x1825f7418]
                        2   ??? (libsystem_c.dylib + 243516) [0x18263173c]
                          2   ??? (libsystem_c.dylib + 235260) [0x18262f6fc]
                            2   ??? (libsystem_c.dylib + 5588) [0x1825f75d4]
                              2   ??? (libsystem_kernel.dylib + 154316) [0x1827faacc]
                13  -[HTBackupToIcloudModel createBackupFile] (HTBackupToIcloudModel.m:252 in HelloTalk_Binary + 23664864) [0x1057918e0]
                  13  -[ZipWriteStream writeData:] (ZipWriteStream.m:53 in HelloTalk_Binary + 32163208) [0x105fac588]
                    13  zipWriteInFileInZip (zip.c:1464 in SSZipArchive + 47812) [0x108cffac4]
                      13  zip64FlushWriteBuffer (zip.c:1381 in SSZipArchive + 48280) [0x108cffc98]
                        13  ??? (libsystem_c.dylib + 245252) [0x182631e04]
                          13  ??? (libsystem_c.dylib + 244268) [0x182631a2c]
                            13  ??? (libsystem_c.dylib + 5588) [0x1825f75d4]
                              13  ??? (libsystem_kernel.dylib + 154316) [0x1827faacc]
                1   -[HTBackupToIcloudModel createBackupFile] (HTBackupToIcloudModel.m:253 in HelloTalk_Binary + 23664876) [0x1057918ec]
                  1   -[ZipWriteStream finishedWriting] (ZipWriteStream.m:61 in HelloTalk_Binary + 32163424) [0x105fac660]
                    1   zipCloseFileInZipRaw64 (zip.c:1589 in SSZipArchive + 48540) [0x108cffd9c]
                      1   zip64FlushWriteBuffer (zip.c:1381 in SSZipArchive + 48280) [0x108cffc98]
                        1   ??? (libsystem_c.dylib + 245252) [0x182631e04]
                          1   ??? (libsystem_c.dylib + 244268) [0x182631a2c]
                            1   ??? (libsystem_c.dylib + 5588) [0x1825f75d4]
                              1   ??? (libsystem_kernel.dylib + 154316) [0x1827faacc]
              2   __25-[HTCache synchronizeNow]_block_invoke (HTCache.m:555 in HelloTalk_Binary + 28087512) [0x105bc94d8]
                2   ??? (Foundation + 424364) [0x182d1a9ac]
                  2   ??? (Foundation + 1163316) [0x182dcf034]
                    2   ??? (Foundation + 297596) [0x182cfba7c]
                      2   ??? (Foundation + 1164516) [0x182dcf4e4]
                        2   ??? (libsystem_kernel.dylib + 162716) [0x1827fcb9c]
                          1   <Effective Thread QoS User Interactive>
              1   __53-[SensorsAnalyticsSDK track:withProperties:withType:]_block_invoke (SensorsAnalyticsSDK.m:1668 in SensorsAnalyticsSDK + 194464) [0x108d477a0]
                1   -[SensorsAnalyticsSDK enqueueWithType:andEvent:] (SensorsAnalyticsSDK.m:1404 in SensorsAnalyticsSDK + 187712) [0x108d45d40]
                  1   -[MessageQueueBySqlite addObejct:withType:] (MessageQueueBySqlite.m:115 in SensorsAnalyticsSDK + 31508) [0x108d1fb14]
                    1   ??? (libsqlite3.dylib + 269148) [0x18465ab5c]
                      1   ??? (libsqlite3.dylib + 313648) [0x184665930]
                        1   ??? (libsqlite3.dylib + 440088) [0x184684718]
                          1   ??? (libsqlite3.dylib + 437700) [0x184683dc4]
                            1   ??? (libsqlite3.dylib + 427668) [0x184681694]
                              1   ??? (libsqlite3.dylib + 483304) [0x18468efe8]
                                1   ??? (libsystem_kernel.dylib + 157916) [0x1827fb8dc]


- (BOOL)createBackupFile {
    @autoreleasepool {
        NSFileManager *fileManager = NSFileManager.new;

        // 创建缓存路径
        NSString *tmpICloudPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"iCloud"];
        if ([fileManager fileExistsAtPath:tmpICloudPath isDirectory:NULL]) {
            [[NSFileManager defaultManager] removeItemAtPath:tmpICloudPath error:NULL];
        }
        [fileManager createDirectoryAtPath:tmpICloudPath withIntermediateDirectories:YES attributes:NULL error:NULL];

        NSString *zipFilePath = [tmpICloudPath stringByAppendingPathComponent:@"Backup.zip"];
        if ([fileManager fileExistsAtPath:zipFilePath]) {
            [fileManager removeItemAtPath:zipFilePath error:NULL];
        }

        ZipFile *zipFile= [[ZipFile alloc] initWithFileName:zipFilePath mode:ZipFileModeCreate];

        // 开始压缩
        NSInteger totalFileCounts = 0;

        // 压缩数据库
        NSString *dbBackupPath = nil;
        NSArray *dbSubpaths = nil;
        @autoreleasepool {
            dbBackupPath = [HTPath localBackupPathWithUserId:[[HTCache sharedCache] stringForKey:HT_UserId]];
            dbSubpaths = [fileManager subpathsAtPath:dbBackupPath];
            totalFileCounts += dbSubpaths.count;
        }

        // 压缩语音
        NSString *audioPath = nil;
        NSArray *audioSubpaths = nil;
        @autoreleasepool {
            audioPath = [HTPath localAudioPathWithUserId:[[HTCache sharedCache] stringForKey:HT_UserId]];
            audioSubpaths = [fileManager subpathsAtPath:audioPath];
            totalFileCounts += audioSubpaths.count;
        }

        // 压缩图片
        NSString *imagesPath = nil;
        NSMutableArray *imageSubpaths = nil;
        @autoreleasepool {
            imagesPath = [HTPath localImagePathWithUserId:[[HTCache sharedCache] stringForKey:HT_UserId]];
            NSArray *tempImagesSubPath = [fileManager subpathsAtPath:imagesPath];
            imageSubpaths = [NSMutableArray array];
            for (NSString *path in tempImagesSubPath) {
                if ([path hasSuffix:@"_thum.jpg"]) {
                    [imageSubpaths addObject:path];
                }
            }

            totalFileCounts += imageSubpaths.count;
        }

        // 压缩视频缩略图,不压缩视频文件
        NSString *videosPath = nil;
        NSMutableArray *videoSubpaths = nil;
        @autoreleasepool {
            videosPath = [HTPath localVideoPathWithUserId:[[HTCache sharedCache] stringForKey:HT_UserId]];
            NSArray *tempVideoSubpaths = [fileManager subpathsAtPath:videosPath];
            videoSubpaths = [NSMutableArray array];
            for (NSString *path in tempVideoSubpaths) {
                if([path hasSuffix:@"_thum.jpg"]) {
                    [videoSubpaths addObject:path];
                }
            }

            totalFileCounts += videoSubpaths.count;
        }

        float onePercent = 1 / (float)totalFileCounts;
        float tempTotalPercent = self.conpressProgress / 100.0f;

        NSLog(@"iCloud total files: %@", @(totalFileCounts).stringValue);

        BOOL isDir = YES;
        for(NSString *path in dbSubpaths){
            @autoreleasepool {
                NSString *fullPath = [dbBackupPath stringByAppendingPathComponent:path];
                if([fileManager fileExistsAtPath:fullPath isDirectory:&isDir] && !isDir){
                    ZipWriteStream *stream= [zipFile writeFileInZipWithName:[NSString stringWithFormat:@"Backup/Backup/%@", path] compressionLevel:ZipCompressionLevelFastest];
                    NSData *data = [[NSData alloc] initWithContentsOfFile:fullPath options:NSDataReadingUncached error:NULL];
                    [stream writeData:data];
                    [stream finishedWriting];
                }
            }

            tempTotalPercent += onePercent;
            int conpressProgress = tempTotalPercent * 100;
            if (conpressProgress != self.conpressProgress) {
                self.conpressProgress = conpressProgress;
            }
        }


        for(NSString *path in audioSubpaths){
            @autoreleasepool {
                NSString *fullPath = [audioPath stringByAppendingPathComponent:path];
                if([fileManager fileExistsAtPath:fullPath isDirectory:&isDir] && !isDir){
                    ZipWriteStream *stream= [zipFile writeFileInZipWithName:[NSString stringWithFormat:@"Backup/audios/%@", path] compressionLevel:ZipCompressionLevelNone];
                    NSData *data = [[NSData alloc] initWithContentsOfFile:fullPath options:NSDataReadingUncached error:NULL];
                    [stream writeData:data];
                    [stream finishedWriting];
                }
            }

            tempTotalPercent += onePercent;
            int conpressProgress = tempTotalPercent * 100;
            if (conpressProgress != self.conpressProgress) {
                self.conpressProgress = conpressProgress;
            }
        }


        for(NSString *path in imageSubpaths){
            @autoreleasepool {
                NSString *fullPath = [imagesPath stringByAppendingPathComponent:path];
                if([fileManager fileExistsAtPath:fullPath isDirectory:&isDir] && !isDir){
                    ZipWriteStream *stream= [zipFile writeFileInZipWithName:[NSString stringWithFormat:@"Backup/images/%@", path] compressionLevel:ZipCompressionLevelNone];
                    NSData *data = [[NSData alloc] initWithContentsOfFile:fullPath options:NSDataReadingUncached error:NULL];
                    [stream writeData:data];
                    [stream finishedWriting];
                }
            }

            tempTotalPercent += onePercent;
            int conpressProgress = tempTotalPercent * 100;
            if (conpressProgress != self.conpressProgress) {
                self.conpressProgress = conpressProgress;
            }
        }


        for(NSString *path in videoSubpaths){
            @autoreleasepool {
                NSString *fullPath = [videosPath stringByAppendingPathComponent:path];
                if([fileManager fileExistsAtPath:fullPath isDirectory:&isDir] && !isDir){
                    ZipWriteStream *stream= [zipFile writeFileInZipWithName:[NSString stringWithFormat:@"Backup/videos/%@", path] compressionLevel:ZipCompressionLevelFastest];
                    NSData *data = [[NSData alloc] initWithContentsOfFile:fullPath options:NSDataReadingUncached error:NULL];
                    [stream writeData:data];
                    [stream finishedWriting];
                }
            }

            tempTotalPercent += onePercent;
            int conpressProgress = tempTotalPercent * 100;
            if (conpressProgress != self.conpressProgress) {
                self.conpressProgress = conpressProgress;
            }
        }

        [zipFile close];
        [zipFile release];

        NSLog(@"conpress end");

        NSDictionary *attributes = [fileManager attributesOfItemAtPath:zipFilePath error:NULL];
        self.backupSize = [attributes doubleForKey:NSFileSize] / (1024.0f * 1024.0f);

        return YES;
    }

}

E/SQLiteLog: (1) no such table: Cars on Android 9 Pie

$
0
0

I already spent a lot of hours to find the reason, why the coping of database does not work for Android 9? My implementation is based on this example (video). Everything works fine on Android versions from 4.1 up to 10, but NOT on 9 Pie. here what I did:

fun importToApp(fileNameOnSD: String) {
        val sd = File(sdFolder)
        if (sd.canWrite()) {
            val currentDB = File(Environment.getDataDirectory(), dataTemp)
            val backupDB = File(sd, fileNameOnSD)
            if (currentDB.exists()) {
                try {
                    val src = FileInputStream(backupDB).channel
                    val dst = FileOutputStream(currentDB).channel
                    dst.transferFrom(src, 0, src.size())
                    src.close()
                    dst.close()
                } catch (e: FileNotFoundException) {
                    e.printStackTrace()
                } catch (e: IOException) {
                    e.printStackTrace()
                }
            }
        }
        copyData()
    }

    private fun copyData() {
        db.delete(TABLE, null, null)
        val dbBackup = context.openOrCreateDatabase(DB_TEMP, Context.MODE_PRIVATE, null)
        val cursor = dbBackup.query(true, TABLE, null, null, null, null, null, null, null)

        cursor.moveToFirst()
        while (!cursor.isAfterLast) {
            db.insert(TABLE, null, modelToValues(cursorToModel(cursor)))
            cursor.moveToNext()
        }
        cursor.close()
        context.deleteDatabase(dataTemp)
        utilities.toast(context.resources.getString(R.string.db_suc_imported), 0)
    } 

I also call the method (as proposed here):

override fun onOpen(db: SQLiteDatabase) {
        super.onOpen(db)
        if (Build.VERSION.SDK_INT == 28)
            db.disableWriteAheadLogging()
    }

Here is the crash caused in Android Pie:

E/SQLiteLog: (1) no such table: Cars 
D/AndroidRuntime: Shutting down VM


    --------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.easyapps.cryptnote, PID: 3174
    android.database.sqlite.SQLiteException: no such table: Cars (code 1 SQLITE_ERROR): , while compiling: SELECT DISTINCT * FROM Cars 
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:903)
        at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:514)
        at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
        at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
        at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
        at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
        at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1408)
        at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1255)
        at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1126)
        at com.easyapps.cryptnote.ListDatabase.copyData(CarsDatabase.kt:144)
        at com.easyapps.cryptnote.ListDatabase.importToApp(CarsDatabase.kt:137)
        at com.easyapps.cryptnote.ImportActivity$importDB$$inlined$apply$lambda$1.onClick(CarsActivity.kt:273)
        at android.view.View.performClick(View.java:6597)
        at android.view.View.performClickInternal(View.java:6574)
        at android.view.View.access$3100(View.java:778)
        at android.view.View$PerformClick.run(View.java:25885)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/Process: Sending signal. PID: 3174 SIG: 9

This line val cursor = dbBackup.query(true, TABLE, null, null, null, null, null, null, null) crashes the app. So far I tested in on two different real Android devices, one with Android Lollipop (Moto) and one with Android Pie (Samsung A40). The other versions were virtual. The most interesting thing is that it works on Samsung with Android Pie, but not on a virtual device with Android Pie. Nevertheless, I assume that is the Samsung device is exception, I need to get run on all Android devices, no matter real or virtual.

So, please help me to fix it, for more info please let me know in comments. I need to fix it asap. Many many thanks in advance.

Why am I getting "Attempt to invoke interface method 'int android.database.Cursor.getCount()' on a null object reference"?

$
0
0

So I am getting Attempt to invoke interface method 'int android.database.Cursor.getCount()' on a null object reference when trying to get into my MovieDetailActivity to see MovieDetails with a Favourite Button. Based on the state of the movie (if it's favourited or not) the button should change its text accordingly to add or remove the movie to the favourites list. But all I am getting is a crash when trying to entering the screen.

screenshot from the Logs

Here is my isMovieFavourited method:

public boolean isMovieFavourited(String id){
    mSelectionClause = FavouritesContract.FavouritesAdd.COLUMN_MOVIE_ID + " = ?";
    mSelectionArgs[0] = id;
    Cursor mCursor = getContentResolver().query(
            FavouritesContract.FavouritesAdd.CONTENT_URI,
            mProjection,
            mSelectionClause,
            mSelectionArgs,
            null);

    if(mCursor.getCount() <= 0){
        mCursor.close();
        mFavourites.setText(getString(R.string.add_to_favourites));
        return false;
    }
    mCursor.close();
    mFavourites.setText(getString(R.string.remove_from_favourites));
    return true;
}

Here is my FavouritesContract class:

public class FavouritesContract {
public static final String AUTHORITY = "com.riceplant.popularmovies";
public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + AUTHORITY);
public static final String PATH_FAVOURITES = "favourites";

public static final class FavouritesAdd implements BaseColumns {
    public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
            .appendPath(PATH_FAVOURITES)
            .build();

    public static final String TABLE_NAME = "favorites";

    public static final String COLUMN_MOVIE_ID = "movieId";
    public static final String COLUMN_MOVIE_NAME = "movieName";
    public static final String COLUMN_MOVIE_POSTER = "moviePoster";
    public static final String COLUMN_MOVIE_RATE = "movieRate";
    public static final String COLUMN_MOVIE_RELEASE = "movieRelease";
    public static final String COLUMN_MOVIE_OVERVIEW = "movieOverview";
}

}

EDIT: Here is my Content Provider class:

public class FavouritesContentProvide extends ContentProvider{

    public static final int FAVOURITES = 700;
    public static final int FAVOURITES_WITH_ID = 701;
    private static final UriMatcher sUriMatcher = buildUriMatcher();

    private static UriMatcher buildUriMatcher() {
        UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
        uriMatcher.addURI(FavouritesContract.AUTHORITY, FavouritesContract.PATH_FAVOURITES, FAVOURITES);
        uriMatcher.addURI(FavouritesContract.AUTHORITY, FavouritesContract.PATH_FAVOURITES + "/#", FAVOURITES_WITH_ID);
        return uriMatcher;
    }

    private FavouritesDbHelper mFavouritesDbHelper;

    @Override
    public boolean onCreate() {
        Context context = getContext();
        mFavouritesDbHelper = new FavouritesDbHelper(context);
        return true;
    }

    @Nullable
    @Override
    public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
        final SQLiteDatabase db = mFavouritesDbHelper.getReadableDatabase();
        int match = sUriMatcher.match(uri);
        Cursor returnCursor;

        switch (match){
            case FAVOURITES:
                returnCursor = db.query(TABLE_NAME,
                        projection,
                        selection,
                        selectionArgs,
                        null,
                        null,
                        sortOrder);
                break;

            case FAVOURITES_WITH_ID:
                String id = uri.getPathSegments().get(1);
                String mSelection = "_id=?";
                String[] mSelectionArgs = new String[]{id};

                returnCursor = db.query(TABLE_NAME,
                        projection,
                        mSelection,
                        mSelectionArgs,
                        null,
                        null,
                        sortOrder);
                break;

            default:
                throw new UnsupportedOperationException("Unknown uri: "+ uri);
        }
        returnCursor.setNotificationUri(getContext().getContentResolver(), uri);
        return returnCursor;
    }

    @Nullable
    @Override
    public String getType(@NonNull Uri uri) {
        int match = sUriMatcher.match(uri);

        switch (match){
            case FAVOURITES:
                return "vnd.android.cursor.dir" + "/" + FavouritesContract.AUTHORITY + "/" + FavouritesContract.PATH_FAVOURITES;
            case FAVOURITES_WITH_ID:
                return "vnd.android.cursor.item" + "/" + FavouritesContract.AUTHORITY + "/" + FavouritesContract.PATH_FAVOURITES;
            default:
                throw new UnsupportedOperationException("Unknown uri: " + uri);
        }
    }

    @Nullable
    @Override
    public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
        final SQLiteDatabase db = mFavouritesDbHelper.getWritableDatabase();
        int match = sUriMatcher.match(uri);
        Uri returnUri; //Uri to be returned

        switch (match){
            case FAVOURITES:
                long id = db.insert(TABLE_NAME, null, values);
                if (id > 0 ){
                    returnUri = ContentUris.withAppendedId(FavouritesContract.FavouritesAdd.CONTENT_URI, id);
                } else {
                    throw new android.database.SQLException("Failed to insert row into" + uri);
                }
                break;
            default:
                throw new UnsupportedOperationException("Unknow uri: " +uri);
        }
        getContext().getContentResolver().notifyChange(uri, null);
        return returnUri;
    }

    @Override
    public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
        final SQLiteDatabase db = mFavouritesDbHelper.getWritableDatabase();
        int match = sUriMatcher.match(uri);
        int favoritesDeleted;

        switch (match) {
            case FAVOURITES:
                favoritesDeleted = db.delete(TABLE_NAME, selection, selectionArgs);
                break;
            default:
                throw new UnsupportedOperationException("Unknown uri: " + uri);
        }

        if (favoritesDeleted != 0){
            getContext().getContentResolver().notifyChange(uri,null);
        }
        return favoritesDeleted;
    }

    @Override
    public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {
        int favoriteUpdated;
        int match = sUriMatcher.match(uri);

        switch (match){
            case FAVOURITES_WITH_ID:
                String id = uri.getPathSegments().get(1);
                favoriteUpdated = mFavouritesDbHelper.getWritableDatabase()
                        .update(TABLE_NAME, values, "_id=?", new String[]{id});
                break;
            default:
                throw new UnsupportedOperationException("Unknown uri: " + uri);
        }

        if (favoriteUpdated != 0){
            getContext().getContentResolver().notifyChange(uri, null);
        }
        return favoriteUpdated;
    }

}

Here is the Dbhelper class:

public class FavouritesDbHelper extends SQLiteOpenHelper {

private static final String DATABASE_NAME = "favourites.db";
private static final int DATABASE_VERSION = 3;

public FavouritesDbHelper(Context context) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
    final String SQL_CREATE_FAVOURITES_TABLE = "CREATE TABLE " +
            FavouritesAdd.TABLE_NAME + " (" +
            FavouritesAdd._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
            FavouritesAdd.COLUMN_MOVIE_ID + " INTEGER NOT NULL," +
            FavouritesAdd.COLUMN_MOVIE_NAME + " TEXT NOT NULL," +
            FavouritesAdd.COLUMN_MOVIE_POSTER + " TEXT NOT NULL," +
            FavouritesAdd.COLUMN_MOVIE_RATE + " TEXT NOT NULL," +
            FavouritesAdd.COLUMN_MOVIE_RELEASE + " TEXT NOT NULL," +
            FavouritesAdd.COLUMN_MOVIE_OVERVIEW + " TEXT NOT NULL" +
            "); ";
    sqLiteDatabase.execSQL(SQL_CREATE_FAVOURITES_TABLE);
}

@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
    sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + FavouritesAdd.TABLE_NAME);
    onCreate(sqLiteDatabase);
}

}

I am pretty new to this, so please don't hesitate to ask if you need more code samples or anything else.

Thanks in advance!

Heroku portfolio suddenly crashing

$
0
0

I tried to view my app and on getting an application error. When I run heroku logs --tail it starts by warning me saying there's an update to 7.39. How do I do that? Could that be the cause of my app crashing? There's no error code.

Why was the data on my bot reset, seemingly at random, without any updates or notifications of such?

$
0
0

I am hosting a clone of a plant discord bot on Heroku, created by Felix Rilling. "Lisa-Bot" This was done in order to avoid the calamities than can occur to the bot, since it's status is global and users in other servers are not as nice as those in mine.

However, my efforts have been for naught, since the bot crashed, (or something, I'm a relative amateur) and everything was reset, including it's "max lifespan."

Why did this happen and what can I do to fix it?


Receiving Crashes on Play console : tgkill

$
0
0

I'm seeing this crash with the following stack trace.

This happens in Android 7.0 only. Nothing new has been added to the app, just upgraded to androidx, which has been in production for a few months, but with more devices being updated to Nougat this crash happens frequently now and is becoming a nuisance.

Any help, advice or Suggestion would be appreciated.

backtrace:
  #00  pc 000000000004b024  /system/lib/libc.so (tgkill+12)
  #01  pc 00000000000487c3  /system/lib/libc.so (pthread_kill+34)
  #02  pc 000000000001d775  /system/lib/libc.so (raise+10)
  #03  pc 00000000000192b1  /system/lib/libc.so (__libc_android_abort+34)
  #04  pc 0000000000017024  /system/lib/libc.so (abort+4)
  #05  pc 0000000000319775  /system/lib/libart.so (art::Runtime::Abort()+252)
  #06  pc 00000000000b4cb9  /system/lib/libart.so (art::LogMessage::~LogMessage()+864)
  #07  pc 00000000001bb027  /system/lib/libart.so (art::IndirectReferenceTable::Add(unsigned int, art::mirror::Object*)+194)
  #08  pc 000000000026fa95  /system/lib/libart.so (art::JNI::GetObjectField(_JNIEnv*, _jobject*, _jfieldID*)+452)
  #09  pc 000000000008e593  /system/lib/libandroid_runtime.so
  #10  pc 000000000008e7d7  /system/lib/libandroid_runtime.so (android::NotifyHandler::handleMessage(android::Message const&)+38)
  #11  pc 0000000000011f5d  /system/lib/libutils.so (android::Looper::pollInner(int)+492)
  #12  pc 0000000000011ce3  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+26)
  #13  pc 0000000000093109  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, _jobject*, int)+22)
  #14  pc 0000000001d0ee45  /system/framework/arm/boot-framework.oat (offset 0x16c5000) (android.os.MessageQueue.nativePollOnce+96)
  #15  pc 0000000001d109b1  /system/framework/arm/boot-framework.oat (offset 0x16c5000) (android.os.MessageQueue.next+188)
  #16  pc 0000000001d0b3bf  /system/framework/arm/boot-framework.oat (offset 0x16c5000) (android.os.Looper.loop+578)
  #17  pc 000000000174dc4d  /system/framework/arm/boot-framework.oat (offset 0x16c5000) (android.app.ActivityThread.main+752)
  #18  pc 00000000000a94c1  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
  #19  pc 0000000000403f41  /system/lib/libart.so (art_quick_invoke_static_stub+228)
  #20  pc 00000000000b07bf  /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+178)
  #21  pc 0000000000314799  /system/lib/libart.so (art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ArgArray*, art::JValue*, char const*)+56)
  #22  pc 0000000000315b2b  /system/lib/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned int)+766)
  #23  pc 00000000002bd329  /system/lib/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobject*)+40)
  #24  pc 0000000000603cb9  /system/framework/arm/boot.oat (offset 0x56d000) (java.lang.reflect.Method.invoke+116)
  #25  pc 000000000223d981  /system/framework/arm/boot-framework.oat (offset 0x16c5000) (com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run+100)
  #26  pc 000000000223edd9  /system/framework/arm/boot-framework.oat (offset 0x16c5000) (com.android.internal.os.ZygoteInit.main+1980)
  #27  pc 00000000000a94c1  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
  #28  pc 0000000000403f41  /system/lib/libart.so (art_quick_invoke_static_stub+228)
  #29  pc 00000000000b07bf  /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+178)
  #30  pc 0000000000314799  /system/lib/libart.so (art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ArgArray*, art::JValue*, char const*)+56)
  #31  pc 00000000003145ab  /system/lib/libart.so (art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+266)
  #32  pc 0000000000277a83  /system/lib/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+426)
  #33  pc 00000000000676d1  /system/lib/libandroid_runtime.so
  #34  pc 0000000000068fb7  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+498)
  #35  pc 0000000000001947  /system/bin/app_process32
  #36  pc 0000000000016c3d  /system/lib/libc.so (__libc_init+48)
  #37  pc 0000000000001564  /system/bin/app_process32

App crashed due to EXC_BREAKPOINT (SIGTRAP)

$
0
0

one of the tester of my app have reported this crash. I just can't seem to understand what is causing this crash. here is the crash log:

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001027f6bf0
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [1054]
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   App Names           0x00000001027f6bf0 UpcomingViewController.networkCall1() + 4420 (UpcomingViewController.swift:240)
1   App Names           0x00000001027f88ec @objc UpcomingViewController.networkCall1() + 28 (<compiler-generated>:0)
2   CoreFoundation                  0x00000001913e2360 __CFFireTimer + 64 (CFObject.m:1573)
3   CoreFoundation                  0x0000000191366dcc -[__NSCFTimer fire] + 88 (CFObject.m:1604)
4   App Names           0x00000001027f5a9c @objc UpcomingViewController.scheduledTimerWithTimeInterval1() + 28 (<compiler-generated>:0)
5   CoreFoundation                  0x00000001913da288 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20 (CFNotificationCenter.c:787)
6   CoreFoundation                  0x00000001913da2d0 ___CFXRegistrationPost1_block_invoke + 64 (CFNotificationCenter.c:175)
7   CoreFoundation                  0x00000001913d9630 _CFXRegistrationPost1 + 368 (CFNotificationCenter.c:198)
8   CoreFoundation                  0x00000001913d92e8 ___CFXNotificationPost_block_invoke + 104 (CFNotificationCenter.c:1371)
9   CoreFoundation                  0x000000019135559c -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1416 (CFXNotificationRegistrarOld.m:168)
10  CoreFoundation                  0x00000001913d8c38 _CFXNotificationPost + 1244 (CFNotificationCenter.c:1359)
11  Foundation                      0x00000001917350c8 -[NSNotificationCenter postNotificationName:object:userInfo:] + 60 (NSNotification.m:576)
12  UIKitCore                       0x000000019551a2a4 -[UIApplication _sendWillEnterForegroundCallbacks] + 280 (UIApplication.m:10519)
13  UIKitCore                       0x0000000194cd0450 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransiti... + 1732 (_UISceneLifecycleMultiplexer.m:572)
14  UIKitCore                       0x0000000195165698 _UIScenePerformActionsWithLifecycleActionMask + 100 (_UISceneLifecycleState.m:109)
15  UIKitCore                       0x0000000194ccfcf0 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransiti... + 196 (_UISceneLifecycleMultiplexer.m:501)
16  UIKitCore                       0x0000000194ccf748 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 296 (_UISceneLifecycleMultiplexer.m:450)
17  UIKitCore                       0x0000000194ccfb1c -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionSto... + 736 (_UISceneLifecycleMultiplexer.m:500)
18  UIKitCore                       0x0000000194ccf3d8 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 336 (_UISceneLifecycleMultiplexer.m:406)
19  UIKitCore                       0x0000000194cd38c4 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsFo... + 188 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:102)
20  UIKitCore                       0x0000000195096f08 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 824 (BSAnimationSettings+UIKit.m:50)
21  UIKitCore                       0x000000019517ec84 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 244 (_UISceneSettingsDiffAction.m:43)
22  UIKitCore                       0x0000000194cd35fc __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsFo... + 136 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:87)
23  UIKitCore                       0x000000019517eb80 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 100 (_UISceneSettingsDiffAction.m:35)
24  UIKitCore                       0x0000000194cd3468 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUISc... + 376 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:85)
25  UIKitCore                       0x0000000194b452c0 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 636 (UIScene.m:1338)
26  UIKitCore                       0x0000000194b43e28 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 248 (UIScene.m:1071)
27  UIKitCore                       0x0000000194b44ff8 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 220 (UIScene.m:1315)
28  UIKitCore                       0x00000001950b7d70 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 464 (UIApplicationSceneClientAgent.m:80)
29  FrontBoardServices              0x00000001965b2248 -[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:] + 544 (FBSSceneImpl.m:551)
30  FrontBoardServices              0x00000001965d6d28 __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_bloc... + 120 (FBSWorkspaceScenesClient.m:356)
31  FrontBoardServices              0x00000001965bbf04 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232 (FBSWorkspace.m:357)
32  FrontBoardServices              0x00000001965d6c5c __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_bloc... + 184 (FBSWorkspaceScenesClient.m:355)
33  libdispatch.dylib               0x000000019114b184 _dispatch_client_callout + 16 (object.m:495)
34  libdispatch.dylib               0x00000001910f3fd8 _dispatch_block_invoke_direct$VARIANT$mp + 224 (queue.c:466)
35  FrontBoardServices              0x00000001965fb418 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40 (FBSSerialQueue.m:173)
36  FrontBoardServices              0x00000001965fb0e4 -[FBSSerialQueue _queue_performNextIfPossible] + 404 (FBSSerialQueue.m:216)
37  FrontBoardServices              0x00000001965fb60c -[FBSSerialQueue _performNextFromRunLoopSource] + 28 (FBSSerialQueue.m:247)
38  CoreFoundation                  0x00000001913fca00 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1922)
39  CoreFoundation                  0x00000001913fc958 __CFRunLoopDoSource0 + 80 (CFRunLoop.c:1956)
40  CoreFoundation                  0x00000001913fc0f0 __CFRunLoopDoSources0 + 180 (CFRunLoop.c:1992)
41  CoreFoundation                  0x00000001913f723c __CFRunLoopRun + 1080 (CFRunLoop.c:2882)
42  CoreFoundation                  0x00000001913f6adc CFRunLoopRunSpecific + 464 (CFRunLoop.c:3192)
43  GraphicsServices                0x000000019b397328 GSEventRunModal + 104 (GSEvent.c:2246)
44  UIKitCore                       0x000000019550463c UIApplicationMain + 1936 (UIApplication.m:4773)
45  App Names           0x00000001027c0b3c main + 68 (SlideOutTransition.swift:15)
46  libdyld.dylib                   0x0000000191280360 start + 4

Thread 1 name:
Thread 1:
0   libsystem_kernel.dylib          0x0000000191254634 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000191253aa0 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                  0x00000001913fc288 __CFRunLoopServiceMachPort + 216 (CFRunLoop.c:2575)
3   CoreFoundation                  0x00000001913f73a8 __CFRunLoopRun + 1444 (CFRunLoop.c:2931)
4   CoreFoundation                  0x00000001913f6adc CFRunLoopRunSpecific + 464 (CFRunLoop.c:3192)
5   Foundation                      0x0000000191736784 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 228 (NSRunLoop.m:374)
6   Foundation                      0x0000000191736664 -[NSRunLoop(NSRunLoop) runUntilDate:] + 88 (NSRunLoop.m:421)
7   UIKitCore                       0x000000019559ce80 -[UIEventFetcher threadMain] + 152 (UIEventFetcher.m:637)
8   Foundation                      0x000000019186709c __NSThread__start__ + 848 (NSThread.m:724)
9   libsystem_pthread.dylib         0x0000000191199d8c _pthread_start + 156 (pthread.c:896)
10  libsystem_pthread.dylib         0x000000019119d76c thread_start + 8

Thread 2 name:
Thread 2:
0   libsystem_kernel.dylib          0x0000000191254634 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000191253aa0 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                  0x00000001913fc288 __CFRunLoopServiceMachPort + 216 (CFRunLoop.c:2575)
3   CoreFoundation                  0x00000001913f73a8 __CFRunLoopRun + 1444 (CFRunLoop.c:2931)
4   CoreFoundation                  0x00000001913f6adc CFRunLoopRunSpecific + 464 (CFRunLoop.c:3192)
5   CFNetwork                       0x00000001946c04e8 -[__CoreSchedulingSetRunnable runForever] + 192 (CoreSchedulingSet.mm:1372)
6   Foundation                      0x000000019186709c __NSThread__start__ + 848 (NSThread.m:724)
7   libsystem_pthread.dylib         0x0000000191199d8c _pthread_start + 156 (pthread.c:896)
8   libsystem_pthread.dylib         0x000000019119d76c thread_start + 8

Thread 3 name:
Thread 3:
0   libsystem_kernel.dylib          0x0000000191254634 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000191253aa0 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                  0x00000001913fc288 __CFRunLoopServiceMachPort + 216 (CFRunLoop.c:2575)
3   CoreFoundation                  0x00000001913f73a8 __CFRunLoopRun + 1444 (CFRunLoop.c:2931)
4   CoreFoundation                  0x00000001913f6adc CFRunLoopRunSpecific + 464 (CFRunLoop.c:3192)
5   AVFAudio                        0x000000019dfd9c1c GenericRunLoopThread::Entry(void*) + 156 (GenericRunLoopThread.h:91)
6   AVFAudio                        0x000000019e02ad60 CAPThread::Entry(CAPThread*) + 204 (CAPThread.cpp:286)
7   libsystem_pthread.dylib         0x0000000191199d8c _pthread_start + 156 (pthread.c:896)
8   libsystem_pthread.dylib         0x000000019119d76c thread_start + 8

Thread 4:
0   libsystem_pthread.dylib         0x000000019119d758 start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib         0x000000019119d758 start_wqthread + 0

Thread 6:
0   libsystem_pthread.dylib         0x000000019119d758 start_wqthread + 0

Thread 7 name:
Thread 7:
0   libsystem_kernel.dylib          0x00000001912779f4 kevent_id + 8
1   libdispatch.dylib               0x000000019110de18 _dispatch_kq_poll + 332 (event_kevent.c:750)
2   libdispatch.dylib               0x000000019110d920 _dispatch_kq_drain + 124 (event_kevent.c:809)
3   libdispatch.dylib               0x000000019110d844 _dispatch_event_loop_drain$VARIANT$mp + 316 (event_kevent.c:1965)
4   libdispatch.dylib               0x00000001910f8e28 _dispatch_workloop_invoke$VARIANT$mp + 1456 (queue.c:4270)
5   libdispatch.dylib               0x0000000191101314 _dispatch_workloop_worker_thread + 588 (queue.c:6445)
6   libsystem_pthread.dylib         0x000000019119ab88 _pthread_wqthread + 276 (pthread.c:2351)
7   libsystem_pthread.dylib         0x000000019119d760 start_wqthread + 8

Thread 8:
0   libsystem_pthread.dylib         0x000000019119d758 start_wqthread + 0

Thread 9:
0   libsystem_pthread.dylib         0x000000019119d758 start_wqthread + 0

Thread 10:
0   libsystem_pthread.dylib         0x000000019119d758 start_wqthread + 0

Thread 11:
0   libsystem_pthread.dylib         0x000000019119d758 start_wqthread + 0

Thread 12:
0   libsystem_pthread.dylib         0x000000019119d758 start_wqthread + 0

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x00000002811a05d0   x1: 0x00000001c97fd320   x2: 0x0000000000000000   x3: 0x000000000000000b
    x4: 0x000000000000000b   x5: 0x0000000000000010   x6: 0x000000000000006e   x7: 0x0000000000000000
    x8: 0x6012e6b213e200eb   x9: 0x6012e6b213e200eb  x10: 0x000021a1d9f09259  x11: 0x001f000102e70ce0
   x12: 0x0000000102e70ce0  x13: 0x000041a1d9f09259  x14: 0x0000000075cda64e  x15: 0x0000000000000065
   x16: 0x00000001d9f03258  x17: 0x00000001911a1904  x18: 0x0000000000000000  x19: 0x0000000000000000
   x20: 0x000000016d640f60  x21: 0x00000001d9f09258  x22: 0x00000002811a05d0  x23: 0x9de4111954e7fd89
   x24: 0x0000000102990000  x25: 0x0000000000000001  x26: 0x000000016d640f30  x27: 0x000000016d640f20
   x28: 0x0000000102990000   fp: 0x000000016d641130   lr: 0x00000001027f6438
    sp: 0x000000016d640ea0   pc: 0x00000001027f6bf0 cpsr: 0x60000000
   esr: 0xf2000001  Address size fault

this is the function networCall1() that I think has caused it but I don't know where

@objc func networkCall1() {
 var dd:Date
        var StartDate=""
        if let date=Calendar.current.date(byAdding: .month , value: +1, to: Date()){
            dd=Calendar.current.date(byAdding: .day, value:-1, to: date)!
         StartDate=dd.convertDatetoString(format: "yyyy-MM-dd'T'HH:mm:ss")
        }
        let EndDate=Date().convertDatetoString(format: "yyyy-MM-dd'T'HH:mm:ss")
        let session = URLSession.shared
          let string="api call"
          let urlC = URL(string: string)
          guard let url = urlC else {
              print("url fail")
            return
          }
          var request = URLRequest(url: url)
          request.httpMethod = "POST"
          request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.setValue("Bearer \(UserDefaults.standard.object(forKey: "token") as! String)", forHTTPHeaderField: "Authorization")
          let json=[
              "StartDate": EndDate,
              "EndDate": StartDate,
              "SubstituteId": UserDefaults.standard.object(forKey: "userId"),
              "OrganizationId": UserDefaults.standard.object(forKey: "organizationId"),
              "DistrictId": UserDefaults.standard.object(forKey: "districtId"),
              "Status": 2,
              "Requested": false
            ] as [String : Any?]
          do {
              let jsonData = try JSONSerialization.data(withJSONObject: json, options: .prettyPrinted)
                  request.httpBody=jsonData
          }catch{
              print("JSON error: \(error.localizedDescription)")
          }
          session.dataTask(with: request) { data, response, error in
            DispatchQueue.main.async{
                self.removeActivityIndicator()
            }
              if error != nil || data == nil {
                  print(error!.localizedDescription)
                  if error!.localizedDescription=="The Internet connection appears to be offline."{
                      DispatchQueue.main.async{
                      let alertController=UIAlertController(title: "No internet connection", message: "Please recheck connectivity and try again.", preferredStyle: .alert)
                      let okAction=UIAlertAction(title: "Ok", style: .default, handler: nil)
                      alertController.addAction(okAction)
                      self.present(alertController, animated: true, completion: nil)
                  }
                  }
                  return
              }
              guard let data=data else{return}
              if let httpresponse = response as? HTTPURLResponse{
              if (httpresponse.statusCode)==200{
                  print("response:\(httpresponse.statusCode)")
                //print(data)
                do{

                    self.UserInformation=try JSONDecoder().decode([jobsData].self,from:data).sorted{ $0.startDate! > $1.startDate! }
                    let grouped = Dictionary(grouping: self.UserInformation, by: {$0.startDate})
                    self.sections = grouped.map{Section(title: $0.key!, jobsData: $0.value)}
                                          .sorted{$0.title < $1.title}
                    DispatchQueue.main.async {
                        self.collectionView.reloadData()
                    }
                }catch{
                        print("Could not decode data coming from API")
                        let dataString = String(data: data, encoding: .utf8)
                        print((dataString!.description))
                }
                  }
                 else if httpresponse.statusCode==401{
                      print(httpresponse.statusCode)
                self.uptimer!.invalidate()
                      DispatchQueue.main.async {
                          let alertController=UIAlertController(title: "Logged Out", message: "login again to continue using this app", preferredStyle: .alert)
                          let okAction=UIAlertAction(title: "Ok", style: .default,handler:{ _ -> Void in
                              let nav=UINavigationController(rootViewController: LoginViewController())
                              nav.modalPresentationStyle = .fullScreen
                              _ = self.navigationController?.present(nav, animated: true)
                          })
                          alertController.addAction(okAction)
                          self.present(alertController, animated: true, completion: nil)
                      }
                  }
              }
              else{ print("Server error")
                      return
              }
          }.resume()
    }

this is timerInvalidate and scheduledTimerWithTimeInterval1 function

    @objc func timerInvalidate1(){
        self.uptimer!.invalidate()
    }

 @objc func scheduledTimerWithTimeInterval1(){
        if self.viewIfLoaded?.window != nil {
        uptimer = Timer.scheduledTimer(timeInterval: 3, target: self, selector:#selector(networkCall1), userInfo: nil, repeats: true)
uptime!.fire()
        }

I have added two NotificationCentre observer for when app goes to background and foreground for stopping and starting the time

NotificationCenter.default.addObserver(self, selector: #selector(scheduledTimerWithTimeInterval1), name: UIApplication.willEnterForegroundNotification, object: nil)
        NotificationCenter.default.addObserver(self, selector: #selector(timerInvalidate1), name: UIApplication.didEnterBackgroundNotification, object: nil)

and I have declared the timer variable under ViewController main class like this:

var uptimer:Timer?

please let me know what is the problem and how can I solve this

probeGC crash in Fabric Crashlytics

$
0
0

This crash is happening only on iOS 13.3.1 on iPad 6 & iPad Pro (12.9 inch, 3rd Gen)

This crash is happening randomly and is a real deterrent to my customers.

0  libobjc.A.dylib                0x1b80c4090 objc_msgSend + 16
1  Foundation                     0x1b875c4f0 probeGC + 120
2  Foundation                     0x1b8672d64 -[NSConcreteMapTable rehashAround:] + 204
3  Foundation                     0x1b8672c68 -[NSConcreteMapTable removeObjectForKey:] + 248
4  UIKitCore                      0x1bc8c3484 _UIAnalyticsGatherMultitouchAnalytics + 632
5  UIKitCore                      0x1bc43ea10 -[UIApplication sendEvent:] + 204
6  Instabug                       0x103980274 __IBGSwizzle_sendEvent + 240
7  UIKitCore                      0x1bc4b6c20 __dispatchPreprocessedEventFromEventQueue + 5880
8  UIKitCore                      0x1bc4b917c __handleEventQueueInternal + 4924
9  UIKitCore                      0x1bc4b1ff0 __handleHIDEventFetcherDrain + 108
10 CoreFoundation                 0x1b831ea00 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
11 CoreFoundation                 0x1b831e958 __CFRunLoopDoSource0 + 80
12 CoreFoundation                 0x1b831e0f0 __CFRunLoopDoSources0 + 180
13 CoreFoundation                 0x1b831923c __CFRunLoopRun + 1080
14 CoreFoundation                 0x1b8318adc CFRunLoopRunSpecific + 464
15 GraphicsServices               0x1c22b9328 GSEventRunModal + 104
16 UIKitCore                      0x1bc42663c UIApplicationMain + 1936
17 DocOn                          0x100df8e10 main + 15 (main.m:15)
18 libdyld.dylib                  0x1b81a2360 start + 4

OpenCV Face Recognition Program Crashing

$
0
0

Here's the code (I deleted everything that wasn't important)

closed = False

faceClassifier = cv2.CascadeClassifier('face.xml')
eyeClassifier = cv2.CascadeClassifier('eye.xml')
bodyClassifier = cv2.CascadeClassifier('body.xml')
cap = cv2.VideoCapture(0)
def drawBox():
    while closed == False:
        ret, img = cap.read()
        gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        faces = faceClassifier.detectMultiScale(img, 1.3, 5)
        for (x,y,w,h) in faces:
            cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
            roi_gray = gray[y:y+h, x:x+w]
            roi_color = img[y:y+h, x:x+w]

            eyes = eyeClassifier.detectMultiScale(roi_gray)
            for (ex,ey,ew,eh) in eyes:
                cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)
        cv2.imshow('img',img)

def stopProgram():
    closed = True

tkWindow = Tk()  
tkWindow.geometry('800x800')  
tkWindow.title('Machine Learning Face Detection')



button = Button(tkWindow,
text = 'Stop Program',
command = stopProgram)  
button.pack()  

button = Button(tkWindow,
text = 'Start Program',
command = drawBox)  
button.pack() 

tkWindow.mainloop()
cap.release()
cv2.destroyAllWindows()

As soon as I hit the start program error, the camera window opens gray and then it crashes. Anyone have any idea why? I can't figure it out, but it was working before I tried to implement the stop button.

Androd crash data sent to Firebase Crashlytics and Google Play Store

$
0
0

I develop an android app, where we use firebase crashlytics. I am curious to know which data gets collected by Firebase Crashlytics and the Google Play Store for each app crash by default. I could not find enough information about my question in the docs of the two applications. What I found out so far:

Firebase Crashlytics

Data visible in the firebase console:

  • stacktrace of the crash
  • smartphone brand (e.g. Huawei)
  • smartphone model (e.g. P30 Pro)
  • orientation (portrait/landscape)
  • free RAM space
  • free disk space
  • android version
  • if device is rooted
  • date and time of the crash
  • app version and build number

I found a full list of data that can be exported from firebase to BigQuery, but I am unshure which of the fields are really sent from my application. See: https://firebase.google.com/docs/crashlytics/bigquery-export

Firebase crashlytics stores the stacktrace for 180 days. The instance id is stored until a deletion is requested. See: https://firebase.google.com/support/privacy

The data is sent to firebase crashlytics with the first start of the app after a crash, so it is not 100% accurate.

Google Play Store

Data visible in the Play Store Console:

  • stacktrace of the crash
  • smartphone brand (e.g. Huawei)
  • smartphone model (e.g. P30 Pro)
  • free RAM space
  • android version
  • date and time of crash
  • app version and build number

I could not find a complete list of all data, that gets send to Google Play Store.

Crash data is just sent if the user has opted in to automatically share usage and diagnostics data on his phone. See: https://support.google.com/googleplay/android-developer/answer/139628?co=GENIE.Platform%3DDesktop&hl=en&oco=0 (Under the section: Crashes & application not responding errors (ANRs))

I guess the data sending to Google Play Store is not dependent on a restart of the app. This would mean the number of crashes are more accurately tracked by the Play Store. Am I right?

How long saves Google Play Store the crash report data?

Viewing all 7150 articles
Browse latest View live


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