Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持gradle 2.2 #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Gradle/for1.11_build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ android.applicationVariants.all{ variant ->
//${buildDir}是指./build文件夹
//${variant.dirName}是flavor/buildtype,例如GooglePlay/release,运行时会自动生成
//下面的路径是类似这样:./build/manifests/GooglePlay/release/AndroidManifest.xml
def manifestFile = "${buildDir}/manifests/${variant.dirName}/AndroidManifest.xml"
def manifestFile = "${buildDir}/manifests/full/${variant.dirName}/AndroidManifest.xml"

//将字符串UMENG_CHANNEL_VALUE替换成flavor的名字
def updatedContent = new File(manifestFile).getText('UTF-8').replaceAll("UMENG_CHANNEL_VALUE", "${variant.productFlavors[0].name}")
new File(manifestFile).write(updatedContent, 'UTF-8')

//将此次flavor的AndroidManifest.xml文件指定为我们修改过的这个文件
variant.processResources.manifestFile = file("${buildDir}/manifests/${variant.dirName}/AndroidManifest.xml")
variant.processResources.manifestFile = file(mainfestFile)
}
}
}