- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我添加了com.eftimoff:android-pathview:1.0.8@aar
到我的项目,但当我运行应用程序时,我收到此错误:
Cause: duplicate entry: META-INF/MANIFEST.MF
这是pathview
外部库中的文件:
现在我想排除META-INF
文件夹,所以我将其添加到模块 gradle 中:
android {
...
packagingOptions {
exclude 'META-INF/*'
}
}
但我仍然遇到上述错误。
我写了像 this suggestion 这样的 gradle 脚本
当我像这样添加库时: implementation ('com.eftimoff:android-pathview:1.0.8@aar').exclude("META-INF/MANIFEST.MF")
我收到此错误:
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Projects\Android\Mvvm\Kotlin\MovieDb\app\build.gradle' line: 80
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method leftShift() for arguments [build_37vlhf9la1wtl8koroxp1kll7$_run_closure4@b32cc6a] on task ':app:excludeTask' of type org.gradle.api.DefaultTask.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
CONFIGURE FAILED in 0s
Could not find method leftShift() for arguments [build_37vlhf9la1wtl8koroxp1kll7$_run_closure4@b32cc6a] on task ':app:excludeTask' of type org.gradle.api.DefaultTask.
Open File
这就是 tasks.create("excludeTask") << {
我有错误。所以我改变了task.create()
对此:
tasks.create("excludeTask") {
doLast{
exclusions.each {
File file = file("${buildDir}/intermediates/exploded-aar/${it}")
println("Excluding file " + file)
if (file.exists()) {
file.delete()
}
}
}
}
这些错误消失了,但我仍然再次遇到此错误:
Cause: duplicate entry: META-INF/MANIFEST.MF
此脚本似乎适用于 resources
现在我想排除文件夹内的文件。
这是完整的 gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
// Enables data binding.
dataBinding {
enabled = true
}
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.t.moviedb"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// packagingOptions {
// exclude '/META-INF/*'
// }
// aaptOptions {
// ignoreAssetsPattern "!META-INF/MANIFEST.MF"
// ignoreAssetsPattern "META-INF/MANIFEST.MF"
// }
}
final List<String> exclusions = [];
Dependency.metaClass.exclude = { String[] currentExclusions ->
currentExclusions.each {
exclusions.add("${getGroup()}/${getName()}/${getVersion()}/${it}")
}
return thisObject
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Support libraries
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.fragment:fragment:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// Android KTX
implementation 'androidx.core:core-ktx:1.1.0'
// Testing
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//other
implementation ('com.eftimoff:android-pathview:1.0.8@aar').exclude("META-INF/*")
}
tasks.create("excludeTask") {
doLast{
exclusions.each {
File file = file("${buildDir}/intermediates/exploded-aar/${it}")
println("Excluding file " + file)
if (file.exists()) {
file.delete()
}
}
}
}
tasks.whenTaskAdded({
if (it.name.matches(/^process.*Resources$/)) {
it.dependsOn excludeTask
}
})
这是我的 gradle 版本:
\MovieDb>gradlew --version
------------------------------------------------------------
Gradle 5.4.1
------------------------------------------------------------
Build time: 2019-04-26 08:14:42 UTC
Revision: 261d171646b36a6a28d5a19a69676cd098a4c19d
Kotlin: 1.3.21
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_231 (Oracle Corporation 25.231-b11)
OS: Windows 10 10.0 amd64
和:
最佳答案
您的问题是由多个问题引起的,因此更难修复。首先,Gradle Android 插件版本 3.5.2 似乎有一个错误,您无法从 apk 中删除这些额外的 list 文件。作为解决方法,您可以将插件恢复到版本 3.5.1
(不是 Android Studio,恢复插件版本就足够了)。
然后你看到了错误:
Cause: duplicate entry: META-INF/MANIFEST.MF
这是因为您暂时删除了该部分
packagingOptions {
exclude 'META-INF/MANIFEST.MF'
}
来自您的 build.gradle,因为由于插件错误而无法工作。最后,您看到了错误:
Duplicate class com.caverock.androidsvg.CSSParser found in modules androidsvg-1.2.1.jar (android-pathview-1.0.8.aar) and androidsvg-1.2.1.jar (com.eftimoff:android-pathview:1.0.8)
这是因为您在 libs/
文件夹中包含了修改后的库,但忘记将其从 implementation {}
部分中删除,因此它被包含了两次.
关于java - Android gradle : Exclude file from external dependencies,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58796463/
如果我有一个包含 debian/control 和 Build-Depends 条目的 Depends 文件。 如何安装两组依赖项? 目前我正在使用以下命令创建一个依赖于 Build-Depends
我一直在查看衬底节点模板的Cargo.toml文件,并注意到,对于大多数 crate 而言,其依赖性如下所示: [dependencies.grandpa] package = 'sc-finalit
我在 Netbeans 7.1 IDE 中有一个 Maven 项目。 我想为 Dependencies 添加相同的依赖项和 Test Dependencies . 添加到一个中会将其从另一个中删除。
我正在尝试解决此处描述的问题: http://www.jayway.com/2013/04/12/solving-asm-conflicts-after-upgrading-to-groovy-2-1
我研究过这个问题,但找不到共识。如果“A 依赖于 B”,术语“依赖性”指的是: 一个 B A和B的关系 这个术语在计算机技术的不同子领域中是否有不同的含义? 最佳答案 B 将是依赖项。您可能会以“B
WebLogic 10.3.6Java 1.6 所以我在使用 Eclipse 时遇到了 XML 问题。 7天前我去度假之前,这一切运行良好。事实上,在我离开之前,我恢复到了旧版本,因为我在一些不太重要
在问这个问题之前,我想说 this stackoverflow 中的问题与我的问题非常相似,但概念仍然不清楚,非常困惑。 我想了解依赖倒置原则,但我无法完全理解它? 下面是DIP说的两点 A. Hig
很难说出这里问的是什么。这个问题是模棱两可的、模糊的、不完整的、过于宽泛的或修辞的,无法以目前的形式得到合理的回答。如需帮助澄清这个问题以便重新打开它,visit the help center .
我正在尝试使用 apache maven 创建一个包。当我运行 mvn clean install 命令时,出现以下错误: dependencies.dependency.version' is mi
在 Real World Ocaml Chapter 9这是关于仿函数的: Dependency injection Makes the implementations of some compone
我已经构建了类似用于创建网站的基本模板/工作流的东西,主要使用 Grunt。 该模板的一部分是 Modernizr 特征检测库,我的一项 Grunt 任务依赖于它。 目前我只是将该依赖项存储在我的 b
我有固定依赖项的 python 项目。由于第三方依赖项中的错误,在我的包中发现了错误。该依赖项已发布修复该错误的补丁。然而,根据 semantic versioning ,是否为固定依赖项的每个补丁版
使用插件io.spring.dependency-management ,我的依赖的一些版本是从其他依赖中扣除的 id("io.spring.dependency-management") versi
我有这两个表“员工表,从属表” 员工表有“ID, employee_id, employee_name” 从属表有“ID, employee_id, dependent_name, relations
我正在使用 Eclipse 中的一个 mavenised java 项目,其中有几个模块无法构建并从 pom 文件中抛出错误: Project build error: 'dependencies.d
我有一个包含多个模块的 maven 项目。在 Eclipse(Juno,带有 m2e)中,它似乎编译得很好。但是当我在其中一个模块上进行 maven 安装时,构建会立即失败。 父 pom: com
我使用 eclipse juno 创建了一个 maven 项目并编辑了 pom 文件。当我通过“mvn clean install”使用命令提示符运行 pom 文件时,出现此错误。 [ERROR] T
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 6 年前。 Improv
似乎包括与 provided 的直接依赖关系范围很好理解。似乎还包括带有 runtime 的传递依赖项。范围也很容易实现。 但是我如何才能包含两个间接级别的依赖项? 例子: A --> B --> C
我有以下情况: 我想在我的另一个项目中使用我的一个项目(托管在 bintray.com 上)。 我设置了一个 Maven 存储库,上传了 Artifact 和 pom 文件,然后能够使用上传到 bin
我是一名优秀的程序员,十分优秀!