1
我在應用程序中使用單個build.gradle文件。 關於1.6版本,它工作正常。 但我想用這個模塊進行位置更新。構建gradle:無法找到方法packagingOptions()參數root項目「fasterDev」
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.google.android.gms:play-services:fp9.0.0'
}
這是我的build.gradle。
的build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 15
buildToolsVersion "21.1.2"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
任何教程或建議的呢?
日誌:
org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: org.gradle.api.internal.MissingMethodException: Could not find method packagingOptions() for arguments [[email protected]] on root project 'fasterDev'.
at org.gradle.api.internal.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:68)
感謝您的時間和建議。但是,如果我把這個機器人裏面你的建議。我會 「在APK複製重複文件」 和日誌::您可以忽略你的build.gradle這些文件: \t的Android { \t packagingOptions { \t排除 '的lib/armeabi-V7A/gdbserver的' \t} \t} 你能提出更多的建議嗎? – NovusMobile
這意味着,你首先得到的異常被解決,現在構建腳本是正確的。你只需要改進提供的配置。您是否嘗試過排除'lib/armeabi-v7a/gdbserver'?如果這是'.so'本地lib,則嘗試將'exclude'更改爲'pickFirst',這將包括lib的第一次發生。 – Stanislav
太棒了。謝謝一噸。排除選擇第一對我來說是新的。如果您有任何關於此的文章。請分享一個鏈接。 – NovusMobile