200code

模板

.gitignore模板

github 模板集合

文件 .gitignore 的格式规范如下:

  • 所有空行或者以注释符号 # 开头的行都会被 Git 忽略。
  • 可以使用标准的 glob 模式匹配。
  • 匹配模式最后跟反斜杠(/)说明要忽略的是目录。
  • 要忽略指定模式以外的文件或目录,可以在模式前加上惊叹号(!)取反。

所谓的 glob 模式是指 shell 所使用的简化了的正则表达式。星号(*)匹配零个或多个任意字符;[abc] 匹配任何一个列在方括号中的字符(这个例子要么匹配一个 a,要么匹配一个 b,要么匹配一个 c);问号(?)只匹配一个任意字符;如果在方括号中使用短划线分隔两个字符,表示所有在这两个字符范围内的都可以匹配(比如 [0-9] 表示匹配所有 0 到 9 的数字)。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
out/
build/
# build/ 忽略所有的 build/ 目录下文件
# /build 只忽略此目录下build文件,子目录的build不忽略
# Local configuration file (sdk path, etc)
local.properties
# Windows thumbnail db
Thumbs.db
# OSX files
.DS_Store
# Eclipse project files
.classpath
.project
# Android Studio
*.iml
.idea
# Local IDEA workspace
.idea/workspace.xml
# Gradle cache
.gradle
#NDK
obj/
.settings/
*.properties

proguard-rules.pro模版

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-optimizationpasses 9 # 指定代码的压缩级别
-dontusemixedcaseclassnames # 是否使用大小写混合
-dontskipnonpubliclibraryclasses # 是否混淆第三方jar
-dontpreverify # 混淆时是否做预校验
-keepattributes SourceFile,LineNumberTable # 混淆号错误信息里带上代码行
-verbose # 混淆时是否记录日志
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* # 混淆时所采用的算法
-repackageclasses ''
-allowaccessmodification
-dontwarn
# keep 4大组件, application
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
# 自定义的view类
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
#To maintain custom components names that are used on layouts XML:
-keep public class * extends android.view.View {
public <init>(android.content.Context);
}
-keep public class * extends android.view.View {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keep public class * extends android.view.View {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
# Serializables类
-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
!private <fields>;
!private <methods>;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# support v7类
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }
#Compatibility library
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.app.Fragment
# 第三方包类
-libraryjars libs/jackson-all-1.9.11.jar
-keep class org.codehaus.jackson.**{*;}
# keep 类成员
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
# keep parcelable
-keepclassmembers class * implements android.os.Parcelable {
static android.os.Parcelable$Creator CREATOR;
}
#Keep the R
-keepclassmembers class **.R$* {
public static <fields>;
}
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}
#Maintain java native methods
-keepclasseswithmembernames class * {
native <methods>;
}
#Maintain enums
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# Remove Logging
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** w(...);
public static *** v(...);
public static *** i(...);
}
-ignorewarnings
# others =============================================================================== 参考
# Android Support Library类
-keep class android.** {*;}
# 不混淆的第三方包
-libraryjars libs/juniversalchardet-1.0.3.jar
-libraryjars libs/jaudiotagger-2.0.3.jar
-libraryjars libs/jackson-all-1.9.11.jar
-keep class com.xui.launcher.icarmusic.view.**{*; }
-keep class org.mozilla.universalchardet.**{*;}
-keep class org.jaudiotagger.**{*;}
-keep class org.codehaus.jackson.**{*;}
-libraryjars libs/android_api.jar
-libraryjars libs/baidumapapi_v2_2_0.jar
-libraryjars libs/armeabi.jar
-libraryjars libs/locSDK_3.1.jar
-libraryjars libs/pushservice-2.4.0.jar
# Baidu Map
-keep class com.baidu.mapapi.** {*; }
-keep class com.baidu.location.** {*; }
-keep class com.baidu.platform.** {*; }
-keep class com.baidu.vi.** {*; }
-keep class vi.com.gdi.bgl.android.java.** {*; }
# Baidu Push
-keep class com.baidu.android.** {*; }
-keep class com.baidu.loctp.** {*; }
-keep class com.nineoldandroids.** {*; }
# Baidu Tongji
-keep class com.baidu.a.a.a.** {*; }
-keep class com.baidu.mobstat.** {*; }
# slidingmenu
-keep class com.jeremyfeinstein.slidingmenu.lib.** {*; }
# listviewAnimations
-keep class com.haarman.listviewanimations.** {*; }
#ACRA specifics
# we need line numbers in our stack traces otherwise they are pretty useless
-renamesourcefileattribute SourceFile
# ACRA needs "annotations" so add this...
-keepattributes *Annotation*