原因:java.util.zip.ZipException:设置的代码长度无效
Caused by: java.util.zip.ZipException: invalid code lengths set
我在 Android Studio 上尝试构建项目时遇到此错误。当尝试使用 res/raw/file.dat.
上的二进制文件压缩最终工件时会发生这种情况
此处解释的解决方案:
是将文件或res/raw文件夹添加到构建时的"false"过滤。但问题是我用 JFrog Articatory 配置我的内部 Maven 存储库,如下所示:https://inthecheesefactory.com/blog/how-to-setup-private-maven-repository/en
问题:
如何转换:
<project>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources/lib</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
...
</plugins>
</build>
</project>
成gradle风格:
def libraryGroupId = 'XXXXXXX'
def libraryArtifactId = 'XXXXXX'
def libraryVersion = '0.0.1'
publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/outputs/aar/${artifactId}-release.aar")
}
}
}
artifactory {
contextUrl = 'XXXXXXXXXX'
publish {
repository {
repoKey = 'libs-release-local'
username = artifactory_username
password = artifactory_password
}
defaults {
publications('aar')
publishArtifacts = true
properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = true
}
}
我试过使用 pom.xml 但它一直说无法识别 .xml 文件中的 TAG 项目。
谢谢!!!
android {
sourceSets {
main {
assets.srcDirs = ['src/main/res/raw']
}
}
}
我在 Android Studio 上尝试构建项目时遇到此错误。当尝试使用 res/raw/file.dat.
上的二进制文件压缩最终工件时会发生这种情况此处解释的解决方案:
是将文件或res/raw文件夹添加到构建时的"false"过滤。但问题是我用 JFrog Articatory 配置我的内部 Maven 存储库,如下所示:https://inthecheesefactory.com/blog/how-to-setup-private-maven-repository/en
问题: 如何转换:
<project>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources/lib</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
...
</plugins>
</build>
</project>
成gradle风格:
def libraryGroupId = 'XXXXXXX'
def libraryArtifactId = 'XXXXXX'
def libraryVersion = '0.0.1'
publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/outputs/aar/${artifactId}-release.aar")
}
}
}
artifactory {
contextUrl = 'XXXXXXXXXX'
publish {
repository {
repoKey = 'libs-release-local'
username = artifactory_username
password = artifactory_password
}
defaults {
publications('aar')
publishArtifacts = true
properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = true
}
}
我试过使用 pom.xml 但它一直说无法识别 .xml 文件中的 TAG 项目。
谢谢!!!
android {
sourceSets {
main {
assets.srcDirs = ['src/main/res/raw']
}
}
}