Skip to content

Commit

Permalink
配置更新
Browse files Browse the repository at this point in the history
为了避免大墙带来的一些麻烦,我现在使用的是idea ultimate
来开发。而idea的Android插件似乎有些滞后,但总体用起来还是感觉比android studio 被大墙挡着方便。
将工程配置更新到了较新的版本,但不是最新的。
在readme文件中加入了生成local.properties 的命令。
  • Loading branch information
ShinChven committed Apr 22, 2015
1 parent 9a5accb commit 2000755
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 32 deletions.
15 changes: 3 additions & 12 deletions LibModule/build.gradle
@@ -1,25 +1,16 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.2'
}
}
apply plugin: 'com.android.library'

repositories {
jcenter()
}

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "com.github.example.libmodule.lib"
minSdkVersion 8
targetSdkVersion 21
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
Expand Down
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -289,3 +289,10 @@ dependencies {
compile 'com.android.support:support-v4:21.0.0'
}
```

## local.properties文件
在OS X 系统中,你的工程需要这个文件来告诉工具的gradle 插件,你的sdk在哪。如果不进行配置的话将不能使用gradle 插件中的clean build 等方便的功能。
``` bash
echo sdk.dir=$ANDROID_HOME >local.properties
```

25 changes: 11 additions & 14 deletions app/build.gradle
@@ -1,11 +1,3 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.2'
}
}
apply plugin: 'com.android.application'

repositories {
Expand All @@ -14,29 +6,34 @@ repositories {

android {

compileSdkVersion 21
buildToolsVersion "21.1.1"
compileSdkVersion 22
buildToolsVersion "22.0.1"


defaultConfig {
applicationId "com.github.ShinChven.migratetogradle"
minSdkVersion 9
targetSdkVersion 21
targetSdkVersion 22
versionCode 1
versionName "1.0"
}

buildTypes {
release {
runProguard false
minifyEnabled false // proGuard 现在改成了 minifyEnabled
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
proguardFiles 'proguard-project.txt'
}
debug {

}
}


compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

sourceSets { // 工程结构配置,如果你使用的是标准gradle 工程结构就需要把sourceSets 去掉
main {
java.srcDirs = ['src']
Expand Down
92 changes: 88 additions & 4 deletions app/proguard-project.txt
@@ -1,9 +1,6 @@
# 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
# in D:/adt-bundle-x64/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
Expand All @@ -18,3 +15,90 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}


# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose

# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize
-dontpreverify
# Note that if you want to enable optimization, you cannot just
# include optimization flags in your own project configuration file;
# instead you will need to point to the
# "proguard-android-optimize.txt" file instead of this one from your
# project.properties file.

-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService

#Keep classes that are referenced on the AndroidManifest
#-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
#-keep public class com.android.vending.licensing.ILicensingService

# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>;
}

# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}

# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}

# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

-keepclassmembers class **.R$* {
public static <fields>;
}



# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn android.support.**
-keep class android.support.**{ *; }

-dontwarn android.test.**
-keep class android.test.**{ *; }

-dontwarn com.github.**
-keep class com.github.**{ *; }


# -libraryjars /libs/json-lib-2.2.3-jdk13.jar
# -libraryjars /libs/xUtils-2.4.7.jar




-dontskipnonpubliclibraryclassmembers

-dontskipnonpubliclibraryclasses
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.2'
classpath 'com.android.tools.build:gradle:1.1.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

0 comments on commit 2000755

Please sign in to comment.