how to use leakcanary, how to add leakcanary as a jar to build a apk with .mk file

后端 未结 5 1487
独厮守ぢ
独厮守ぢ 2021-01-18 02:07

LeakCanary is a memory leak detection library for Android and Java. LeakCanary

My project is based on android make file system, which relies on some android internal

5条回答
  •  耶瑟儿~
    2021-01-18 02:30

    This answer is probably too late for you, but it might help others. It is possible to add more projects exposed through gradle in a regular project as jar files.

    Gradle is just a build tool. These java libraries that you need a still bunch of jar files at the end of the day. So what I do is the following ...

    1. Install Android Studio if that's not already the case.
    2. Create a gradle based project in which you can simple add the dependencies you need.
    3. Sync the project so that it process the gradle file and updates the external libraries.
    4. In the project explorer, find and expand "External Libraries" and you will find your jar files.
    5. Copy the jar files wherever you need to have them in other project and voila.

    I have done this to import the whole or sometimes parts of the Google Play library, and many other libraries. In fact, it's a common practice for me.

    Now, as Deepscorn mentionned it, I notice that LeakCanary has some res/ folders obviously containing Android resources ... and I badly need to include LeakCanary in Titanium SDK right now. So I am going to proceed the same way, but this time, I will add the resources in the titanium project's resources folder and see what happens.

    Resources all end up being included and being available in the entire project. I am not away of scoping in android resources. You just to R... or ...getIdentifier(...) to get them.

    You will also need to make sure that AndroidManifest entries are copied to an AndroidManifest file that will be compiled.

    I will post my results here if I have time. In the mean time, anyone can give this a try and post some feedback.

提交回复
热议问题