A memory leak detection library for Android.

Overview

LeakCanary 🐤

A memory leak detection library for Android.

square.github.io/leakcanary

License

Copyright 2015 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Android 6.0 Heap dump parsing failure

    Android 6.0 Heap dump parsing failure

    This happens on both: 1.3.1 and 1.4-SNAPSHOT

    * FAILURE:
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
            at com.squareup.leakcanary.HeapAnalyzer.findLeakingReference(HeapAnalyzer.java:160)
            at com.squareup.leakcanary.HeapAnalyzer.checkForLeak(HeapAnalyzer.java:95)
            at com.squareup.leakcanary.internal.HeapAnalyzerService.onHandleIntent(HeapAnalyzerService.java:57)
            at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.os.HandlerThread.run(HandlerThread.java:61)
    * Reference Key: 88f1eda2-7ddd-46df-a20b-7fb23672bc08
    * Device: htc google Nexus 9 volantis
    * Android Version: 6.0 API: 23 LeakCanary: 1.3.1
    
    opened by Exaper 51
  • #159 Renamed resources leading with

    #159 Renamed resources leading with "__"

    Build tools "1.3.0 rc1" changed the rules for resources. This commit simply removes the lead "__" from the offending resources in the project.

    opened by ToxicBakery 51
  • Library leakcanary-android-1.3 is not in list of external libraries

    Library leakcanary-android-1.3 is not in list of external libraries

    I have a project with lots of dependencies. When I add

     dependencies {
       debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
       releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
     }
    

    to main build.gradle, leakcanary-android is not in list of external libraries after gradle sync, although leakcanary-analyzer and leakcanary-watcher are there. See screenshot: screen shot 2015-05-09 at 18 59 23

    On a blank project however everything works fine: screen shot 2015-05-09 at 18 59 09

    opened by zaur 40
  • Memory leak caused by Samsung Clipboard (SemClipboardManager)

    Memory leak caused by Samsung Clipboard (SemClipboardManager)

    Observing frequent memory leak on Samsung S6 Edge with Android 7.0 involving our activity context and Samsungs' clipboard manager

    D/LeakCanary: In im.example.app.debug:2.22.0:0.
    D/LeakCanary: * im.example.app.ui.activities.GroupChatActivity has leaked:
    D/LeakCanary: * GC ROOT com.samsung.android.content.clipboard.SemClipboardManager$2.this$0 (anonymous subclass of android.sec.clipboard.IClipboardDataPasteEvent$Stub)
    D/LeakCanary: * references com.samsung.android.content.clipboard.SemClipboardManager.mContext
    D/LeakCanary: * leaks im.example.app.ui.activities.GroupChatActivity instance
    D/LeakCanary: * Retaining: 1.6 MB.
    D/LeakCanary: * Reference Key: 48f5a969-d8c4-434f-a4af-e2ff53157ddd
    D/LeakCanary: * Device: samsung samsung SM-G925F zeroltexx
    D/LeakCanary: * Android Version: 7.0 API: 24 LeakCanary: 1.5 00f37f5
    D/LeakCanary: * Durations: watch=5013ms, gc=173ms, heap dump=4561ms, analysis=227966ms
    D/LeakCanary: * Details:
    D/LeakCanary: * Instance of com.samsung.android.content.clipboard.SemClipboardManager$2
    D/LeakCanary: |   static $classOverhead = byte[744]@315280385 (0x12cacc01)
    D/LeakCanary: |   this$0 = com.samsung.android.content.clipboard.SemClipboardManager@342092224 (0x1463e9c0)
    D/LeakCanary: |   mDescriptor = java.lang.String@314652704 (0x12c13820)
    D/LeakCanary: |   mObject = 490498265248
    D/LeakCanary: |   mOwner = com.samsung.android.content.clipboard.SemClipboardManager$2@331477952 (0x13c1f3c0)
    D/LeakCanary: |   shadow$_klass_ = com.samsung.android.content.clipboard.SemClipboardManager$2
    D/LeakCanary: |   shadow$_monitor_ = 0
    D/LeakCanary: * Instance of com.samsung.android.content.clipboard.SemClipboardManager
    D/LeakCanary: |   static ACTION_REMOVE_CLIP = java.lang.String@314664576 (0x12c16680)
    D/LeakCanary: |   static $classOverhead = byte[904]@1980290401 (0x7608d561)
    D/LeakCanary: |   static sService = android.sec.clipboard.IClipboardService$Stub$Proxy@314579456 (0x12c01a00)
    D/LeakCanary: |   static ACTION_DISMISS_CLIPBOARD = java.lang.String@314731392 (0x12c26b80)
    D/LeakCanary: |   static ACTION_CLIPBOARD_CLOSED = java.lang.String@314730960 (0x12c269d0)
    D/LeakCanary: |   static EXTRA_DARK_THEME = java.lang.String@314816200 (0x12c3b6c8)
    D/LeakCanary: |   static EXTRA_NO_TOAST = java.lang.String@314883872 (0x12c4bf20)
    D/LeakCanary: |   static ACTION_CLIPBOARD_OPENED = java.lang.String@314730384 (0x12c26790)
    D/LeakCanary: |   static EXTRA_EXTRA_PATH = java.lang.String@314771664 (0x12c308d0)
    D/LeakCanary: |   static TAG = java.lang.String@314943520 (0x12c5a820)
    D/LeakCanary: |   static EXTRA_PATH = java.lang.String@1867865776 (0x6f555eb0)
    D/LeakCanary: |   static EXTRA_TYPE = java.lang.String@1867826880 (0x6f54c6c0)
    D/LeakCanary: |   static ACTION_ADD_CLIP = java.lang.String@314663424 (0x12c16200)
    D/LeakCanary: |   FAIL_SET_DATA = 1
    D/LeakCanary: |   KEY_DATA = java.lang.String@1868267080 (0x6f5b7e48)
    D/LeakCanary: |   KEY_FILTER = java.lang.String@1869366096 (0x6f6c4350)
    D/LeakCanary: |   PROTECTED_DATA_MAX = 3
    D/LeakCanary: |   SUCCESS_AND_SAVE_BITMAP = 2
    D/LeakCanary: |   SUCCESS_SET_DATA = 0
    D/LeakCanary: |   mClipboardPasteEvent = com.samsung.android.content.clipboard.SemClipboardManager$2@331477952 (0x13c1f3c0)
    D/LeakCanary: |   mCocktailBarManager = com.samsung.android.cocktailbar.CocktailBarManager@331477888 (0x13c1f380)
    D/LeakCanary: |   mContext = im.example.app.ui.activities.GroupChatActivity@334734848 (0x13f3a600)
    D/LeakCanary: |   mHandler = com.samsung.android.content.clipboard.SemClipboardManager$3@331477920 (0x13c1f3a0)
    D/LeakCanary: |   mIsFiltered = false
    D/LeakCanary: |   mIsMaximumSize = false
    D/LeakCanary: |   mOnClipboardEventServiceListener = com.samsung.android.content.clipboard.SemClipboardManager$1@331477984 (0x13c1f3e0)
    D/LeakCanary: |   mOnClipboardEventServiceListeners = java.util.ArrayList@331126912 (0x13bc9880)
    D/LeakCanary: |   mPasteListener = null
    D/LeakCanary: |   mPersonaManager = com.samsung.android.knox.SemPersonaManager@331126888 (0x13bc9868)
    D/LeakCanary: |   mRegInterface = null
    D/LeakCanary: |   mSetDataHandler = null
    D/LeakCanary: |   mTypeId = 0
    D/LeakCanary: |   shadow$_klass_ = com.samsung.android.content.clipboard.SemClipboardManager
    D/LeakCanary: |   shadow$_monitor_ = 0
    D/LeakCanary: * Instance of im.example.app.ui.activities.GroupChatActivity
    D/LeakCanary: |   static $change = null
    D/LeakCanary: |   static serialVersionUID = 4181920779988445483
    D/LeakCanary: |   static $classOverhead = byte[5848]@317517825 (0x12ecf001)
    D/LeakCanary: |   static TAG = java.lang.String@314980832 (0x12c639e0)
    D/LeakCanary: |   DESCRIPTION_MIN_LENGTH_FOR_POPUP = 50
    D/LeakCanary: |   bottomButton = android.support.v7.widget.AppCompatButton@329263104 (0x13a02800)
    D/LeakCanary: |   bottomButtonWrapper = android.widget.FrameLayout@328830976 (0x13999000)
    D/LeakCanary: |   buttonProgressBar = com.rey.material.widget.ProgressView@329259008 (0x13a01800)
    D/LeakCanary: |   chatWrapper = null
    D/LeakCanary: |   onlineMembersCount = 1
    D/LeakCanary: |   privateView = null
    D/LeakCanary: |   adapter = im.example.app.adapters.ChatAdapter@328077664 (0x138e1160)
    D/LeakCanary: |   allBottomLoaded = true
    D/LeakCanary: |   allTopLoaded = false
    D/LeakCanary: |   alreadyLoading = false
    D/LeakCanary: |   chatEditor = im.example.app.core.ChatEditor@327850272 (0x138a9920)
    D/LeakCanary: |   emojiSkinPopupView = null
    D/LeakCanary: |   fromCountedSerial = null
    D/LeakCanary: |   headersDecoration = com.timehop.stickyheadersrecyclerview.StickyRecyclerHeadersDecoration@328033992 (0x138d66c8)
    D/LeakCanary: |   highlightMessage = false
    D/LeakCanary: |   inputControls = android.widget.LinearLayout@327639040 (0x13876000)
    D/LeakCanary: |   lastSeenCountedSerial = java.lang.Long@335647216 (0x140191f0)
    D/LeakCanary: |   lastSeenSerial = java.lang.Long@335647232 (0x14019200)
    D/LeakCanary: |   myMessages = false
    D/LeakCanary: |   newMessageHeader = im.example.app.adapters.NewMessageHeaderDecoration@328033912 (0x138d6678)
    D/LeakCanary: |   resumed = true
    D/LeakCanary: |   scrollToNewMessageHeaderOnSync = false
    D/LeakCanary: |   storedPositionTopOffset = 0
    D/LeakCanary: |   subscribed = true
    D/LeakCanary: |   targetSerial = null
    D/LeakCanary: |   titleHintShowing = false
    D/LeakCanary: |   typingSubscriptions = java.util.HashMap@325263816 (0x136321c8)
    D/LeakCanary: |   typingUsers = java.util.HashMap@325263856 (0x136321f0)
    D/LeakCanary: |   channel = im.example.app.entity.Channel@320791400 (0x131ee368)
    D/LeakCanary: |   goToBottomButton = android.support.v7.widget.AppCompatImageView@327342080 (0x1382d800)
    D/LeakCanary: |   imageShowClicked = false
    D/LeakCanary: |   lastVisibleLink = java.lang.String@1867494664 (0x6f4fb508)
    D/LeakCanary: |   layoutManager = im.example.app.ui.extensions.CustomLinearLayoutManager@329887520 (0x13a9af20)
    D/LeakCanary: |   linkPopupView = null
    D/LeakCanary: |   membership = im.example.app.entity.Membership@326927480 (0x137c8478)
    D/LeakCanary: |   popupWindow = null
    D/LeakCanary: |   progressBar = android.widget.ProgressBar@327341056 (0x1382d400)
    D/LeakCanary: |   radialPopupWindow = im.example.app.ui.extensions.RadialPopupWindow@318692544 (0x12fedcc0)
    D/LeakCanary: |   recyclerView = android.support.v7.widget.RecyclerView@327344128 (0x1382e000)
    D/LeakCanary: |   currentSubTitle = android.text.SpannableString@334505344 (0x13f02580)
    D/LeakCanary: |   appBarLayout = null
    D/LeakCanary: |   bottomNavigationView = null
    D/LeakCanary: |   collapsingToolbarLayout = null
    D/LeakCanary: |   contentOverlay = android.view.View@334736384 (0x13f3ac00)
    D/LeakCanary: |   contentWrapper = android.widget.FrameLayout@326764544 (0x137a0800)
    D/LeakCanary: |   coordinatorLayout = null
    D/LeakCanary: |   fab = null
    D/LeakCanary: |   menuIncrementedId = -1
    D/LeakCanary: |   progressBar = android.widget.ProgressBar@326766592 (0x137a1000)
    D/LeakCanary: |   rightButton = android.support.v7.widget.AppCompatButton@326765568 (0x137a0c00)
    D/LeakCanary: |   subTitleProgressBar = android.widget.ProgressBar@326767616 (0x137a1400)
    D/LeakCanary: |   tabLayout = null
    D/LeakCanary: |   toolbar = android.support.v7.widget.Toolbar@326433792 (0x1374fc00)
    D/LeakCanary: |   toolbarContainer = null
    D/LeakCanary: |   toolbarContentWrapper = android.widget.LinearLayout@326429696 (0x1374ec00)
    D/LeakCanary: |   toolbarGroupLogo = im.example.app.ui.extensions.GroupAvatarView@326454272 (0x13754c00)
    D/LeakCanary: |   toolbarMode = im.example.app.ui.activities.ToolbarActivity$ToolbarMode@320724176 (0x131ddcd0)
    D/LeakCanary: |   toolbarSubTitle = android.support.v7.widget.AppCompatTextView@326768640 (0x137a1800)
    D/LeakCanary: |   toolbarSubTitleWrapper = android.widget.LinearLayout@326769664 (0x137a1c00)
    D/LeakCanary: |   toolbarTitle = android.support.v7.widget.AppCompatTextView@326755328 (0x1379e400)
    D/LeakCanary: |   toolbarUserLogo = im.example.app.ui.extensions.UserAvatarView@326610944 (0x1377b000)
    D/LeakCanary: |   appLayout = im.example.app.ui.extensions.AppLayout@326382592 (0x13743400)
    D/LeakCanary: |   customTabActivityHelper = im.example.app.ui.extensions.customtabs.CustomTabActivityHelper@326213032 (0x13719da8)
    D/LeakCanary: |   pendingRunnable = null
    D/LeakCanary: |   subscriptions = rx.subscriptions.CompositeSubscription@327019840 (0x137ded40)
    D/LeakCanary: |   tracker = com.google.android.gms.analytics.Tracker@315915408 (0x12d47c90)
    D/LeakCanary: |   mDelegate = android.support.v7.app.AppCompatDelegateImplN@326663904 (0x13787ee0)
    D/LeakCanary: |   mEatKeyUpEvent = false
    D/LeakCanary: |   mResources = null
    D/LeakCanary: |   mThemeId = 2131361857
    D/LeakCanary: |   mCreated = true
    D/LeakCanary: |   mFragments = android.support.v4.app.FragmentController@327019872 (0x137ded60)
    D/LeakCanary: |   mHandler = android.support.v4.app.FragmentActivity$1@327174496 (0x13804960)
    D/LeakCanary: |   mNextCandidateRequestIndex = 0
    D/LeakCanary: |   mOptionsMenuInvalidated = false
    D/LeakCanary: |   mPendingFragmentActivityResults = android.support.v4.util.SparseArrayCompat@326213080 (0x13719dd8)
    D/LeakCanary: |   mReallyStopped = true
    D/LeakCanary: |   mRequestedPermissionsFromFragment = false
    D/LeakCanary: |   mResumed = false
    D/LeakCanary: |   mRetaining = false
    D/LeakCanary: |   mStopped = true
    D/LeakCanary: |   mStartedActivityFromFragment = false
    D/LeakCanary: |   mStartedIntentSenderFromFragment = false
    D/LeakCanary: |   mExtraDataMap = android.support.v4.util.SimpleArrayMap@326195784 (0x13715a48)
    D/LeakCanary: |   mActionBar = null
    D/LeakCanary: |   mActionModeTypeStarting = 0
    D/LeakCanary: |   mActivityInfo = android.content.pm.ActivityInfo@314596800 (0x12c05dc0)
    D/LeakCanary: |   mActivityTransitionState = android.app.ActivityTransitionState@327159416 (0x13800e78)
    D/LeakCanary: |   mAppLockCheckRunnable = android.app.Activity$1@327019904 (0x137ded80)
    D/LeakCanary: |   mAppLockIsInMultiWindowMode = false
    D/LeakCanary: |   mApplication = im.example.app.App@315620224 (0x12cffb80)
    D/LeakCanary: |   mCalled = true
    D/LeakCanary: |   mChangeCanvasToTranslucent = false
    D/LeakCanary: |   mChangingConfigurations = false
    D/LeakCanary: |   mComponent = android.content.ComponentName@327217136 (0x1380eff0)
    D/LeakCanary: |   mConfigChangeFlags = 0
    D/LeakCanary: |   mCurrentConfig = android.content.res.Configuration@326688648 (0x1378df88)
    D/LeakCanary: |   mDecor = null
    D/LeakCanary: |   mDefaultKeyMode = 0
    D/LeakCanary: |   mDefaultKeySsb = null
    D/LeakCanary: |   mDestroyed = true
    D/LeakCanary: |   mDoReportFullyDrawn = false
    D/LeakCanary: |   mEatKeyUpEvent = false
    D/LeakCanary: |   mEmbeddedID = null
    D/LeakCanary: |   mEnableDefaultActionBarUp = true
    D/LeakCanary: |   mEnterTransitionListener = android.app.SharedElementCallback$1@1875119720 (0x6fc40e68)
    D/LeakCanary: |   mExitTransitionListener = android.app.SharedElementCallback$1@1875119720 (0x6fc40e68)
    D/LeakCanary: |   mFinished = true
    D/LeakCanary: |   mFlipfont = 0
    D/LeakCanary: |   mFragments = android.app.FragmentController@327019936 (0x137deda0)
    D/LeakCanary: |   mHandler = android.os.Handler@327174592 (0x138049c0)
    D/LeakCanary: |   mHasCurrentPermissionsRequest = false
    D/LeakCanary: |   mIdent = 179641163
    D/LeakCanary: |   mInstanceTracker = android.os.StrictMode$InstanceTracker@327019920 (0x137ded90)
    D/LeakCanary: |   mInstrumentation = android.app.Instrumentation@320684888 (0x131d4358)
    D/LeakCanary: |   mIntent = android.content.Intent@327098304 (0x137f1fc0)
    D/LeakCanary: |   mLastNonConfigurationInstances = null
    D/LeakCanary: |   mMainThread = android.app.ActivityThread@314589536 (0x12c04160)
    D/LeakCanary: |   mManagedCursors = java.util.ArrayList@326195808 (0x13715a60)
    D/LeakCanary: |   mManagedDialogs = null
    D/LeakCanary: |   mMenuInflater = null
    D/LeakCanary: |   mParent = null
    D/LeakCanary: |   mPolicyManager = null
    D/LeakCanary: |   mReferrer = java.lang.String@327035864 (0x137e2bd8)
    D/LeakCanary: |   mResultCode = 0
    D/LeakCanary: |   mResultData = null
    D/LeakCanary: |   mResumed = false
    D/LeakCanary: |   mScreenChangeListener = null
    D/LeakCanary: |   mSearchEvent = null
    D/LeakCanary: |   mSearchManager = null
    D/LeakCanary: |   mStartedActivity = false
    D/LeakCanary: |   mStopped = true
    D/LeakCanary: |   mTaskDescription = android.app.ActivityManager$TaskDescription@327174528 (0x13804980)
    D/LeakCanary: |   mTemporaryPause = false
    D/LeakCanary: |   mTitle = java.lang.String@315619600 (0x12cff910)
    D/LeakCanary: |   mTitleColor = 0
    D/LeakCanary: |   mTitleReady = true
    D/LeakCanary: |   mToken = android.os.BinderProxy@327278528 (0x1381dfc0)
    D/LeakCanary: |   mTranslucentCallback = null
    D/LeakCanary: |   mUiThread = java.lang.Thread@1980197944 (0x76076c38)
    D/LeakCanary: |   mVisibleBehind = false
    D/LeakCanary: |   mVisibleFromClient = true
    D/LeakCanary: |   mVisibleFromServer = true
    D/LeakCanary: |   mVoiceInteractor = null
    D/LeakCanary: |   mWindow = com.android.internal.policy.PhoneWindow@331357472 (0x13c01d20)
    D/LeakCanary: |   mWindowAdded = true
    D/LeakCanary: |   mWindowManager = android.view.WindowManagerImpl@326213560 (0x13719fb8)
    D/LeakCanary: |   mInflater = com.android.internal.policy.PhoneLayoutInflater@327645888 (0x13877ac0)
    D/LeakCanary: |   mOverrideConfiguration = null
    D/LeakCanary: |   mResources = android.content.res.Resources@326101824 (0x136feb40)
    D/LeakCanary: |   mTheme = android.content.res.Resources$Theme@327019616 (0x137dec60)
    D/LeakCanary: |   mThemeResource = 2131361857
    D/LeakCanary: |   mBase = android.app.ContextImpl@329077248 (0x139d5200)
    D/LeakCanary: |   shadow$_klass_ = im.example.app.ui.activities.GroupChatActivity
    D/LeakCanary: |   shadow$_monitor_ = 1073746630
    D/LeakCanary: * Excluded Refs:
    D/LeakCanary: | Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
    D/LeakCanary: | Thread:FinalizerWatchdogDaemon (always)
    D/LeakCanary: | Thread:main (always)
    D/LeakCanary: | Thread:LeakCanary-Heap-Dump (always)
    D/LeakCanary: | Class:java.lang.ref.WeakReference (always)
    D/LeakCanary: | Class:java.lang.ref.SoftReference (always)
    D/LeakCanary: | Class:java.lang.ref.PhantomReference (always)
    D/LeakCanary: | Class:java.lang.ref.Finalizer (always)
    D/LeakCanary: | Class:java.lang.ref.FinalizerReference (always)
    
    opened by rafaelekol 39
  • Heap analysis failed for Obfuscated App

    Heap analysis failed for Obfuscated App

    Description

    I ran the app from android studio setting up LeakCanary for obfuscated apps and it failed during heap analysis. I turned off obfuscation in progaurd-rules.pro and it worked.

    m.d
    at shark.c$o$a.a()
    at shark.c$o$a.a()
    at shark.q0.a()
    at shark.c$o.a()
    at shark.o.a()
    at shark.o.a()
    at shark.o.a()
    at shark.o.a()
    at shark.o.a()
    at leakcanary.internal.HeapAnalyzerService.a()
    at leakcanary.internal.HeapAnalyzerService.a()
    at leakcanary.internal.i.onHandleIntent()
    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.os.HandlerThread.run(HandlerThread.java:61)
    
    Build.VERSION.SDK_INT: 23
    Build.MANUFACTURER: LGE
    LeakCanary version: 2.2
    Analysis duration: 75543 ms
    Heap dump file path: /storage/emulated/0/Download/leakcanary-com.colevit.furmate/2020-04-25_23-53-20_181.hprof
    Heap dump timestamp: 1587839082676
    

    Steps to Reproduce

    hprof: 2020-04-25_23-53-20_181.hprof.zip

    Expected behavior: It should analyse the heap and show leak trace with de-obfuscated names.

    Version Information

    • LeakCanary version: 2.2
    • Android OS version: 23
    • Gradle version: 5.6.4
    • Android Gradle plugin version: 3.5.3

    Additional Information

    This is tested on a release build though I also tested on debug build as well with code obfuscation and it failed.

    type: bug 
    opened by Guneetgstar 36
  •  Unable to get provider leakcanary.internal.LeakCanaryFileProvider

    Unable to get provider leakcanary.internal.LeakCanaryFileProvider

    Error message:

    E/AndroidRuntime: FATAL EXCEPTION: main
        Process: com.xincaidong.truemerger, PID: 29219
        java.lang.RuntimeException: Unable to get provider leakcanary.internal.LeakCanaryFileProvider: java.lang.ClassNotFoundException: Didn't find class "leakcanary.internal.LeakCanaryFileProvider" on path: DexPathList[[zip file "/data/app/com.xincaidong.truemerger-dH6uDnSLWeCztjnKidrcTA==/base.apk"],nativeLibraryDirectories=[/data/app/com.xincaidong.truemerger-dH6uDnSLWeCztjnKidrcTA==/lib/arm64, /data/app/com.xincaidong.truemerger-dH6uDnSLWeCztjnKidrcTA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
            at android.app.ActivityThread.installProvider(ActivityThread.java:6542)
            at android.app.ActivityThread.installContentProviders(ActivityThread.java:6030)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5936)
            at android.app.ActivityThread.access$1200(ActivityThread.java:200)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1673)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:201)
            at android.app.ActivityThread.main(ActivityThread.java:6815)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
         Caused by: java.lang.ClassNotFoundException: Didn't find class "leakcanary.internal.LeakCanaryFileProvider" on path: DexPathList[[zip file "/data/app/com.xincaidong.truemerger-dH6uDnSLWeCztjnKidrcTA==/base.apk"],nativeLibraryDirectories=[/data/app/com.xincaidong.truemerger-dH6uDnSLWeCztjnKidrcTA==/lib/arm64, /data/app/com.xincaidong.truemerger-dH6uDnSLWeCztjnKidrcTA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:171)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
            at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:121)
            at androidx.core.app.CoreComponentFactory.instantiateProvider(CoreComponentFactory.java:60)
            at android.app.ActivityThread.installProvider(ActivityThread.java:6526)
            at android.app.ActivityThread.installContentProviders(ActivityThread.java:6030) 
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5936) 
            at android.app.ActivityThread.access$1200(ActivityThread.java:200) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1673) 
            at android.os.Handler.dispatchMessage(Handler.java:106) 
            at android.os.Looper.loop(Looper.java:201) 
            at android.app.ActivityThread.main(ActivityThread.java:6815) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873) 
    

    Dependency:

    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-3'
    

    不集成的时候,都是可以运行的,一集成之后就跑不了。项目是使用了AndroidX的,语言是java

    Edit with translation from Google translate:

    When it is not integrated, it can be run, and it cannot run after integration. The project uses AndroidX and the language is java

    type: bug 
    opened by CaiJinFu 34
  • LeakCanary in Unit Test Artifact

    LeakCanary in Unit Test Artifact

    Hi.

    I got NPE when i run test using Unit Test build variants. Do you have any best practice to do this ?

    java.lang.NullPointerException
        at com.squareup.leakcanary.internal.LeakCanaryInternals.isInServiceProcess(LeakCanaryInternals.java:130)
        at com.squareup.leakcanary.LeakCanary.isInAnalyzerProcess(LeakCanary.java:146)
        at com.squareup.leakcanary.LeakCanary.install(LeakCanary.java:48)
        at com.squareup.leakcanary.LeakCanary.install(LeakCanary.java:37)
        at com.vidio.android.VidioApplication.onCreate(VidioApplication.java:18)
        at org.robolectric.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:131)
        at org.robolectric.RobolectricTestRunner.setUpApplicationState(RobolectricTestRunner.java:431)
        at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:224)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:168)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
        at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
        at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    

    Is it caused by multiple flavour on release ?

    type: documentation 
    opened by linggom 33
  • ViewGroup.ViewLocationHolder leak in Android P

    ViewGroup.ViewLocationHolder leak in Android P

    I'm testing my app with the new leak canary and on different devices (as well as virtual devices). everything looks fine on all devices except one device which is the only one running Android 8. the analyzing process looks fine but whenever it finishes it shows a few leaks (which other devices won't show!).

    every time I check the trace I end up either with ReportFragment or InputMethodManager.

    is anything actually leaking? is this an excluded leak?

    thanks in advance

    photo_2018-08-06_10-16-39

    type: leak 
    opened by seyedjafariy 31
  • LeakCanary 1.5.2 and 1.6-Snapshot causing build failure

    LeakCanary 1.5.2 and 1.6-Snapshot causing build failure

    Got error like this below with LeakCanary 1.5.2 and 1.6-Snapshot. However, 1.5.1 is fine. The build is ran with Jenkins, it is always a clean build.

    I am using android gradle plugin 2.3.3: classpath 'com.android.tools.build:gradle:2.3.3'

    :app:transformClassesWithDexForArm7Debug FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:transformClassesWithDexForArm7Debug'.
    > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/squareup/leakcanary/watcher/R;
    
    * Try:
    Run with --info or --debug option to get more log output.
    
    * Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexForArm7Debug'.
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
    	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:242)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:95)
    	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:235)
    	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:224)
    	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:121)
    	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:77)
    	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:102)
    	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:96)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:612)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:567)
    	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:96)
    	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:57)
    	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:122)
    	at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    	at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    	at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    	at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:46)
    	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    	at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:253)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:95)
    	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:170)
    	at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:44)
    	at org.gradle.initialization.DefaultGradleLauncher$1.run(DefaultGradleLauncher.java:122)
    	at org.gradle.internal.work.DefaultWorkerLeaseService$2.execute(DefaultWorkerLeaseService.java:124)
    	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:116)
    	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:99)
    	at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66)
    	at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    	at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    	at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    	at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:95)
    	at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
    	at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
    	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:44)
    	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    	at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
    	at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
    	at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:51)
    	at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
    	at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
    	at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
    	at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64)
    	at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:29)
    	at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
    	at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:42)
    	at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:50)
    	at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
    	at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
    	at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)
    	at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:287)
    	at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:260)
    	at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:33)
    	at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    	at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    	at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    	at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:253)
    	at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:182)
    	at org.gradle.launcher.Main.doAction(Main.java:33)
    	at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    	at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
    	at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
    	at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    	at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:31)
    	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
    	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
    Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/squareup/leakcanary/watcher/R;
    	at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
    	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
    	at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:176)
    	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:168)
    	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
    	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
    	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:95)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    	... 87 more
    Caused by: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/squareup/leakcanary/watcher/R;
    	at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:453)
    	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:185)
    	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:181)
    	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
    	... 99 more
    Caused by: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/squareup/leakcanary/watcher/R;
    	at com.android.builder.core.DexByteCodeConverter.dexInProcess(DexByteCodeConverter.java:180)
    	at com.android.builder.core.DexByteCodeConverter.runDexer(DexByteCodeConverter.java:158)
    	at com.android.builder.core.DexByteCodeConverter.convertByteCode(DexByteCodeConverter.java:143)
    	at com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1345)
    	at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:443)
    	... 102 more
    Caused by: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/squareup/leakcanary/watcher/R;
    	at com.android.builder.core.DexByteCodeConverter.dexInProcess(DexByteCodeConverter.java:178)
    	... 106 more
    Caused by: com.android.dex.DexException: Multiple dex files define Lcom/squareup/leakcanary/watcher/R;
    	at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:584)
    	at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:539)
    	at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:521)
    	at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:167)
    	at com.android.dx.merge.DexMerger.merge(DexMerger.java:191)
    	at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:522)
    	at com.android.dx.command.dexer.Main.runMonoDex(Main.java:344)
    	at com.android.dx.command.dexer.Main.run(Main.java:292)
    	at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
    	at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:174)
    
    
    opened by zwang 31
  • Leak analysis failed: OutOfMemoryError

    Leak analysis failed: OutOfMemoryError

    LeakCanary Version: 1.4-beta2

    
    * FAILURE:
    java.lang.OutOfMemoryError: Failed to allocate a 2807208 byte allocation with 2467638 free bytes and 2MB until OOM
        at com.squareup.haha.trove.TLongHashSet.rehash(TLongHashSet.java:162)
        at com.squareup.haha.trove.THash.postInsertHook(THash.java:283)
        at com.squareup.haha.trove.TLongHashSet.add(TLongHashSet.java:146)
        at com.squareup.haha.perflib.analysis.TopologicalSort$TopologicalSortVisitor.doVisit(TopologicalSort.java:91)
        at com.squareup.haha.perflib.analysis.TopologicalSort.compute(TopologicalSort.java:36)
        at com.squareup.haha.perflib.Snapshot.computeDominators(Snapshot.java:311)
        at com.squareup.leakcanary.HeapAnalyzer.findLeakTrace(HeapAnalyzer.java:157)
        at com.squareup.leakcanary.HeapAnalyzer.checkForLeak(HeapAnalyzer.java:91)
        at com.squareup.leakcanary.internal.HeapAnalyzerService.onHandleIntent(HeapAnalyzerService.java:58)
        at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
    
    
    opened by jamesbluecrow 30
  • Could not dump heap, previous analysis still is in progress.

    Could not dump heap, previous analysis still is in progress.

    More than ten minutes. Android Studio 3.0.1, Android 5.1.1 or 7.1.1 .

    public class MyApplication extends Application {
        private RefWatcher refWatcher;
    
        @Override
        public void onCreate() {
            super.onCreate();
            if (LeakCanary.isInAnalyzerProcess(this)) {
                // This process is dedicated to LeakCanary for heap analysis.
                // You should not init your app in this process.
                return;
            }
            refWatcher=LeakCanary.install(this);
        }
    
        public static RefWatcher getRefWatcher(Context context){
            MyApplication myApplication= (MyApplication) context.getApplicationContext();
            return myApplication.refWatcher;
        }
    }
    

    in Activity class

       @Override
        protected void onDestroy() {
            super.onDestroy();
            MyApplication.getRefWatcher(getApplicationContext()).watch(Main2Activity.this);
        }
    
    opened by a442509097 29
  • DecorContext  PhoneWindow Leak

    DecorContext PhoneWindow Leak

    HEAP ANALYSIS RESULT ==================================== 1 APPLICATION LEAKS

                                                                                                    References underlined with "~~~" are likely causes.
                                                                                                    Learn more at https://squ.re/leaks.
                                                                                                    
                                                                                                    54448 bytes retained by leaking objects
                                                                                                    Signature: e7fdf9fb8cb43da97514e61c70c99cb2a8e9fe0
                                                                                                    ┬───
                                                                                                    │ GC Root: System class
                                                                                                    │
                                                                                                    ├─ com.mediatek.boostfwk.identify.scroll.ScrollIdentify class
                                                                                                    │    Leaking: NO (a class is never leaking)
                                                                                                    │    ↓ static ScrollIdentify.mContext
                                                                                                    │                            ~~~~~~~~
                                                                                                    ├─ com.android.internal.policy.DecorContext instance
                                                                                                    │    Leaking: YES (DecorContext wraps an Activity with Activity.mDestroyed true)
                                                                                                    │    ↓ DecorContext.mPhoneWindow
                                                                                                    ├─ com.android.internal.policy.PhoneWindow instance
                                                                                                    │    Leaking: YES (DecorContext↑ is leaking and Window#mDestroyed is true)
                                                                                                    │    ↓ PhoneWindow.mCallback
                                                                                                    ╰→ com.tal.imonkey.business.launch.activity.LauncherPrivacyActivity instance
                                                                                                    ​     Leaking: YES (ObjectWatcher was watching this because com.tal.imonkey.business.launch.activity.LauncherPrivacyActivity received Activity#onDestroy() callback and Activity#mDestroyed is true)
                                                                                                    ​     key = 3e9c8447-158e-420d-ba64-7ff8f4a148f8
                                                                                                    ​     watchDurationMillis = 5302
                                                                                                    ​     retainedDurationMillis = 301
                                                                                                    ====================================
                                                                                                    0 LIBRARY LEAKS
                                                                                                    
                                                                                                    A Library Leak is a leak caused by a known bug in 3rd party code that you do not have control over.
                                                                                                    See https://square.github.io/leakcanary/fundamentals-how-leakcanary-works/#4-categorizing-leaks
                                                                                                    ====================================
                                                                                                    METADATA
    
    type: leak 
    opened by tianshaokai 0
  • 1.run

    1.run

    Description

    [Description of the issue]

    Steps to Reproduce

    [Provide a sample project, a .hprof file or a failing test]

    1. [First Step]
    2. [Second Step]
    3. [and so on...]

    Expected behavior: [What you expect to happen]

    Version Information

    • LeakCanary version:
    • Android OS version:
    • Gradle version:

    Additional Information

    Any additional information, configuration or data that might be necessary to reproduce the issue.

    type: bug 
    opened by CATBEEF1 0
  • Force Heap dump in tests to allow heap analysis

    Force Heap dump in tests to allow heap analysis

    Problem description

    We are using heap dumps in instrumentation tests using InstrumentationLeakDetector.detectLeaks(). The idea is to leverage the heap dump analysis at the end and validate if there's an additional heap size / bitmap count etc. detected, to watchout for any potential memory regressions.

    However the logic to get a heap dump trigger is tied to the fact whether a leak was found or could be found.

    In many cases the heap dump doesn't get triggered because there are no objects with a weak reference after a GC etc. Even in those cases when there's no leak, we could still have a memory regression and would like to do a heap analysis.

    Potential solutions

    • Allow a way to force trigger heap analysis from tests.

    Additional information

    type: enhancement 
    opened by sahil2441 0
  • Update POM name for display friendliness

    Update POM name for display friendliness

    Not sure if this is intentional or not - so please feel free to close

    Consumers of https://github.com/cashapp/licensee will be displaying this as the artifact name in OSS attribution pages

        {
            "groupId": "com.squareup.leakcanary",
            "artifactId": "plumber-android-core",
            "version": "2.9.1",
            "name": "Use Plumber Android to fix known leaks in the Android Framework and other Google Android libraries.",
            "spdxLicenses": [
                {
                    "identifier": "Apache-2.0",
                    "name": "Apache License 2.0",
                    "url": "https://www.apache.org/licenses/LICENSE-2.0"
                }
            ],
            "scm": {
                "url": "https://github.com/square/leakcanary/"
            }
        }
    

    Trying for consistency to match leakcanary-android-core

    Shoutout to @hopewm for actually noticing this in our application 🙇

    opened by justintuchek 2
  • WakeLock / PowerManager leaking Service

    WakeLock / PowerManager leaking Service

    https://issuetracker.google.com/issues/260459152

    ┬───
    │ GC Root: System class
    │
    ├─ com.android.tools.profiler.support.energy.WakeLockWrapper class
    │    Leaking: NO (a class is never leaking)
    │    ↓ static WakeLockWrapper.eventIdMap
    │                             ~~~~~~~~~~
    ├─ java.util.HashMap instance
    │    Leaking: UNKNOWN
    │    Retaining 176 B in 5 objects
    │    ↓ HashMap[key()]
    │             ~~~~~~~
    ├─ android.os.PowerManager$WakeLock instance
    │    Leaking: UNKNOWN
    │    Retaining 3,1 kB in 58 objects
    │    ↓ PowerManager$WakeLock.this$0
    │                            ~~~~~~
    ├─ android.os.PowerManager instance
    │    Leaking: UNKNOWN
    │    Retaining 3,0 kB in 55 objects
    │    mContext instance of com.vanniktech.meditationtimer.MeditationTimerBackgroundService
    │    ↓ PowerManager.mContext
    │                   ~~~~~~~~
    ╰→ com.vanniktech.meditationtimer.MeditationTimerBackgroundService instance
    ​     Leaking: YES (ObjectWatcher was watching this because com.vanniktech.meditationtimer.
    ​     MeditationTimerBackgroundService received Service#onDestroy() callback and Service not held by ActivityThread)
    ​     Retaining 2,4 kB in 40 objects
    ​     key = 37eaefd5-67fa-4142-94a8-cc872a9710ea
    ​     watchDurationMillis = 5349
    ​     retainedDurationMillis = 348
    ​     mApplication instance of com.vanniktech.meditationtimer.MeditationTimerApplication
    ​     mBase instance of android.app.ContextImpl
    
    METADATA
    
    Build.VERSION.SDK_INT: 33
    Build.MANUFACTURER: Google
    LeakCanary version: 2.10
    App process name: com.vanniktech.meditationtimer
    Class count: 33030
    Instance count: 236808
    Primitive array count: 156415
    Object array count: 34886
    Thread count: 82
    Heap total bytes: 34448465
    Bitmap count: 5
    Bitmap total bytes: 51147
    Large bitmap count: 0
    Large bitmap total bytes: 0
    Db 1: open /data/user/0/com.vanniktech.meditationtimer/databases/com.google.android.datatransport.events
    Db 2: open /data/user/0/com.vanniktech.meditationtimer/databases/MeditationTimer.db
    Db 3: open /data/user/0/com.vanniktech.meditationtimer/no_backup/androidx.work.workdb
    Stats: LruCache[maxSize=3000,hits=131137,misses=237111,hitRate=35%]
    RandomAccess[bytes=11920280,reads=237111,travel=105749540601,range=40253671,size=49542614]
    Analysis duration: 5704 ms
    
    type: leak 
    opened by vanniktech 1
  • AppCompatDelegate.setApplicationLocales leaks

    AppCompatDelegate.setApplicationLocales leaks

    https://issuetracker.google.com/issues/260322829

    ┬───
    │ GC Root: Thread object
    │
    ├─ Wj instance
    │    Leaking: NO (PathClassLoader↓ is not leaking)
    │    Thread name: 'CleanupReference'
    │    ↓ Thread.contextClassLoader
    ├─ dalvik.system.PathClassLoader instance
    │    Leaking: NO (AppCompatDelegate↓ is not leaking and A ClassLoader is never leaking)
    │    ↓ ClassLoader.runtimeInternalObjects
    ├─ java.lang.Object[] array
    │    Leaking: NO (AppCompatDelegate↓ is not leaking)
    │    ↓ Object[1481]
    ├─ androidx.appcompat.app.AppCompatDelegate class
    │    Leaking: NO (a class is never leaking)
    │    ↓ static AppCompatDelegate.sAppContext
    │                               ~~~~~~~~~~~
    ╰→ com.vanniktech.fitness.FitnessSettingsActivity instance
    ​     Leaking: YES (ObjectWatcher was watching this because com.vanniktech.fitness.FitnessSettingsActivity received
    ​     Activity#onDestroy() callback and Activity#mDestroyed is true)
    ​     Retaining 848,3 kB in 15206 objects
    ​     key = 0606749c-99c5-49e1-92e6-4b202016155e
    ​     watchDurationMillis = 7828
    ​     retainedDurationMillis = 2828
    ​     mApplication instance of com.vanniktech.fitness.FitnessApplication
    ​     mBase instance of androidx.appcompat.view.ContextThemeWrapper
    
    METADATA
    
    Build.VERSION.SDK_INT: 33
    Build.MANUFACTURER: Google
    LeakCanary version: 2.10
    App process name: com.vanniktech.fitness
    Class count: 28874
    Instance count: 256902
    Primitive array count: 149983
    Object array count: 34016
    Thread count: 56
    Heap total bytes: 32140731
    Bitmap count: 1
    Bitmap total bytes: 1025
    Large bitmap count: 0
    Large bitmap total bytes: 0
    Db 1: open /data/user/0/com.vanniktech.fitness/databases/Fitness.db
    Db 2: open /data/user/0/com.vanniktech.fitness/databases/com.google.android.datatransport.events
    Db 3: open /data/user/0/com.vanniktech.fitness/no_backup/androidx.work.workdb
    Stats: LruCache[maxSize=3000,hits=131144,misses=242840,hitRate=35%]
    RandomAccess[bytes=12699335,reads=242840,travel=106498425917,range=39035479,size=46940953]
    Analysis duration: 6511 ms
    
    type: leak 
    opened by vanniktech 1
Releases(v2.10)
An app performance monitor(APM) , like "Android Studio profiler", you can easily monitor the performance of your app real time in browser

AndroidGodEye English README.md 中文 README_zh.md Android developer lack of monitoring of performance data,especially in production environment. so we n

AndroidKy 2.5k Dec 29, 2022
Android TextView with rich support of compound drawables

TextViewRichDrawable This is a tiny library which empowers TextView's (and its inheritors) compound drawables with size specifying, vector support and

Oleksandr Tolstykh 135 Nov 29, 2022
A simple plugin to patch the memory leak in Kotlin Gradle Plugin 1.5.0

kgp-150-leak-patcher A simple plugin to automatically patch the memory leak in Kotlin Gradle Plugin 1.5.0 in https://youtrack.jetbrains.com/issue/KT-4

Zac Sweers 40 Dec 20, 2021
Reproducible sample with Fix for Memory Leak in RecyclerView Adapter

Memory Leak RecyclerView Adapter Reproducible Sample with Fix Video Instructions: https://www.youtube.com/c/awesomedevnotes Code Only the relevant and

Awesome Dev Notes | Android Dev Notes YouTube 7 Jun 7, 2022
☯️Sophisticated and cool intro with Material Motion Animations(No more viewpager transformer or Memory leak)

Material Intro Sophisticated and cool intro with Material Motion Animations. Who's using Material Intro? ?? Check out who's using Material Intro Inclu

Ranbir Singh 34 Sep 8, 2022
Glide Bitmap Pool is a memory management library for reusing the bitmap memory

Glide Bitmap Pool About Glide Bitmap Pool Glide Bitmap Pool is a memory management library for reusing the bitmap memory. As it reuses bitmap memory ,

AMIT SHEKHAR 573 Dec 31, 2022
A sample project in Kotlin to demonstrate AndroidX, MVVM, Coroutines, Hilt, Room, Data Binding, View Binding, Retrofit, Moshi, Leak Canary and Repository pattern.

This repository contains a sample project in Kotlin to demonstrate AndroidX, MVVM, Coroutines, Hilt, Room, Data Binding, View Binding, Retrofit, Moshi, Leak Canary and Repository pattern

Areg Petrosyan 42 Dec 23, 2022
A sample project in Kotlin to demonstrate Jetpack Compose, MVVM, Coroutines, Hilt, Room, Coil, Retrofit, Moshi, Leak Canary and Repository pattern

Jetpack-Compose-Boilerplate This repository contains a sample project in Kotlin to demonstrate Jetpack Compose, MVVM, Coroutines, Hilt, Room, Coil, Re

Areg Petrosyan 14 Dec 12, 2022
With Viola android face detection library, you can detect faces in a bitmap, crop faces using predefined algorithm and get additional information from the detected faces.

Viola Viola android face detection library detects faces automatically from a bitmap, crop faces using the predefined algorithms, and provides supplem

Darwin Francis 58 Nov 1, 2022
Android device shake detection.

Seismic Android device shake detection. Download Download the latest .jar or depend via Maven: <dependency> <groupId>com.squareup</groupId> <artif

Square 1.2k Dec 27, 2022
[Android] Screenshot detection while user using your app

[Android] Screenshot detection while user using your app

Akexorcist 137 Dec 30, 2022
An Android project containing image recognition and object detection models.

An Android project containing image recognition and object detection models. Users can input images into the deep learning model by taking photos, opening photo albums, and real-time previews on the Android side. After the calculation on the Android side is completed, the model will output the prediction result and show it to the user.

null 7 Nov 27, 2022
TensorFlow Lite Object Detection Android Demo

GSoC Project 2021 - TensorFlow Description This repository contains the project where I contributed to the TensorFlow Team during GSoC in the year 202

Sayan Nath 6 Dec 31, 2022
A sample project of implementing Liveness Detection and Identity OCR on Android app using Kredibel Vision SDK

Vision Sample (Android) A sample project of implementing Liveness Detection and Identity OCR on Android app using Kredibel Vision SDK. You can checkou

null 10 Nov 27, 2022
Based on Android + NodeMCU platform to achieve object detection and tracking, AI capabilities come from Google MLKit.

Based on Android + NodeMCU platform to achieve object detection and tracking, AI capabilities come from Google MLKit.

null 1 Apr 4, 2022
On-device wake word detection powered by deep learning.

Porcupine Made in Vancouver, Canada by Picovoice Porcupine is a highly-accurate and lightweight wake word engine. It enables building always-listening

Picovoice 2.8k Jan 5, 2023
This app using Mlkit along with the TensorFlow Lite model for object detection,

I built this app using Mlkit along with the TensorFlow Lite model for object detection, Arcore is used to place anchors to the detected objects. It's a good blend of Machine learning and Augmented reality to visualise ML information in a much better way than regular bounding boxes

Kashif Mehmood 18 Nov 10, 2022
On-device wake word detection powered by deep learning.

Porcupine Made in Vancouver, Canada by Picovoice Porcupine is a highly-accurate and lightweight wake word engine. It enables building always-listening

Picovoice 2.8k Dec 30, 2022
Web-based media manager with duplication detection, tagging, and more

reelchest ?? ??️ ??️ A basic web-based media manager. Download or upload clips,

Sebastian Aigner 7 Jan 3, 2022