Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DisplayLeakActivity does not exist

Since a while I have problems with LeakCanary (I think since Android Studio 2.2 but not sure)

I added it with this dependencies

 dependencies {
   debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
   releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
   testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
 }

When I click on the play button in Android Studio I get this error message:

$ adb shell am start -n "com.example.debug/com.squareup.leakcanary.internal.DisplayLeakActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.example.debug/com.squareup.leakcanary.internal.DisplayLeakActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.debug/com.squareup.leakcanary.internal.DisplayLeakActivity }
Error type 3
Error: Activity class {com.example.debug/com.squareup.leakcanary.internal.DisplayLeakActivity} does not exist.

Error while Launching activity

But when I open the apk file with ClassyShark I can see that the activity is there.

enter image description here

Whats going wrong?

like image 555
Ralph Bergmann Avatar asked Jun 19 '16 15:06

Ralph Bergmann


1 Answers

This happens to me when I try to enable LeakCanary in my app.

Somehow in my Manifest I defined:

<application
    android:name="sg.swiftninja.DriverApplication"
    android:allowBackup="false"
    tools:node="replace"  // <-- THIS
    android:label="@string/app_name"
    android:theme="@style/AppTheme">

I think the problem is with tools:node="replace" in my application tag.

I fixed this by replacing:

tools:node="replace" 

with

tools:replace="android:allowBackup" // or whatever nodes like this tools:replace="icon, label"

Or simply remove the line if you don't need it. Hope this helps!

like image 164
Jiyeh Avatar answered Nov 20 '22 10:11

Jiyeh