Code Monkey home page Code Monkey logo

Comments (19)

pyricau avatar pyricau commented on May 13, 2024

Hi, thanks for the report.

What device and what Android API version?

from leakcanary.

chriszeng87 avatar chriszeng87 commented on May 13, 2024

Xiaomi 4, Android 4.4.4. I was wondering if it is my problem with the project settings. I configured main, main2, main3 to be library project, and main4 depends on them. It's strange that LeakCanary is found while DisplayLeakActivity class in the internal package is not found.

from leakcanary.

pyricau avatar pyricau commented on May 13, 2024

it's probably because you are depending on the no-op dependency, which has a few of the classes but not all (it's for prod, so it's lightweight)

from leakcanary.

chriszeng87 avatar chriszeng87 commented on May 13, 2024

No. After I commented the no-op project's class, the problem still reproduce. The crash is in this line:
LeakCanaryInternals class's setEnabled method: packageManager.setComponentEnabledSetting(component, newState, DONT_KILL_APP);

from leakcanary.

pyricau avatar pyricau commented on May 13, 2024

Yep. Sorry, I was tired. Your classpath seems just fine. However, it looks like it can't find the activity in the manifest.

Can you look at the merged final AndroidManifest.xml and see if DisplayLeakActivity is declared in there? We declare it in the library (disabled), so it should automatically be merged in your debug app.

from leakcanary.

pyricau avatar pyricau commented on May 13, 2024

Ping.

from leakcanary.

chriszeng87 avatar chriszeng87 commented on May 13, 2024

Sorry, I didn't find the "merged final AndroidManifest.xml". Here is my project settings http://pic.yupoo.com/sinaweibo3482288945_v/EEmvaQWc/5JVmO.png
ps. I imported all project with Android Studio's new feature: import from version control -> github.

from leakcanary.

pyricau avatar pyricau commented on May 13, 2024

Why don't try doing a normal git checkout of the repo, and then File > New > Import Project ?

from leakcanary.

chriszeng87 avatar chriszeng87 commented on May 13, 2024

OK, I'll try.

from leakcanary.

fistuk avatar fistuk commented on May 13, 2024

Hi, I have the same issue while integrating the library in my app.
Samsung s3 4.4.4

compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
    minSdkVersion 15
    targetSdkVersion 21
}

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

im using com.android.tools.build:gradle:1.2.3

from leakcanary.

pyricau avatar pyricau commented on May 13, 2024

@fistuk Can you check the final merged AndroidManifest.xml file in the APK and see if DisplayLeakActivity is declared in there?

Also, can you try adding this to your app manifest:

    <activity
        android:theme="@style/__LeakCanary.Base"
        android:name="com.squareup.leakcanary.internal.DisplayLeakActivity"
        android:enabled="false"
        android:label="@string/__leak_canary_display_activity_label"
        android:icon="@drawable/__leak_canary_icon"
        android:taskAffinity="com.squareup.leakcanary"
        >
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
    </activity>

from leakcanary.

fistuk avatar fistuk commented on May 13, 2024

The activity is not declared so i think there is a problem with manifest merging.
Adding the declaration manually fails as well:

Component class com.squareup.leakcanary.DisplayLeakService does not exist in ----------------------
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4469)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5139)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: Component class com.squareup.leakcanary.DisplayLeakService does not exist in ----------------------
at android.os.Parcel.readException(Parcel.java:1469)
at android.os.Parcel.readException(Parcel.java:1419)
at android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting(IPackageManager.java:2984)
at android.app.ApplicationPackageManager.setComponentEnabledSetting(ApplicationPackageManager.java:1326)
at com.squareup.leakcanary.LeakCanary.setEnabled(LeakCanary.java:195)
at com.squareup.leakcanary.ServiceHeapDumpListener.(ServiceHeapDumpListener.java:30)
at com.squareup.leakcanary.LeakCanary.install(LeakCanary.java:56)
at com.squareup.leakcanary.LeakCanary.install(LeakCanary.java:43)
at ------------------.onCreate(Autocad360Application.java:37)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4466)
            at android.app.ActivityThread.access$1500(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5139)
            at java.lang.reflect.Method.invokeNative(Native Method)

from leakcanary.

pyricau avatar pyricau commented on May 13, 2024

What if you add everything that's defined here:

https://github.com/square/leakcanary/blob/master/library/leakcanary-android/src/main/AndroidManifest.xml

from leakcanary.

fistuk avatar fistuk commented on May 13, 2024

Eventually i've noticed that we are overriding the merged manifest to take the app's one (tools:node="replace"). So everything is working great. Thanks for the help.

from leakcanary.

ngheungyu avatar ngheungyu commented on May 13, 2024

This is just for others who have the same problem.
I have (tools:node="replace") defined, adding everything from https://github.com/square/leakcanary/blob/master/library/leakcanary-android/src/main/AndroidManifest.xml would work

from leakcanary.

Yky avatar Yky commented on May 13, 2024

I still have this problem. @pyricau Your link to https://github.com/square/leakcanary/blob/master/library/leakcanary-android/src/main/AndroidManifest.xml is broken. Could you please repaste it?

from leakcanary.

pyricau avatar pyricau commented on May 13, 2024

https://github.com/square/leakcanary/blob/master/leakcanary-android/src/main/AndroidManifest.xml

from leakcanary.

lawloretienne avatar lawloretienne commented on May 13, 2024

I still don't understand what the fix for this is. I am getting the error :
DisplayLeakActivity} does not exist.

The question was asked here :
http://stackoverflow.com/questions/37909067/displayleakactivity-does-not-exist

from leakcanary.

dreamlzj avatar dreamlzj commented on May 13, 2024

Import the source code of LeakCanary to your project, don't use dependency.If it doesn't work, reboot your machine.

from leakcanary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.