问题详细描述 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