Closed wlj190785060 closed 7 years ago
这已经写的很清楚了啊 你没有开启v2签名
这个需要怎么打开?
升级Gradle Plugin版本,大于2.2.0即可,如果手工设置了v2SigningEnabled=false,需要去掉
条件满足 我是2.2.3 也没添加v2SigningEnabled=true 还有别的配置吗
贴一下buildscript的配置吧
根目录:buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.meituan.android.walle:plugin:1.0.3'
}
}
app目录: apply plugin: 'com.android.application' apply plugin: 'android-apt' apply plugin: 'walle'
android{ 。。。 compileSdkVersion 23 buildToolsVersion "23.0.3" defaultConfig { applicationId "com.test.one" minSdkVersion 17 targetSdkVersion 23 versionCode 111 versionName "1.0.0" multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 。。。 } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:' + SUPPORT_VERSION compile 'com.android.support:recyclerview-v7:' + SUPPORT_VERSION compile 'com.android.support:cardview-v7:' + SUPPORT_VERSION compile 'com.android.support:design:' + SUPPORT_VERSION compile 'com.android.support:support-v4:' + SUPPORT_VERSION compile 'com.android.support:percent:' + SUPPORT_VERSION compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.google.code.gson:gson:2.7' compile 'com.squareup.okhttp3:okhttp:3.3.1' // compile 'com.squareup.okhttp3:logging-interceptor:3.3.1' compile 'com.jakewharton:butterknife:8.1.0' compile 'org.greenrobot:eventbus:3.0.0' compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar' compile 'im.fir:fir-sdk:latest.integration@aar' compile 'com.umeng.analytics:analytics:latest.integration' compile 'com.getui:sdk:2.9.5.0' compile 'com.meituan.android.walle:library:1.0.3' testCompile 'junit:junit:4.12' apt 'com.jakewharton:butterknife-compiler:8.1.0' }
配置上2.2.3后,本地没有复现 目前报错的代码是这个函数返回false
boolean isV2SignatureSchemeEnabled(BaseVariant variant) throws GradleException {
def signingConfig = getSigningConfig(variant);
if (signingConfig == null || !signingConfig.isSigningReady()) {
return false;
}
// check whether APK Signature Scheme v2 is enabled.
if (signingConfig.hasProperty("v2SigningEnabled") &&
signingConfig.v2SigningEnabled == true) {
return true;
}
return false;
}
可以检查下项目的签名配置是否满足这2两种情况,1. 签名配置准确无误(签名的密码、签名文件都存在);2. v2SigningEnabled 没有被设置成false
经确认以上两点均配置无误
在同事电脑上跑了一下 结果出现另外一个错误 Error:Could not find com.android.support:support-annotations:24.1.1. Required by: 24h:app:unspecified > com.android.support:recyclerview-v7:23.4.0 24h:app:unspecified > com.android.support:support-v4:23.4.0 版本要求不一样?
看你贴出来的东西没有配置签名啊
signingConfigs { release { storeFile file("test.keystore") storePassword "test" keyAlias "test" keyPassword "test" }
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
release {
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
经确认以上两点均配置无误
在同事电脑上跑了一下 结果出现另外一个错误 Error:Could not find com.android.support:support-annotations:24.1.1. Required by: 24h:app:unspecified > com.android.support:recyclerview-v7:23.4.0 24h:app:unspecified > com.android.support:support-v4:23.4.0 版本要求不一样?
walle是个gradle 插件,依赖的问题建议采用排除法,先把walle注释掉能跑通在apply 'walle'
release下木有配置签名啊
你把release配到了debug下 release没有配置签名
buildTypes { debug { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } release { minifyEnabled true shrinkResources false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
release {
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
。。。我太弱了 低级错误
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
release {
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
signingConfigs {
config {
keyAlias 'app'
keyPassword '123456'
storeFile file('F:/AndroidProjectS/MyApp/app/keystore/MyApp.keystore')
storePassword '123456'
}
}
Could not get unknown property 'config' for SigningConfig container of type org.gradle.api.internal.FactoryNamedDomainObjectContainer. Open File
Error:Plugin requires 'APK Signature Scheme v2 Enabled' for release.