# ${android_sdk}/tools/proguard/proguard-android.txt
# Understand the @Keep support annotation.
-keep class android.support.annotation.Keep
-keep @android.support.annotation.Keep class * {*;}
-keepclasseswithmembers class * {
@android.support.annotation.Keep ;
}
-keepclasseswithmembers class * {
@android.support.annotation.Keep ;
}
-keepclasseswithmembers class * {
@android.support.annotation.Keep (...);
}
// android/support/annotation/Keep.java
@Retention(CLASS)
@Target({PACKAGE,TYPE,ANNOTATION_TYPE,CONSTRUCTOR,METHOD,FIELD})
public @interface Keep {
}
File filters
Like general filters, a file filter is a comma-separated list of file names that can contain wildcards. Only files with matching file names are read (in the case of input jars), or written (in the case of output jars). The following wildcards are supported:
?
matches any single character in a file name.
*****
matches any part of a filename not containing the directory separator.
**
matches any part of a filename, possibly containing any number of directory separators.
For example, "java/**.class,javax/**.class" matches all class files in the java and javax.
Furthermore, a file name can be preceded by an exclamation mark '!' to exclude the file name from further attempts to match with subsequent file names.
For example, "!**.gif,images/**" matches all files in the images directory, except gif files.
Class specifications
A class specification is a template of classes and class members (fields and methods). It is used in the various -keep options and in the -assumenosideeffects option. The corresponding option is only applied to classes and class members that match the template.
The template was designed to look very Java-like, with some extensions for wildcards. To get a feel for the syntax, you should probably look at the examples, but this is an attempt at a complete formal definition:
[@annotationtype] [[!]public|final|abstract|@ ...] [!]interface|class|enum classname
[extends|implements [@annotationtype] classname]
[{
[@annotationtype] [[!]public|private|protected|static|volatile|transient ...] |
(fieldtype fieldname);
[@annotationtype] [[!]public|private|protected|static|synchronized|native|abstract|strictfp ...] |
(argumenttype,...) |
classname(argumenttype,...) |
(returntype methodname(argumenttype,...));
[@annotationtype] [[!]public|private|protected|static ... ] *;
...
}]
Square brackets "[ ]" mean that their contents are optional. Ellipsis dots "..." mean that any number of the preceding items may be specified. A vertical bar "|" delimits two alternatives. Non-bold parentheses "()" just group parts of the specification that belong together. The indentation tries to clarify the intended meaning, but white-space is irrelevant in actual configuration files.
The class keyword refers to any interface or class. The interface keyword restricts matches to interface classes. The enum keyword restricts matches to enumeration classes. Preceding the interface or enum keywords by a ! restricts matches to classes that are not interfaces or enumerations, respectively.
Every classname must be fully qualified, e.g. java.lang.String.Inner classes are separated by a dollar sign "$", e.g. java.lang.Thread$State
. Class names may be specified as regular expressions containing the following wildcards:
?
matches any single character in a class name, but not the package separator. For example, "com.example.Test?" matches "com.example.Test1" and "com.example.Test2", but not "com.example.Test12".
*****
matches any part of a class name not containing the package separator. For example, "com.example.*Test*" matches "com.example.Test" and "com.example.YourTestApplication", but not "com.example.mysubpackage.MyTest". Or, more generally, "com.example.*" matches all classes in "com.example", but not in its subpackages.
**
matches any part of a class name, possibly containing any number of package separators. For example, "**.Test" matches all Test classes in all packages except the root package. Or, "com.example.**" matches all classes in "com.example" and in its subpackages.
matches the n'th matched wildcard in the same option. For example, "com.example.*Foo<1>" matches "com.example.BarFooBar".
For additional flexibility, class names can actually be comma-separated lists of class names, with optional ! negators, just like file name filters. This notation doesn't look very Java-like, so it should be used with moderation.
For convenience and for backward compatibility, the class name * refers to any class, irrespective of its package.
Java編譯時根據調用該方法的類或對象所屬的類決定
class Base{ int x = 1; static int y = 2; } class Subclass extends Base{ int x = 4; i ...
4.Android 打包時出現的Android Export aborted because fatal error were founds [closed]
Android 程式開發完成後,如果要釋出到網際網路上供别人使用,就需要将自己的程式打包成Android 安裝封包件(Android Package,APK),其擴充名為.apk.使用run as 也能 ...
Android自定義屬性時TypedArray的使用方法
有時候android傳統的頁面布局不足以滿足我們的需求,常常需要自己定義view,通常繼承View,然後重寫構造方法以及onDraw等函數,再 具體實作自己定義的複雜view.我們知道在給控件賦屬性時 ...
記錄一次maven打包時将test目錄下的類打包到jar中,Maven Assembly Plugin的使用
今天有人問我打包後找不到主類,運作的類寫在test中.按照正常,test目錄下的檔案不會打包到jar包中.(但是我測試一個springboot工程就可以,這裡之後再研究) 具體解決如下 第一步:在po ...
Android studio運作時報錯,方法,類找不到,或者JVM記憶體溢出解決方案
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessExceptio ...
Android退出時關閉所有Activity的方法
Android退出時,有的Activity可能沒有被關閉.為了在Android退出時關閉所有的Activity,設計了以下的類: //關閉Activity的類 public class CloseAc ...
Android Studio 打包時 Signature Version 選擇V1還是V2 ?
隻勾選V2會導緻 7.0 以下的安卓機出現 INSTALL_PARSE_FAILED_NO_CERTIFICATES 的問題 ,推薦全選. 解決方案一v1和v2的簽名使用1)隻勾選v1簽名并不會影響什 ...
退出Android程式時清除所有activity的實作方法
思路: 1. 自定義ActivityList管理類,添加删除維護該list; 2.Activity Stack 類似上面: 3.singleTask定義一個Activity為該啟動模式,然後當傳回時, ...
随機推薦
#MySQL for Python(MySQLdb) Note
#MySQL for Python(MySQLdb) Note #切記不要在python中建立表,隻做增删改查即可. #步驟:(0)引用庫 -->(1)建立連接配接 -->(2)建立遊标 -- ...
ImageLoder配置以及使用(個人閱讀使用)
http://blog.csdn.net/vipzjyno1/article/details/23206387 在gradle添加: compile 'com.nostra13.universalim ...
【轉】正确了解PHP程式編譯時的錯誤資訊
我們編寫程式時,無論怎樣小心謹慎,犯錯總是在所難免的.這些錯誤通常會迷惑PHP編譯器.如果開發人員無法了解編譯器報錯資訊的含義,那麼這些錯誤資訊不僅毫無用處,還會常常讓人感到沮喪. 編譯PHP腳本時, ...
HA高可用配置
HA 即 (high available)高可用,又被叫做雙機熱備,用于關鍵性業務. 簡單了解就是,有兩台機器A和B,正常是A提供服務,B待命閑置,當A當機或服務宕掉,會切換至B機器繼續提供服務. 下 ...
C++指派函數詳解
指派函數 每個類隻有一個指派函數 由于并非所有的對象都會使用拷貝構造函數和指派函數,程式員可能對這兩個函數有些輕視. 1,如果不主動編寫拷貝構造函數和指派函數,編譯器将 ...
原子操作(atomic operation)
深入分析Volatile的實作原理 引言 在多線程并發程式設計中synchronized和Volatile都扮演着重要的角色,Volatile是輕量級的synchronized,它在多處理器開發中保證了共 ...
ER圖,以及轉化成關系模式
1.找出條件中的實體(矩形),屬性(橢圓),關系(菱形)關系分為1:1,1:N,M:N,列出ER圖 2. -1:1聯系的轉換方法 -兩個實體分别轉化為一個關系模式,屬性即是本來的屬性 -關系可以與任意 ...
python unittest 測試筆記(一)
測試最基本的原理就是比較預期結果是否與實際執行結果相同,如果相同則測試成功,否則測試失敗. python 單元測試官方文檔: [Python: 2.7] (https://docs.python.or ...
.28-淺析webpack源碼之compiler.resolvers
原本該在過WebpackOptionsApply時講解這個方法的,但是當時一不小心過掉了,是以在這裡補上. compiler.resolvers 該對象的三個方法均在WebpackOptionsApp ...
python相關的安裝軟體
本次安裝的系統是WINDOWS系統 一.python3.anaconda和python2 1.準備工具:python3.python2安裝包可以直接從官網下載下傳https://www.python.or ...