### ProGuard Rules for Keeping Android View Setters and Getters Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt Maintains `set*` and `get*` methods in `android.view.View` subclasses. This is essential for Android animations, data binding, and other framework features that rely on reflection to access or modify view properties. ```ProGuard -keepclassmembers public class * extends android.view.View { void set*(***); *** get*(); } ``` -------------------------------- ### ProGuard General Optimization and Configuration Flags Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt Defines global ProGuard settings, including optimization levels, access modification allowance, and preverification disabling, as recommended by Android SDK. These flags help fine-tune the obfuscation process while mitigating known compatibility issues with Dalvik. ```ProGuard -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* -optimizationpasses 5 -allowaccessmodification -dontpreverify ``` -------------------------------- ### ProGuard Configuration for Gson Library (Commented) Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt A commented-out section providing recommended ProGuard rules for the Gson library. These rules ensure that generic type information, which Gson relies on for serialization and deserialization, is preserved during obfuscation. ```ProGuard ##---------------Begin: proguard configuration for Gson ---------- # Gson uses generic type information stored in a class file when working with fields. Proguard # removes such information by default, so configure it to keep all of it. #-keep class com.google.gson.** { *; } # Gson specific classes #-keep class sun.misc.Unsafe { *; } #-keep class com.google.gson.stream.** { *; } # Application classes that will be serialized/deserialized over Gson #-keep class com.google.gson.examples.android.model.** { *; } ##---------------End: proguard configuration for Gson ---------- ``` -------------------------------- ### Basic CRUD Operations with LiteOrm Source: https://github.com/litesuits/android-lite-orm/blob/master/README-en.md Demonstrates the extreme simplicity of LiteOrm for basic database operations like saving, querying, and deleting objects, often achievable with a single line of code. ```Java db.save(u); db.query(U.class); db.deleteAll(U.class); ``` -------------------------------- ### ProGuard Debugging Attributes (SourceFile, LineNumberTable) Source: https://github.com/litesuits/android-lite-orm/blob/master/library/proguard-android-optimize.txt Shows how to configure ProGuard to keep source file names and line numbers for debugging purposes. This rule is typically commented out for release builds to reduce APK size. ```ProGuard #-keepattributes SourceFile,LineNumberTable ``` -------------------------------- ### General ProGuard Optimization and Access Rules Source: https://github.com/litesuits/android-lite-orm/blob/master/library/proguard-android-optimize.txt Defines optimization flags, number of passes, and allows access modification for the ProGuard process, while disabling preverification. ```ProGuard -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* -optimizationpasses 5 -allowaccessmodification -dontpreverify ``` -------------------------------- ### ProGuard Rule for Keeping Annotations, Signatures, and Exceptions Source: https://github.com/litesuits/android-lite-orm/blob/master/jars/proguard-jar-usage-jar使用和混淆注意.txt This ProGuard rule is crucial for ensuring that annotations, method signatures, and exception information are preserved during code obfuscation. This is often necessary for frameworks and libraries that rely on reflection or specific metadata at runtime, such as ORMs using annotations for mapping. ```ProGuard -keepattributes *Annotation*,Signature,Exceptions ``` -------------------------------- ### ProGuard Class Naming and Verbosity Settings Source: https://github.com/litesuits/android-lite-orm/blob/master/library/proguard-android-optimize.txt Configures ProGuard to not use mixed-case class names, not skip non-public library classes, and enables verbose output for detailed logging. ```ProGuard -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -verbose ``` -------------------------------- ### ProGuard Rules for Java Enumeration Classes Source: https://github.com/litesuits/android-lite-orm/blob/master/library/proguard-android-optimize.txt Provides specific ProGuard rules to correctly handle and preserve members of enumeration classes, as recommended by ProGuard documentation to avoid runtime issues. ```ProGuard -keepclassmembers enum * { **[] $VALUES; public *; } ``` -------------------------------- ### ProGuard Rules for Keeping Attributes and Licensing Services Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt Ensures that annotations and specific Google Play licensing services (`ILicensingService`) are not obfuscated or removed. This is crucial for app functionality, licensing checks, and proper reflection-based operations that rely on attribute metadata. ```ProGuard -keepattributes *Annotation* -keep public class com.google.vending.licensing.ILicensingService -keep public class com.android.vending.licensing.ILicensingService ``` -------------------------------- ### ProGuard Rule for Keeping Native Methods Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt Preserves native methods from obfuscation, which are typically implemented in C/C++ and linked via JNI. This rule ensures that the Java Native Interface can correctly locate and invoke these methods. ```ProGuard -keepclasseswithmembernames class * { native ; } ``` -------------------------------- ### ProGuard Rule for Keeping Android Activity onClick Methods Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt Retains public methods in `android.app.Activity` subclasses that accept an `android.view.View` parameter. This allows them to be referenced directly from XML `onClick` attributes, ensuring event handlers function correctly. ```ProGuard -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } ``` -------------------------------- ### ProGuard Rules for Keeping Essential Attributes Source: https://github.com/litesuits/android-lite-orm/blob/master/library/proguard-android-optimize.txt Specifies which attributes (like annotations, signatures, exceptions, and inner classes) should be preserved during obfuscation to maintain runtime functionality. ```ProGuard -keepattributes *Annotation*,Signature,Exceptions,InnerClasses ``` -------------------------------- ### ProGuard Rule for Suppressing Android Support Library Warnings Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt Disables warnings related to newer platform references within the Android Support Library when linking against older platform versions. These warnings are generally safe to ignore as the library handles compatibility internally. ```ProGuard -dontwarn android.support.** ``` -------------------------------- ### ProGuard Rule for Keeping Serializable Classes (Commented) Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt A commented-out rule demonstrating how to prevent obfuscation of classes implementing `java.io.Serializable`. This is often necessary for data models that need to be serialized and deserialized, as obfuscation can break the serialization contract. ```ProGuard #-keep class * implements java.io.Serializable { *; } ``` -------------------------------- ### ProGuard Rule for Keeping Android R Class Fields Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt Ensures that all static fields within Android's generated `R` classes (e.g., `R.id`, `R.layout`, `R.string`) are kept. This prevents issues with resource lookups and ensures that resource IDs remain consistent after obfuscation. ```ProGuard -keepclassmembers class **.R$* { public static ; } ``` -------------------------------- ### ProGuard Rules for Keeping LiteOrm Core Classes Source: https://github.com/litesuits/android-lite-orm/blob/master/library/proguard-android-optimize.txt Essential ProGuard rules to prevent obfuscation of critical LiteOrm library classes, ensuring the ORM functionality remains intact and accessible to the application. ```ProGuard -keep public class com.litesuits.orm.LiteOrm { *; } -keep public class com.litesuits.orm.db.* { *; } -keep public class com.litesuits.orm.db.model.** { *; } -keep public class com.litesuits.orm.db.annotation.** { *; } -keep public class com.litesuits.orm.db.enums.** { *; } -keep public class com.litesuits.orm.log.* { *; } -keep public class com.litesuits.orm.db.assit.* { *; } ``` -------------------------------- ### ProGuard Rule for Keeping Android Parcelable Creator Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt Preserves the `CREATOR` field for classes implementing `android.os.Parcelable`. This static field is necessary for the Android framework to correctly deserialize objects from a Parcel. ```ProGuard -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } ``` -------------------------------- ### ProGuard Rules for Keeping Enumeration Class Members Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt Ensures that the `values()` and `valueOf(String)` methods of enumeration classes are preserved. These methods are essential for their proper reflection and usage, especially when iterating over enum constants or converting string values to enum instances. ```ProGuard -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } ``` -------------------------------- ### ProGuard Rule for Keeping Signature Attribute Source: https://github.com/litesuits/android-lite-orm/blob/master/sample/proguard-android-optimize.txt Retains the `Signature` attribute in class files. This attribute is crucial for reflection and proper functioning of generic types and annotations, especially when using libraries that rely on them for type information. ```ProGuard -keepattributes Signature ``` -------------------------------- ### ProGuard Rule for Keeping Enum Class Members Source: https://github.com/litesuits/android-lite-orm/blob/master/jars/proguard-jar-usage-jar使用和混淆注意.txt This rule prevents the obfuscation of members within enumeration classes. It specifically targets the '$VALUES' array (which holds all enum instances) and all public members, ensuring that enums function correctly after obfuscation. This is a standard practice for robust ProGuard configurations involving enums. ```ProGuard -keepclassmembers enum * { **[] $VALUES; public *; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.