{"_id":"588861fa165af631008ee1ce","category":{"_id":"588861fa165af631008ee1bc","__v":0,"version":"588861fa165af631008ee1b8","project":"54861bb654b3ce0b00367292","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-09-11T08:50:30.403Z","from_sync":false,"order":3,"slug":"android-essentials-kit","title":"Android / Essentials KIt"},"parentDoc":null,"version":{"_id":"588861fa165af631008ee1b8","__v":1,"project":"54861bb654b3ce0b00367292","createdAt":"2017-01-25T08:29:46.061Z","releaseDate":"2017-01-25T08:29:46.061Z","categories":["588861fa165af631008ee1b9","588861fa165af631008ee1ba","588861fa165af631008ee1bb","588861fa165af631008ee1bc","588861fa165af631008ee1bd","588861fa165af631008ee1be","588861fa165af631008ee1bf","588861fa165af631008ee1c0","588861fa165af631008ee1c1","588861fa165af631008ee1c2","588861fa165af631008ee1c3","588861fa165af631008ee1c4","588861fa165af631008ee1c5","588861fa165af631008ee1c6","588861fa165af631008ee1c7","588861fa165af631008ee1c8","588861fa165af631008ee1c9"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"5.0.0","version":"5.0"},"__v":1,"project":"54861bb654b3ce0b00367292","user":"54861b9f3681d914006992a4","updates":["59bf63b56cd06b0010911c7e"],"next":{"pages":[],"description":""},"createdAt":"2016-10-09T05:40:56.921Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":36,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"You can use elasticode without ProGuard\",\n  \"body\": \"But if you do, this document is for help you understand how to keep elasticode settings with your settings. If you want to learn how to use ProGuard with your app please follow this for example: https://developer.android.com/studio/build/shrink-code.html\"\n}\n[/block]\nIn order to run ProGuard on your app if you're using Elasticode SDK some steps should be done:\n1. Create lint.xml under project_path/gradle folder\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"lintOptions{\\n\\tlintConfig rootProject.file('gradle/lint.xml')\\n}\\n\\ndexOptions {\\n\\tpreDexLibraries = false\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nYou can read more about lint here: https://developer.android.com/studio/write/lint.html\n\n2. Add to your app:gradle next lines\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"lintOptions {\\n\\t\\tlintConfig rootProject.file('gradle/lint.xml')\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n3. Put this lines into your proguard-rules.pro\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"-injars libs\\n-keepattributes *Annotation*, InnerClasses, Exceptions, Signature\\n-keepattributes EnclosingMethod\\n-keepattributes SourceFile,LineNumberTable\\n-keep public class * extends java.lang.Exception\\n\\n# Keep Elasticode SDK libs \\n-dontwarn retrofit2.**\\n-keep class retrofit2.** { *; }\\n\\n-keep class com.squareup.picasso.** { *; }\\n-dontwarn com.squareup.picasso.**\\n-keep class com.squareup.picasso.LruCache { *; }\\n-dontwarn com.squareup.picasso.LruCache\\n\\n-dontwarn com.google.gson.**\\n-keep class com.google.gson.** { *; }\\n-keep class sun.misc.Unsafe { *; }\\n-keep class com.google.gson.stream.** { *; }\\n\\n-dontwarn okio.**\\n-keep class okio.** { *; }\\n-dontwarn okhttp3.**\\n-keep class okhttp3.** { *; }\\n\\n-dontwarn com.jakewharton.picasso.**\\n-keep class com.jakewharton.picasso.** { *; }\\n\\n# Keep SDK\\n-keep class com.elasticode.network.** { *; }\\n-dontwarn com.elasticode.network.**\\n-keep class com.elasticode.provider.** { *; }\\n-dontwarn com.elasticode.provider.**\\n-keep class com.elasticode.model.** { *; }\\n-dontwarn com.elasticode.model.**\\n-keep class com.elasticode.utils.** { *; }\\n-dontwarn com.elasticode.utils.**\\n-keep class com.elasticode.view.** { *; }\\n-dontwarn com.elasticode.view.**\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n4. Don't forget to keep your own classes and libs","excerpt":"","slug":"prepare-your-app-for-proguard","type":"basic","title":"Prepare your app for ProGuard"}

Prepare your app for ProGuard


[block:callout] { "type": "info", "title": "You can use elasticode without ProGuard", "body": "But if you do, this document is for help you understand how to keep elasticode settings with your settings. If you want to learn how to use ProGuard with your app please follow this for example: https://developer.android.com/studio/build/shrink-code.html" } [/block] In order to run ProGuard on your app if you're using Elasticode SDK some steps should be done: 1. Create lint.xml under project_path/gradle folder [block:code] { "codes": [ { "code": "lintOptions{\n\tlintConfig rootProject.file('gradle/lint.xml')\n}\n\ndexOptions {\n\tpreDexLibraries = false\n}", "language": "json" } ] } [/block] You can read more about lint here: https://developer.android.com/studio/write/lint.html 2. Add to your app:gradle next lines [block:code] { "codes": [ { "code": "lintOptions {\n\t\tlintConfig rootProject.file('gradle/lint.xml')", "language": "json" } ] } [/block] 3. Put this lines into your proguard-rules.pro [block:code] { "codes": [ { "code": "-injars libs\n-keepattributes *Annotation*, InnerClasses, Exceptions, Signature\n-keepattributes EnclosingMethod\n-keepattributes SourceFile,LineNumberTable\n-keep public class * extends java.lang.Exception\n\n# Keep Elasticode SDK libs \n-dontwarn retrofit2.**\n-keep class retrofit2.** { *; }\n\n-keep class com.squareup.picasso.** { *; }\n-dontwarn com.squareup.picasso.**\n-keep class com.squareup.picasso.LruCache { *; }\n-dontwarn com.squareup.picasso.LruCache\n\n-dontwarn com.google.gson.**\n-keep class com.google.gson.** { *; }\n-keep class sun.misc.Unsafe { *; }\n-keep class com.google.gson.stream.** { *; }\n\n-dontwarn okio.**\n-keep class okio.** { *; }\n-dontwarn okhttp3.**\n-keep class okhttp3.** { *; }\n\n-dontwarn com.jakewharton.picasso.**\n-keep class com.jakewharton.picasso.** { *; }\n\n# Keep SDK\n-keep class com.elasticode.network.** { *; }\n-dontwarn com.elasticode.network.**\n-keep class com.elasticode.provider.** { *; }\n-dontwarn com.elasticode.provider.**\n-keep class com.elasticode.model.** { *; }\n-dontwarn com.elasticode.model.**\n-keep class com.elasticode.utils.** { *; }\n-dontwarn com.elasticode.utils.**\n-keep class com.elasticode.view.** { *; }\n-dontwarn com.elasticode.view.**", "language": "text" } ] } [/block] 4. Don't forget to keep your own classes and libs