gpt4 book ai didi

android - Proguard, Glide 3.6.1和Gradle 1.3.1错误

转载 作者:行者123 更新时间:2023-12-03 04:36:37 26 4
gpt4 key购买 nike

当将proguard与minifyEnabled使用为true时,我在assembleRelease期间收到警告,并且我的应用程序未加载我使用glide加载的大多数图像。

在调试版本中,如果将minifyEnabled设置为false,则一切正常。
你能帮忙吗?

build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'

defaultConfig {
applicationId "com.xxxxxx"
minSdkVersion 16
targetSdkVersion 23
versionCode 17
versionName "1.20151021"
}

allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
}
android.applicationVariants.all { variant ->
def appName
//Check if an applicationName property is supplied; if not use the name of the parent project.
if (project.hasProperty("applicationName")) {
appName = applicationName
} else {
appName = parent.name
}

variant.outputs.each { output ->
def newApkName
//If there's no ZipAlign task it means that our artifact will be unaligned and we need to mark it as such.
if (output.zipAlign) {
newApkName = "${appName}-${output.baseName}-${variant.versionName}.apk"
} else {
newApkName = "${appName}-${output.baseName}-${variant.versionName}-unaligned.apk"
}
output.outputFile = new File(output.outputFile.parent, newApkName)
}
}

signingConfigs {
free {
storeFile file('xxxxxx')
storePassword "$System.env.KEYSTORE_PASSWORD"
keyAlias "xxxxx"
keyPassword "$System.env.KEYSTORE_PASSWORD"
}
pro {
storeFile file('xxxx')
storePassword "$System.env.KEYSTORE_PASSWORD"
keyAlias "xxxxxx"
keyPassword "$System.env.KEYSTORE_PASSWORD"
}
}
buildTypes {
release {
// signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

productFlavors {
free {
applicationId "com.xxxxxx"
buildConfigField 'Boolean', 'IS_APP_PRO', 'false'
signingConfig signingConfigs.free
}
pro {
applicationId "com.xxxxxxx"
buildConfigField 'Boolean', 'IS_APP_PRO', 'true'
signingConfig signingConfigs.pro
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:support-v4:23.0.1'
}

proguard-rules.pro
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}

组装期间的警告发布:
Executing tasks: [assembleRelease]

Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preFreeReleaseBuild UP-TO-DATE
:app:checkFreeReleaseManifest
:app:preFreeDebugBuild UP-TO-DATE
:app:preProDebugBuild UP-TO-DATE
:app:preProReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE
:app:prepareFreeReleaseDependencies
:app:compileFreeReleaseAidl UP-TO-DATE
:app:compileFreeReleaseRenderscript UP-TO-DATE
:app:generateFreeReleaseBuildConfig UP-TO-DATE
:app:generateFreeReleaseAssets UP-TO-DATE
:app:mergeFreeReleaseAssets UP-TO-DATE
:app:generateFreeReleaseResValues UP-TO-DATE
:app:generateFreeReleaseResources UP-TO-DATE
:app:mergeFreeReleaseResources UP-TO-DATE
:app:processFreeReleaseManifest UP-TO-DATE
:app:processFreeReleaseResources
:app:generateFreeReleaseSources
:app:processFreeReleaseJavaRes UP-TO-DATE
:app:compileFreeReleaseJavaWithJavac UP-TO-DATE
:app:compileFreeReleaseNdk UP-TO-DATE
:app:compileFreeReleaseSources UP-TO-DATE
:app:lintVitalFreeRelease
Unexpected failure during lint analysis of ArticlesRecyclerViewAdapter.java (this is a bug in lint or one of the libraries it depends on)
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949)
Unexpected failure during lint analysis of CategoriesRecyclerViewAdapter.java (this is a bug in lint or one of the libraries it depends on)
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949)
Unexpected failure during lint analysis of ArticleDetailActivity.java (this is a bug in lint or one of the libraries it depends on)
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949)
Unexpected failure during lint analysis of SplashActivity.java (this is a bug in lint or one of the libraries it depends on)
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949)

:app:proguardFreeRelease
Note: there were 7 duplicate class definitions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
:app:dexFreeRelease
:app:shrinkFreeReleaseResources
Removed unused resources: Binary resource data reduced from 16682KB to 3190KB: Removed 80%
Note: If necessary, you can disable resource shrinking by adding
android {
buildTypes {
release {
shrinkResources false
}
}
}
:app:validateFreeSigning
:app:packageFreeRelease
:app:zipalignFreeRelease
:app:assembleFreeRelease
:app:checkProReleaseManifest
:app:prepareProReleaseDependencies
:app:compileProReleaseAidl UP-TO-DATE
:app:compileProReleaseRenderscript UP-TO-DATE
:app:generateProReleaseBuildConfig UP-TO-DATE
:app:generateProReleaseAssets UP-TO-DATE
:app:mergeProReleaseAssets UP-TO-DATE
:app:generateProReleaseResValues UP-TO-DATE
:app:generateProReleaseResources UP-TO-DATE
:app:mergeProReleaseResources UP-TO-DATE
:app:processProReleaseManifest UP-TO-DATE
:app:processProReleaseResources UP-TO-DATE
:app:generateProReleaseSources UP-TO-DATE
:app:processProReleaseJavaRes UP-TO-DATE
:app:compileProReleaseJavaWithJavac UP-TO-DATE
:app:compileProReleaseNdk UP-TO-DATE
:app:compileProReleaseSources UP-TO-DATE
:app:lintVitalProRelease
Unexpected failure during lint analysis of ArticlesRecyclerViewAdapter.java (this is a bug in lint or one of the libraries it depends on)
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949)
Unexpected failure during lint analysis of CategoriesRecyclerViewAdapter.java (this is a bug in lint or one of the libraries it depends on)
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949)
Unexpected failure during lint analysis of ArticleDetailActivity.java (this is a bug in lint or one of the libraries it depends on)
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949)
Unexpected failure during lint analysis of SplashActivity.java (this is a bug in lint or one of the libraries it depends on)
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949)

:app:proguardProRelease
Note: there were 7 duplicate class definitions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
:app:dexProRelease
:app:shrinkProReleaseResources
Removed unused resources: Binary resource data reduced from 16682KB to 3190KB: Removed 80%
:app:validateProSigning
:app:packageProRelease
:app:zipalignProRelease
:app:assembleProRelease
:app:assembleRelease

BUILD SUCCESSFUL

Total time: 29.188 secs

最佳答案

找到了问题。问题在于我的图像位于drawable文件夹中,而rinkResources正在删除它们,因为我没有使用代码中的硬编码图像。我禁用了rinkreResources,并将其降级为gradle 1.3.0,现在一切正常。

关于android - Proguard, Glide 3.6.1和Gradle 1.3.1错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33269615/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com