我想在cmd上使用gradle重命名包名。因为我有多个项目自定义并使用ide更改包名称很难单独更改每个包名。请给我解决方案。提前谢谢
apply plugin: 'com.android.application'
apply plugin: 'maven'
android {
compileSdkVersion 21
buildToolsVersion "23.0.0 rc2"
sourceSets {
defaultConfig {
applicationId "com.appbell.restaurant.genericresto"
minSdkVersion 14
targetSdkVersion 19
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
main {
manifest.srcFile 'src\\main\\AndroidManifest.xml'
println('android'+manifest.srcFile)
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
task changePackage{
replaceInManifest("com.appbell.restaurant.example","com.appbell.imenu4u")
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
// Make sure this is at least 0.10.+
classpath 'com.android.tools.build:gradle:1.0.+'
}
}
task appStart(type: Exec, dependsOn: 'installDebug') {
// linux
//commandLine 'adb', 'shell', 'am', 'start', '-n', 'com.example/.MyActivity'
// windows
commandLine 'cmd', '/c', 'adb', 'shell', 'am', 'start', '-n', 'com.appbell.restaurant.genericresto/com.appbell.and.resto.and.ui.SplashActivity'
}
dependencies {
compile project(':facebook')
compile project(':stripe')
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:21.0.3'
compile files('libs/mobileappclasses.jar')
compile files('libs/pgsdk.jar')
}
def replaceInManifest(fromString, toString) {
def manifestFile = "C:\\Users\\Ntin Gorle\\AndroidstudioProjects\\MyApplication\\RestoAppNEw\\src\\main\\AndroidManifest.xml"
def updatedContent = new File(manifestFile).getText('UTF-8').replaceAll(fromString, toString)
new File(manifestFile).write(updatedContent, 'UTF-8')
}
我这个代码包名称发生了变化,但没有反映在所有.java文件中。请告诉我如何更改所有.java类。