- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当将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'
}
-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/
https://www.guardsquare.com/en/proguard/manual/optimizations说 class/unboxing/enum Simplifies enum ty
我想使用 ProGuard 重命名变量和函数。我希望生成的类文件在所有方面都与源 jar 相同,除了名称。有没有办法做到这一点? 我尝试使用 dontoptimize 和 dontshrink 无效。
例如,这条规则在 proguard 中意味着什么: -keep class myjava.** {*;} 我理解 {*;} 部分意味着类中的所有成员和方法。但是包名中的 2 个星号是什么意思? 提前致
我有一个即将使用 ProGuard 混淆的库。 “图书馆模式”几乎适用于我的用例,即保留所有公共(public)和 protected 类和类成员几乎没问题。 然而,由于 Java 的可见性要求,一些
在我的 Playstore 中,我注意到去混淆后的代码包含相当多的 在堆栈跟踪中。 (例如 at .onAttach(ProfileLandingFragment.java) )。 有什么用真正意思?
我收到了一封来自 Google 的关于 unsafe implementation of TrustManager 的电子邮件唯一的线索是有问题的代码在 com.b.a.af 类中。显然,这是混淆的名
我读自 http://proguard.sourceforge.net/manual/usage.html关于assumenosideeffects的使用。我的问题涉及以下段落: -assumenos
什么是智能 ProGuard 配置来混淆特定类 com.acme.Algorithm 的私有(private)方法和常量? 我想对此进行混淆,因为它包含一个算法,当意外打开 .jar 时,该算法不应该
最近将 Pushwoosh 库集成到我的 Android 应用程序中。它运作良好。但是在导出为签名应用程序时遇到以下错误。请帮忙。提前致谢。 Proguard returned with error
有没有人有使用ProGuard的经验是否已经有超出类加载时间的应用程序性能测量? 我有一个相当复杂的应用程序,可能需要改进,但为 ProGuard 准备它需要几天时间,所以我想先听听一些意见。 最佳答
当我尝试使用 android studio 3.2 canary 17 构建应用程序包时,我收到以下错误消息。我不知道我所有的 proguard 文件中缺少什么角括号,一切似乎都很好,并且在旧版本的
我遇到了 proguard 的问题,我刚刚配置了 Bugsense 并且使用了它们的配置建议,我在 google 和 stackoverflow 上进行了搜索,通常 ppl 可以在控制台中看到该行或问
我第一次尝试使用 Proguard,我收到此错误,有人可以帮我吗?谢谢 [2014-09-03 11:44:58 - P - Photos] Proguard returned with error
当我收到此错误时,我正在尝试导出启用了 proguard 的 android 应用程序:- Proguard returned with error code 1. See console pro
看起来有两个用于运行 ProGuard 的 SBT 插件。任何人都可以谈谈他们的相对优势和劣势吗?我还没有在网上找到比较。 xsbt-proguard-plugin - https://github.
Proguard 会条纹 kotlin.Unit 独立对象(在 Kotlin 运行时库中),如果您使用此类型,则会导致编译错误。以下规则无助于保留此元素(可能是因为 Unit 不是一个类,它是一个对象
构建 Android 发行版 apk 时,Smack 4.1 的正确 ProGuard 规则是什么? 目前,我正在使用 aSmack github 存储库上 README.asmack 文件中的 aS
尝试使用 Proguard Maven 插件时出现 OutOfMemoryErrors。我尝试通过将 MAVEN_OPTS 环境变量设置为 -Xmx2g 来为 Maven 分配更多内存,但这没有任何区
我有一个 pom.xml 文件如下。当我运行 mvn clean install 时,出现错误 [proguard] Error: Can't read [C:\Program Files\Java\
我已经将支持库从 v22.2.1 更新到 v23.0.0,在构建应用程序后(使用 minifyEnabled true)我有“AppCompat 不支持当前主题功能”异常: 08-23 05:46:1
我是一名优秀的程序员,十分优秀!