问题描述
等级ver:3.4.1
JDK版本:1.8
Proguard版本:5.3.3
Android gradle插件2.3.+
由于proguard,我在构建时遇到异常.我也尝试过proguard 5.3.2,但没有成功.
这是我的发布配置
版本{可调试的假android.buildTypes.release.proguardFiles = []proguardFile'proguard-android.txt'//minifyEnabledrinkResources truesigningConfig = signingConfigs.release}
以下是例外
原因:java.lang.IllegalArgumentException:无符号短值溢出[95001]在proguard.classfile.io.RuntimeDataOutput.writeUnsignedShort(RuntimeDataOutput.java:213)在proguard.classfile.io.ProgramClassWriter $ AttributeBodyWriter.visitLineNumberInfo(ProgramClassWriter.java:565)在proguard.classfile.attribute.LineNumberTableAttribute.lineNumbersAccept(LineNumberTableAttribute.java:171)
PS:我可以使用我认为使用较低版本的proguard的android gradle插件2.2.+进行构建.
此问题( PGD-681 )已在 Proguard v6.0 中修复./p>
但是,Android Gradle v3.1.0插件仍在使用Proguard v5.3.3.您可以运行 ./gradlew buildEnvironment
:
classpath+ --- com.android.tools.build:gradle:3.1.0|\ --- com.android.tools.build:gradle-core:3.1.0...|+ --- net.sf.proguard:proguard-gradle:5.3.3||\ --- net.sf.proguard:proguard-base:5.3.3
因此,您必须手动添加最新版本的Proguard:
classpath('com.android.tools.build:gradle:3.1.2'){排除模块:"proguard-gradle"}classpath('net.sf.proguard:proguard-gradle:6.0.3'){力=真}
Gradle ver : 3.4.1
JDK ver : 1.8
Proguard ver : 5.3.3
Android gradle plugin 2.3.+
I am getting exception in build due to proguard. I have tried proguard 5.3.2 also but with no success.
Here is my release config
release {
debuggable false
android.buildTypes.release.proguardFiles = []
proguardFile 'proguard-android.txt'
//minifyEnabled
shrinkResources true
signingConfig = signingConfigs.release
}
Following is the exeption
Caused by: java.lang.IllegalArgumentException: Overflow of unsigned short value [95001]
at proguard.classfile.io.RuntimeDataOutput.writeUnsignedShort(RuntimeDataOutput.java:213)
at proguard.classfile.io.ProgramClassWriter$AttributeBodyWriter.visitLineNumberInfo(ProgramClassWriter.java:565)
at proguard.classfile.attribute.LineNumberTableAttribute.lineNumbersAccept(LineNumberTableAttribute.java:171)
PS: I can build with android gradle plugin 2.2.+ that is using lower version of proguard I think.
This issue (PGD-681) was fixed in Proguard v6.0.
However, Android Plugin for Gradle v3.1.0 is still using Proguard v5.3.3. You can check it running ./gradlew buildEnvironment
:
classpath
+--- com.android.tools.build:gradle:3.1.0
| \--- com.android.tools.build:gradle-core:3.1.0
...
| +--- net.sf.proguard:proguard-gradle:5.3.3
| | \--- net.sf.proguard:proguard-base:5.3.3
So you have to manually include the latest version of Proguard:
classpath('com.android.tools.build:gradle:3.1.2') {
exclude module: 'proguard-gradle'
}
classpath('net.sf.proguard:proguard-gradle:6.0.3') {
force = true
}
这篇关于Proguard [java.lang.IllegalArgumentException:无符号的short值溢出]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!