我正在使用带有gradle的android studio 0.9.3 'com.android.tools.build:gradle:0.14.+'
apply plugin:'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "xxx.xxx.xxx"
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "1.0.11"
}
signingConfigs{
releaseConfig{
storeFile file("xxxxxxx")
storePassword = "xxxx"
keyAlias = "xxxx"
keyPassword = "xxxx"
}
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseConfig
// adds version to file name
applicationVariants.all { variant ->
def file = variant.outputFile
variant.outputFile = new File(file.parent, file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk"))
}
}
}
}
dependencies …Run Code Online (Sandbox Code Playgroud) 我已经构建了我的android库包(aar),并在"..\app\build\outputs\aar"文件夹中创建了build的结果.这个文件夹中的文件名为"app-debug.aar",所以我猜它是在调试模式下构建的,所以我想知道如何生成构建的版本,即"app-release.aar".我怎样才能做到这一点?此外,是否可以使用另一个自定义名称生成构建,例如,"myCustomAppName-release.aar"而不是"app-release.aar".
您好我正在尝试使用gradle构建并重命名我的aar文件,但得到上述错误:
A problem occurred evaluating project ':app'.
> Could not find property 'outputs' on BuildType_Decorated{name=variant, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, applicationIdSuffix=null, versionNameSuffix=null, minifyEnabled=false, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}}.
Run Code Online (Sandbox Code Playgroud)
这是我在gradle上的完整构建脚本
apply plugin: 'com.android.library'
android.libraryVariants.all { variant ->
def alignedOutputFile = output.outputFile
def unalignedOutputFile = output.packageApplication.outputFile
logger.warn('You got to variant: ' + variant + ' and output: ' + output)
// Customise APK filenames (to include build version)
if (variant.buildType.zipAlignEnabled) {
// normal APK
output.outputFile = new File(alignedOutputFile.parent, …Run Code Online (Sandbox Code Playgroud) 从AS 0.8更新到Android Studio 1.0 RC4时,我遇到了这个臭名昭着的错误.
我在这里看到了一个问题:无法在com.android.build.gradle.internal.api.ApplicationVariantImpl上找到属性'outputFile' 并尝试调整代码但没有成功.
所以我尝试通过注释applicationVariants不要在任何地方声明这个outputFile但仍然得到错误(?)
然后,我使用File-> Invalidate Caches/Restart中的选项使缓存无效,但再次无效.
最后我删除了项目文件夹中的.gradle目录,但在尝试同步时仍然出错.
有没有人有关于如何解决它的其他建议?