我有一个包含多种产品风格的多模块Android项目,升级到AS 3.0后,我不得不按照迁移指南进行迁移。我已经解决了许多关于缺少依赖项以及重复定义的问题。但最后我被封锁了。
这是我的app模块的build.gradle
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
classpath 'io.fabric.tools:gradle:1.22.1'
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.2-SNAPSHOT'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.droidtitan.lintcleaner'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'com.google.firebase.firebase-crash'
repositories {
mavenLocal()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
hugo {
enabled true
}
android {
compileSdkVersion project.targetSdkVersion
buildToolsVersion project.buildToolsVersion
testBuildType "canaryStaging"
packagingOptions {
exclude 'META-INF/license.txt'
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}
lintOptions {
abortOnError false
disable 'InvalidPackage'
}
signingConfigs {
debug {
storeFile file('keys/debug.keystore')
storePassword 'android'
keyAlias 'AndroidDebugKey'
keyPassword 'android'
}
release {
storeFile file('keys' +
'/*****************')
storePassword '*******'
keyAlias '*****'
keyPassword '**************'
}
materelease {
storeFile file('keys' +
'/*****************')
storePassword '*********'
keyAlias '*****'
keyPassword '**************'
}
}
defaultConfig {
applicationId "com.myeglu.android"
minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion
versionCode project.versionCode
versionName project.versionName
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
resConfigs "en"
testApplicationId "com.myeglu.android.test"
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
ndk {
abiFilters 'armeabi'
}
externalNativeBuild {
cmake {
arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=gnustl_static', "-DANDROID_CPP_FEATURES=rtti exceptions", "-DANDROID_UNIFIED_HEADERS=ON"
}
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
canaryStaging.initWith(buildTypes.debug)
canaryStaging {
applicationIdSuffix ".canary.staging"
matchingFallbacks = ['debug', 'release']
}
canary.initWith(buildTypes.release)
elcloud {
initWith(buildTypes.debug)
applicationIdSuffix ".elcloud.debug"
signingConfig signingConfigs.debug
matchingFallbacks = ['debug', 'release']
}
elcloudRelease {
initWith(buildTypes.elcloud)
applicationIdSuffix ".elcloud"
debuggable false
signingConfig signingConfigs.materelease
matchingFallbacks = ['debug', 'release']
}
canary {
applicationIdSuffix ".canary"
debuggable true
matchingFallbacks = ['debug', 'release']
}
configurations.all {
resolutionStrategy.eachDependency { details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion project.supportVersion
}
}
}
}
}
sourceSets {
main {
jniLibs.srcDirs = ['../sharedlibs/ffmpeg/lib']
}
}
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Cloud testing
androidTestImplementation(name: 'cloudtestingscreenshotter_lib', ext: 'aar')
// implementation 'com.apptentive:apptentive-android:1.7.0@aar'
// canaryimplementation 'com.squareup.leakcanary:leakcanary- android:1.4-beta2'
// canaryStagingimplementation 'com.squareup.leakcanary:leakcanary- android:1.4-beta2'
// debugimplementation 'com.squareup.leakcanary:leakcanary- android:1.4-beta2'
// releaseimplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
// testimplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.0@aar') {
transitive = true;
}
implementation('com.crashlytics.sdk.android:answers:1.4.0@aar') {
transitive = true;
}
implementation('com.twitter.sdk.android:twitter:2.3.2@aar') {
transitive = true;
}
implementation('com.crashlytics.sdk.android:answers:+') {
transitive = true;
}
implementation("com.google.android.gms:play-services-plus:$project.gmsVersion") {
exclude group: 'com.google.guava'
}
implementation("com.google.android.gms:play-services-location:$project.gmsVersion") {
exclude group: 'com.google.guava'
}
implementation("com.google.android.gms:play-services-gcm:$project.gmsVersion") {
exclude group: 'com.google.guava'
}
implementation("com.google.android.gms:play-services-ads:$project.gmsVersion") {
exclude group: 'com.google.guava'
}
implementation "com.android.support:appcompat-v7:$project.supportVersion"
implementation "com.android.support:customtabs:$project.supportVersion"
implementation "com.android.support:cardview-v7:$project.supportVersion"
implementation "com.android.support:palette-v7:$project.supportVersion"
implementation "com.android.support:preference-v14:$project.supportVersion"
implementation "com.android.support:support-v4:$project.supportVersion"
implementation "com.android.support:design:$project.supportVersion"
implementation "com.google.android.gms:play-services-auth:$project.gmsVersion"
// implementation 'com.jakewharton.hugo:hugo-runtime:+'
implementation group: 'com.facebook.stetho', name: 'stetho-urlconnection', version: '1.4.2'
implementation "com.android.support:recyclerview-v7:$project.supportVersion"
implementation "com.android.support:percent:$project.supportVersion"
implementation "com.google.android.gms:play-services-ads:$project.gmsVersion"
implementation "com.google.android.gms:play-services-gcm:$project.gmsVersion"
implementation project(':foscamlib')
implementation project(':irlibrary')
implementation (project(':cctvlib'))
implementation "com.google.android.gms:play-services-wearable:$project.gmsVersion"
implementation project(':shared')
implementation "com.google.firebase:firebase-core:$project.firebaseVersion"
implementation "com.google.firebase:firebase-crash:$project.firebaseVersion"
implementation "com.google.firebase:firebase-messaging:$project.firebaseVersion"
implementation "com.google.firebase:firebase-config:$project.firebaseVersion"
implementation "com.google.firebase:firebase-storage:$project.firebaseVersion"
implementation "com.google.firebase:firebase-auth:$project.firebaseVersion"
implementation "com.google.firebase:firebase-invites:$project.firebaseVersion"
implementation "com.android.support:support-annotations:$project.supportVersion";
androidTestImplementation "com.android.support:support-annotations:$project.supportVersion";
// androidTestImplementation 'com.android.support.test:runner:0.5';
// androidTestImplementation 'org.hamcrest:hamcrest-library:1.3';
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'de.greenrobot:eventbus:2.4.1'
implementation 'com.facebook.android:facebook-android-sdk:4.19.0'
implementation 'com.turbomanage.storm:storm-api:1.0'
implementation 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
implementation 'com.yalantis:ucrop:2.2.0'
implementation 'com.google.guava:guava:20.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.8.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
implementation ('com.path:android-priority-jobqueue:1.1.2') {
exclude group: 'xpp3'
}
implementation 'com.facebook.rebound:rebound:0.3.7'
implementation 'com.jakewharton.timber:timber:4.5.1'
implementation 'com.github.chenupt.android:springindicator:1.0.2@aar'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.okio:okio:1.13.0'
implementation 'commons-codec:commons-codec:1.6'
implementation 'com.github.hotchemi:permissionsdispatcher:2.0.8@aar'
implementation 'com.facebook.stetho:stetho:1.4.2'
implementation 'com.facebook.stetho:stetho-okhttp3:1.4.2'
implementation 'com.googlecode.libphonenumber:libphonenumber:7.2.6'
implementation 'com.afollestad:sectioned-recyclerview:0.5.0'
implementation "com.android.support.constraint:constraint-layout:$project.constraintLayoutVersion"
implementation 'pl.bclogic:pulsator4droid:1.0.3'
implementation 'com.github.kaknazaveshtakipishi:PermissionEverywhere:1.0.2'
implementation 'org.aspectj:aspectjtools:1.8.6'
implementation "com.android.support.test.espresso:espresso-idling-resource:$project.espressoVersion"
implementation 'com.jakewharton.espresso:okhttp3-idling-resource:1.0.0'
implementation "com.android.support:support-v4:$project.supportVersion"
implementation "com.android.support:recyclerview-v7:$project.supportVersion"
implementation "com.android.support:design:$project.supportVersion"
implementation ("com.android.support.test.espresso:espresso-core:$project.espressoVersion") {
exclude group: 'com.google.guava'
exclude group: 'com.google.android.gms'
}
androidTestImplementation ('com.android.support.test:runner:1.0.1') {
exclude group: 'net.sf.kxml'
}
androidTestImplementation 'com.android.support.test:rules:1.0.1'
annotationProcessor 'com.turbomanage.storm:storm-impl:1.0'
}
apply plugin: 'com.google.gms.google-services'
我收到的错误消息如下。但它没有提供关于哪些是重复文件的重要线索'位置。
Error:10:05:18.822 [ERROR] [org.gradle.api.Project] Cannot create tasks to upload Proguard Mapping File.java.lang.IllegalStateException: Resolving configuration 'androidTestAnnotationProcessor' directly is not allowed
10:18:18.372 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':app:transformResourcesWithMergeJavaResForCanaryStaging'.
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > More than one file was found with OS independent path 'AndroidManifest.xml'
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
10:18:18.373 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
10:18:18.374 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 17m 14s
我已经启用了调试版本,但除了看到多个AndroidManifests.xml文件这一事实之外,仍然没有任何线索。有没有人遇到过类似的问题?有什么东西可以让我失踪吗?