Je continue à voir les fuites InputMethodManager provenant de la vue Android dans mon fragment de connexion dans Android. J'utilise leakcanary pour les détecter. Est-ce que quelqu'un a déjà fait face à ces problèmes et sait comment y remédier?Comment réparer InputMethodManager Leaks dans android?
Voici mon information fuite:
In com.mymyapp.myapp2.beta.debug:2.1
* com.myapp.enterprise.registration.steps.LoginFragment has leaked:
* GC ROOT android.view.inputmethod.InputMethodManager$ControlledInputConnectionWrapper.mParentInputMethodManager
* references android.view.inputmethod.InputMethodManager.mNextServedView
* references android.support.design.widget.TextInputEditText.mListeners
* references java.util.ArrayList.elementData
* references array java.lang.Object[].[1]
* references com.myapp.enterprise.registration.steps.LoginFragment$1.this$0 (anonymous implementation of android.text.TextWatcher)
* leaks com.myapp.enterprise.registration.steps.LoginFragment instance
* Retaining: 447 B.
* Reference Key: 4cc86cd2-758c-4888-9b57-67d28ff25cab
* Device: motorola motorola Moto G (4) athene_f
* Android Version: 7.0 API: 24 LeakCanary: 1.5.1 1be44b3
* Durations: watch=5235ms, gc=152ms, heap dump=2299ms, analysis=80574ms
* Details:
* Instance of android.view.inputmethod.InputMethodManager$ControlledInputConnectionWrapper
| static $classOverhead = byte[540]@1877175625 (0x6fe36d49)
| mParentInputMethodManager = [email protected] (0x12cdfaf0)
| mFinished = false
| mH = [email protected]08480 (0x12c08b60)
| mInputConnection = [email protected] (0x12c08a40)
| mInputMethodId = null
| mLock = [email protected] (0x12c06f58)
| mMainLooper = [email protected] (0x12c8c500)
| mDescriptor = [email protected] (0x6f8d4bf0)
| mObject = -1520699784
| mOwner = android.view.[email protected]315227656 (0x12c9fe08)
| shadow$_klass_ = android.view.inputmethod.InputMethodManager$ControlledInputConnectionWrapper
| shadow$_monitor_ = 0
* Instance of android.view.inputmethod.InputMethodManager
| static SHOW_IMPLICIT = 1
| static DISPATCH_NOT_HANDLED = 0
| static $classOverhead = byte[725]@1877047225 (0x6fe177b9)
| static RESULT_SHOWN = 2
| static sInstance = [email protected] (0x12cdfaf0)
| static RESULT_HIDDEN = 3
| static MSG_UNBIND = 3
| static NOT_AN_ACTION_NOTIFICATION_SEQUENCE_NUMBER = -1
| static SHOW_IM_PICKER_MODE_EXCLUDE_AUXILIARY_SUBTYPES = 2
| static RESULT_UNCHANGED_HIDDEN = 1
| static MSG_SET_ACTIVE = 4
| static MSG_SET_USER_ACTION_NOTIFICATION_SEQUENCE_NUMBER = 9
| static CONTROL_WINDOW_FIRST = 4
| static DISPATCH_IN_PROGRESS = -1
| static HIDE_NOT_ALWAYS = 2
| static TAG = [email protected] (0x6faa5b78)
| static INPUT_METHOD_NOT_RESPONDING_TIMEOUT = 2500
| static SHOW_FORCED = 2
| static CONTROL_WINDOW_IS_TEXT_EDITOR = 2
| static SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES = 1
| static CONTROL_WINDOW_VIEW_HAS_FOCUS = 1
| static MSG_BIND = 2
| static REQUEST_UPDATE_CURSOR_ANCHOR_INFO_NONE = 0
| static DEBUG = false
| static HIDE_IMPLICIT_ONLY = 1
| static PENDING_EVENT_COUNTER = [email protected] (0x6fa9b308)
| static CONTROL_START_INITIAL = 256
| static MSG_FLUSH_INPUT_EVENT = 7
| static DISPATCH_HANDLED = 1
| static MSG_SEND_INPUT_EVENT = 5
| static SHOW_IM_PICKER_MODE_AUTO = 0
| static MSG_DUMP = 1
| static RESULT_UNCHANGED_SHOWN = 0
| static MSG_TIMEOUT_INPUT_EVENT = 6
| mActive = true
| mBindSequence = 9
| mClient = [email protected] (0x12c088c0)
| mCompletions = null
| mCurChannel = [email protected] (0x131cadd0)
| mCurId = [email protected] (0x131df240)
| mCurMethod = [email protected]92 (0x131cadc0)
| mCurRootView = [email protected] (0x13061800)
| mCurSender = null
| mCurrentTextBoxAttribute = [email protected] (0x12d1b310)
| mCursorAnchorInfo = null
| mCursorCandEnd = -1
| mCursorCandStart = -1
| mCursorRect = [email protected] (0x12c6f100)
| mCursorSelEnd = 0
| mCursorSelStart = 0
| mDummyInputConnection = [email protected] (0x12c08a40)
| mFullscreenMode = false
| mH = [email protected] (0x12c08b40)
| mHasBeenInactive = false
| mIInputContext = android.view.[email protected]315227656 (0x12c9fe08)
| mLastBindFailed = false
| mLastSentUserActionNotificationSequenceNumber = -1
| mMainLooper = [email protected] (0x12c8c500)
| mNextServedView = [email protected] (0x131b9400)
| mNextUserActionNotificationSequenceNumber = 2
| mPendingEventPool = [email protected] (0x12c04860)
| mPendingEvents = [email protected] (0x12c6f118)
| mRequestUpdateCursorAnchorInfoMonitorMode = 0
| mServedConnecting = false
| mServedInputConnectionWrapper = android.view.[email protected]320700984 (0x131d8238)
| mServedView = [email protected] (0x131b9400)
| mService = [email protected]12 (0x12c04850)
| mTmpCursorRect = [email protected] (0x12c6f0e8)
| shadow$_klass_ = android.view.inputmethod.InputMethodManager
| shadow$_monitor_ = 0
* Instance of android.support.design.widget.TextInputEditText
| static $classOverhead = byte[4196]@318885889 (0x1301d001)
| mBackgroundTintHelper = [email protected] (0x13183540)
| mTextHelper = [email protected] (0x131bc150)
| mAllowTransformationLengthChange = false
| mAutoLinkMask = 0
| mBoring = null
| mBreakStrategy = 0
| mBufferType = [email protected] (0x6fe07d58)
| mChangeWatcher = [email protected] (0x131ba270)
| mCharWrapper = null
| mCurHintTextColor = -2130706433
| mCurTextColor = -1
| mCurrentSpellCheckerLocaleCache = [email protected] (0x131da0d0)
| mCursorDrawableRes = 17303398
| mDeferScroll = -1
| mDesiredHeightAtMeasure = 136
| mDeviceProvisionedState = 0
| mDrawables = [email protected] (0x12ea0400)
| mEditableFactory = [email protected] (0x6fe059e0)
| mEditor = [email protected] (0x13185ac0)
| mEllipsize = null
| mFilters = android.text.InputFilter[1]@320581488 (0x131baf70)
| mFreezesText = false
| mGravity = 8388627
| mHighlightColor = 1727238656
| mHighlightPaint = [email protected] (0x131b7500)
| mHighlightPath = [email protected] (0x131dba00)
| mHighlightPathBogus = false
| mHint = null
| mHintBoring = null
| mHintLayout = null
| mHintTextColor = [email protected] (0x12d17150)
| mHorizontallyScrolling = true
| mHyphenationFrequency = 1
| mIncludePad = true
| mLastLayoutDirection = 0
| mLastScroll = 0
| mLayout = [email protected] (0x12e47778)
| mLinkTextColor = [email protected] (0x12c8f808)
| mLinksClickable = true
| mListeners = [email protected] (0x131bd1a8)
| mLocalesChanged = false
| mMarquee = null
| mMarqueeFadeMode = 0
| mMarqueeRepeatLimit = 3
| mMaxMode = 1
| mMaxWidth = 2147483647
| mMaxWidthMode = 2
| mMaximum = 1
| mMinMode = 1
| mMinWidth = 0
| mMinWidthMode = 2
| mMinimum = 1
| mMovement = [email protected] (0x12c06ed8)
| mOldMaxMode = 1
| mOldMaximum = 1
| mPreDrawListenerDetached = false
| mPreDrawRegistered = false
| mPreventDefaultMovement = false
| mRestartMarquee = false
| mSavedHintLayout = null
| mSavedLayout = null
| mSavedMarqueeModeLayout = null
| mScroller = null
| mShadowColor = 0
| mShadowDx = 0.0
| mShadowDy = 0.0
| mShadowRadius = 0.0
| mSingleLine = true
| mSpacingAdd = 0.0
| mSpacingMult = 1.0
| mSpannableFactory = [email protected] (0x6fe059f8)
| mTempRect = [email protected] (0x131d0f58)
| mText = [email protected] (0x12df5100)
| mTextColor = [email protected] (0x7404f5e8)
| mTextDir = andr[email protected]1876982208 (0x6fe079c0)
| mTextEditSuggestionContainerLayout = 17367286
| mTextEditSuggestionHighlightStyle = 16974923
| mTextEditSuggestionItemLayout = 17367288
| mTextPaint = [email protected] (0x12f14510)
| mTextSelectHandleLeftRes = 17303402
| mTextSelectHandleRes = 17303404
| mTextSelectHandleRightRes = 17303406
| mTransformation = [email protected] (0x12c06fb0)
| mTransformed = android.text.method[email protected]320632600 (0x131c7718)
| mUserSetTextScaleX = false
| mAccessibilityCursorPosition = -1
| mAccessibilityDelegate = null
| mAccessibilityTraversalAfterId = -1
| mAccessibilityTraversalBeforeId = -1
| mAccessibilityViewId = -1
| mAnimator = null
| mAttachInfo = [email protected] (0x13007a00)
| mAttributes = null
| mBackground = [email protected] (0x13071b68)
| mBackgroundRenderNode = [email protected] (0x131de0a0)
| mBackgroundResource = 0
| mBackgroundSizeChanged = false
| mBackgroundTint = null
| mBottom = 136
| mCachingFailed = false
| mClipBounds = null
| mContentDescription = null
| mContext = [email protected] (0x12dfc4c0)
| mCurrentAnimation = null
| mDrawableState = int[4]@1870821352 (0x6f8277e8)
| mDrawingCache = null
| mDrawingCacheBackgroundColor = 0
| mFloatingTreeObserver = null
| mForegroundInfo = null
| mFrameMetricsObservers = null
| mGhostView = null
| mHasPerformedLongPress = false
| mID = 2131755351
| mIgnoreNextUpEvent = false
| mInContextButtonPress = false
| mInputEventConsistencyVerifier = null
| mKeyedTags = null
| mLabelForId = -1
| mLastIsOpaque = false
| mLayerPaint = null
| mLayerType = 0
| mLayoutInsets = null
| mLayoutParams = [email protected] (0x13071e40)
| mLeft = 0
| mLeftPaddingDefined = false
| mListenerInfo = null
| mLongClickX = NaN
| mLongClickY = NaN
| mMatchIdPredicate = null
| mMatchLabelForPredicate = null
| mMeasureCache = [email protected] (0x131d0ac0)
| mMeasuredHeight = 136
| mMeasuredWidth = 984
| mMinHeight = 0
| mMinWidth = 0
| mNestedScrollingParent = null
| mNextFocusDownId = -1
| mNextFocusForwardId = -1
| mNextFocusLeftId = -1
| mNextFocusRightId = -1
| mNextFocusUpId = -1
| mOldHeightMeasureSpec = 455
| mOldWidthMeasureSpec = 1073742808
| mOutlineProvider = [email protected] (0x6fe05ad8)
| mOverScrollMode = 1
| mOverlay = null
| mPaddingBottom = 33
| mPaddingLeft = 12
| mPaddingRight = 12
| mPaddingTop = 30
| mParent = [email protected] (0x131b9000)
| mPendingCheckForLongPress = null
| mPendingCheckForTap = null
| mPerformClick = null
| mPointerIcon = null
| mPrivateFlags = 16943154
| mPrivateFlags2 = 1611867688
| mPrivateFlags3 = 4
| mRecreateDisplayList = false
| mRenderNode = [email protected] (0x1311aaa8)
| mResources = [email protected] (0x12c09ec0)
| mRight = 984
| mRightPaddingDefined = false
| mRunQueue = [email protected] (0x131ca690)
| mScrollCache = null
| mScrollIndicatorDrawable = null
| mScrollX = 0
| mScrollY = 0
| mSendViewScrolledAccessibilityEvent = null
| mSendViewStateChangedAccessibilityEvent = null
| mSendingHoverAccessibilityEvents = false
| mStartActivityRequestWho = null
| mStateListAnimator = null
| mSystemUiVisibility = 0
| mTag = null
| mTempNestedScrollConsumed = null
| mTop = 0
| mTouchDelegate = null
| mTouchSlop = 48
| mTransformationInfo = [email protected] (0x131d0eb0)
| mTransientStateCount = 0
| mTransitionName = null
| mUnscaledDrawingCache = null
| mUnsetPressedState = null
| mUserPaddingBottom = 33
| mUserPaddingEnd = -2147483648
| mUserPaddingLeft = 12
| mUserPaddingLeftInitial = 12
| mUserPaddingRight = 12
| mUserPaddingRightInitial = 12
| mUserPaddingStart = -2147483648
| mVerticalScrollFactor = 0.0
| mVerticalScrollbarPosition = 0
| mViewFlags = 405028865
| mWindowAttachCount = 1
| shadow$_klass_ = android.support.design.widget.TextInputEditText
| shadow$_monitor_ = 0
* Instance of java.util.ArrayList
| static $classOverhead = byte[460]@1870958273 (0x6f848ec1)
| static EMPTY_ELEMENTDATA = java.lang.Object[0]@1870221960 (0x6f795288)
| static DEFAULT_CAPACITY = 10
| static MAX_ARRAY_SIZE = 2147483639
| static serialVersionUID = 8683452581122892189
| elementData = java.lang.Object[10]@319233656 (0x13071e78)
| size = 2
| modCount = 2
| shadow$_klass_ = java.util.ArrayList
| shadow$_monitor_ = 0
* Array of java.lang.Object[]
| [0] = [email protected] (0x131ba2c0)
| [1] = [email protected]4 (0x130664e0)
| [2] = null
| [3] = null
| [4] = null
| [5] = null
| [6] = null
| [7] = null
| [8] = null
| [9] = null
* Instance of com.myapp.enterprise.registration.steps.LoginFragment$1
| static $change = null
| static $classOverhead = byte[328]@317118193 (0x12e6d6f1)
| static serialVersionUID = 0
| this$0 = [email protected] (0x12f253a0)
| shadow$_klass_ = com.myapp.enterprise.registration.steps.LoginFragment$1
| shadow$_monitor_ = 0
* Instance of com.myapp.enterprise.registration.steps.LoginFragment
| static $classOverhead = byte[964]@316739585 (0x12e11001)
| static MIN_PASSWORD_LENGTH = 8
| static $change = null
| static MAX_PASSWORD_LENGTH = 26
| static serialVersionUID = 0
| emailOK = false
| errorTextView = [email protected] (0x131bf800)
| forgotPasswordButton = [email protected] (0x131c0400)
| loginRegisterButton = [email protected] (0x131bfc00)
| mPasswordWatcher = [email protected]0 (0x130664f0)
| mUsernameWatcher = [email protected]4 (0x130664e0)
| passwordEditText = [email protected] (0x131bf400)
| passwordOK = false
| usernameEditText = [email protected] (0x131b9400)
| usernameLayout = [email protected] (0x131b8c00)
| registrationInterface = [email protected] (0x12dfc4c0)
| mAdded = true
| mAnimationInfo = null
| mArguments = null
| mBackStackNesting = 0
| mCalled = true
| mCheckedForLoaderManager = true
| mChildFragmentManager = [email protected] (0x12f14e40)
| mChildNonConfig = null
| mContainer = [email protected] (0x1306ec00)
| mContainerId = 16908290
| mDeferStart = false
| mDetached = false
| mFragmentId = 16908290
| mFragmentManager = [email protected] (0x12e9e200)
| mFromLayout = false
| mHasMenu = false
| mHidden = false
| mHiddenChanged = false
| mHost = [email protected] (0x13069250)
| mInLayout = false
| mIndex = 0
| mInnerView = [email protected] (0x131b5800)
| mIsNewlyAdded = false
| mLoaderManager = null
| mLoadersStarted = true
| mMenuVisible = true
| mParentFragment = null
| mPostponedAlpha = 0.0
| mRemoving = false
| mRestored = true
| mRetainInstance = false
| mRetaining = false
| mSavedFragmentState = null
| mSavedViewState = null
| mState = 5
| mTag = [email protected] (0x12e815c0)
| mTarget = null
| mTargetIndex = -1
| mTargetRequestCode = 0
| mUserVisibleHint = true
| mView = [email protected] (0x131b5800)
| mWho = [email protected] (0x13064580)
| shadow$_klass_ = com.myapp.enterprise.registration.steps.LoginFragment
| shadow$_monitor_ = 0
* Excluded Refs:
| Field: android.view.textservice.SpellCheckerSession$1.this$0
| Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
| Thread:FinalizerWatchdogDaemon (always)
| Thread:main (always)
| Thread:LeakCanary-Heap-Dump (always)
| Class:java.lang.ref.WeakReference (always)
| Class:java.lang.ref.SoftReference (always)
| Class:java.lang.ref.PhantomReference (always)
| Class:java.lang.ref.Finalizer (always)
| Class:java.lang.ref.FinalizerReference (always)
Je n'utilise pas toutes les références anonymes pour textwatcher. Je le sépare essentiellement pour éviter toute fuite. Pourtant, je vois cette fuite à travers pour un textview? Vous ne savez pas comment résoudre ce problème? Quelqu'un a des indices ou a déjà vécu cela?
Il est probablement un bogue dans le code source Android. Voir cet article: https://medium.com/@amitshekhar/android-memory-leaks-inputmethodmanager-solved-a6f2fe1d1348 –
Je reçois une tonne de ces erreurs –