默认名称:app-release.apk
要修改这个名字可以搜索一下异常:
Cannot set the value of read-only property 'outputFile'
因为你搜索react-native 修改android打包的包名
搜索不到有用的~~~
项目根目录 -> android -> app -> build.gradle -> 修改buildTypes 里面的内容
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
// 以下是需要添加的内容
applicationVariants.all{ variant ->
def buildName = variant.buildType.name
variant.outputs.all { output ->
def outputFile = output.outputFile
if(outputFile != null && outputFile.name.endsWith('.apk')){
if(buildName == 'debug'){
def fileName = "app-debug.apk"
outputFileName = fileName
} else if (buildName == 'release'){
def fileName = "ruanjian.apk" // 修改app名称
outputFileName = fileName
}
}
}
}
}
}