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

后端 未结 5 1455
独厮守ぢ
独厮守ぢ 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:41

    LeakCanary is not just a JAR - it contains not only the java code, but resources too (png's for example). If you are using ANT, then the only thing you can do is to include LeakCanary as a library project. But I strongly recommend switching to gradle. Because android development team is not going to support importing any library which is not just jar in any user-friendly way in the nearest future (because gradle is priority). And importing as library projects is a painful procedure, which get's more painful when it sometimes comes to including library's dependencies also as library projects. I've done it by hand long ago only because the client used eclipse with ant for big project for ages. Generally, you must do the following:

    1. Obtain sources: source code, assets, resources...
    2. Investigate LeakCanary's dependencies. You may look "POM Object Model" here.
    3. For dependencies, which have more than just java code, you'll need to include them as library again. For others, just download them as jar.
    4. For assets (fonts, for example) there are an extra step: you must copy them to the project you are working on or you'll get a resource not found exception.
    5. The final step is to enable manifest merger. Add the following line to project.properties of your project:

      manifestmerger.enabled=true

    It is done to merge all the AndroidManifest.xml from library project into final apk.

提交回复
热议问题