android gradle resvalue,在插件中Gradle使用resValue在资源文件中添加信息,导致realease版本编译失败...

问题详细描述 Detailed description of the problem

由于在插件中无法读取自身的meta-data,因此在资源文件中做一些分渠道分发的内容填充。但是使用resValue时,release编译失败,debug没问题。但是此时不clean,再次build即可成功。

复现问题步骤 Steps to reproduce the problem

app.gradle文件大致内容

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {

compileSdkVersion 27

signingConfigs {

releaseConfig {

keyAlias 'ApkReleaseSign'

keyPassword 'android_ApkReleaseSign'

storeFile file('signing.data')

storePassword 'abcdefg'

}

}

defaultConfig {

applicationId "com.xxxxxxxx"

minSdkVersion 19

targetSdkVersion 19

versionCode 1

versionName "1.0"

}

buildTypes {

release {

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

signingConfig signingConfigs.releaseConfig

}

}

flavorDimensions 'abi', 'channel'

productFlavors {

local {

dimension "channel"

// 存在下面这行会导致release编译失败

resValue "string", "message", "Hello World"

manifestPlaceholders = [pluginName: 'PN_Webview']

}

x86 {

dimension "abi"

ndk {

abiFilters "x86", "x86_64"

}

}

arm {

dimension "abi"

ndk {

abiFilters "armeabi-v7a", "arm64-v8a", "armeabi"

}

}

}

}

apply plugin: 'replugin-plugin-gradle'

dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation project(':PublicModule')

implementation 'com.qihoo360.replugin:replugin-plugin-lib:2.2.1'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

implementation 'com.android.support:appcompat-v7:27.+'

testImplementation 'junit:junit:4.12'

androidTestImplementation 'com.android.support.test:runner:1.0.1'

androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

}

repositories {

mavenCentral()

}

尝试过clean后,再次build。问题依旧。debug版本均可以正常编译,反编译后确认资源文件填充正常。

编译失败后的log

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app:transformClassesWith___ReClass___ForArmLocalRelease'.

> E:\projects\UnitedPlatform\PluginWebBrowser\app\build\intermediates\exploded-aar\61879379f28a6bd1cde7a9db2bbd3735e76489d3\class does not exist.

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 9m 19s

其它重要信息 Other important information

rePlugin-plugin-lib/gradle Version: 2.2.1

JDK: 1.8

Gradle: 3.0.1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值