Hey guys,
No matter what I do, I receive the error "Please grant external storage permissions, otherwise memory leaks will not be detected." and receive no memory leak errors.
1) I've given access to these permissions in the Manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
2) I've requested permission just to make sure:
ActivityCompat.requestPermissions(this,
arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE),
1)
3) I've manually checked permissions in the App Info, and made sure that Storage was toggled on.
4) I've tapped on the LeakCanary notification.
5) I'm using "Run", since I read that LeakCanary cannot work with debugger attached.
6) I'm running LeakCanary.install(this) in my App subclass onCreate method.
Despite all of this, whether on the simulator or a real device, it will NOT give me memory leak logs, and will always give me the error.
Is there anything else I might be missing here?
However, I will say that one random run on the simulator gave me memory leak logs. But it only happened once and I didn't seemingly change anything with my setup. Now it's back to giving me that error. This only somehow worked once in the middle of a million different tries.
Can you check out the sample project and see if you can reproduce?
Got the same now on my device, just to confirm the problem.
Will try to investigate
Maybe RequestStoragePermissionActivity should use ContextCompat?
Could you record a video of the sample app and show what's happens when you grant permission and then try again in the sample app?
Would also need details on the Android version, device, etc.
Closing as we did not get more info.
I had a very similar issue. This isn't a bug in leakcanary.
Check your merged manifest to make sure your app or a library doesn't have WRITE_EXTERNAL_STORAGE with android:maxSdkVersion.
To override the android:maxSdkVersion you can use the following:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>.
Most helpful comment
I had a very similar issue. This isn't a bug in leakcanary.
Check your merged manifest to make sure your app or a library doesn't have
WRITE_EXTERNAL_STORAGEwithandroid:maxSdkVersion.To override the
android:maxSdkVersionyou can use the following:<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>.