我正在开发一个应用程序,我将在其中使用Google表格/照片以及firestore
。当我在gradle中添加firestore
依赖项时,错误开始出现。如果我删除firestore
,就可以了。以后我既希望Google依赖于照片,也希望firestore
。请帮助
我生成了gradle依赖项,并尝试了诸如“排除番石榴”之类的一些操作。
尝试过-multidex true,干净的rbuild使缓存无效..did不起作用 我觉得某些依赖项重复出现,因此会出现此错误。
app/build gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.savera.nammaflat"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//Google sheets
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'pub.devrel:easypermissions:2.0.1'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-sheets:v4-rev506-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
// Firebase Authentication
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-firestore:18.2.0'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
}
apply plugin: 'com.google.gms.google-services'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
> Task :app:androidDependencies
debug
debugCompileClasspath - Dependencies for compilation
+--- com.android.support:design:28.0.0@aar
+--- pub.devrel:easypermissions:2.0.1@aar
+--- com.android.support:appcompat-v7:28.0.0@aar
+--- com.android.support.constraint:constraint-layout:1.1.3@aar
+--- com.google.android.gms:play-services-auth:16.0.1@aar
+--- com.google.api-client:google-api-client-android:1.23.0@jar
+--- com.google.apis:google-api-services-sheets:v4-rev506-1.23.0@jar
+--- com.google.firebase:firebase-core:16.0.8@aar
+--- com.google.firebase:firebase-firestore:18.2.0@aar
+--- com.google.firebase:firebase-auth:16.2.0@aar
+--- com.android.support:recyclerview-v7:28.0.0@aar
+--- com.android.support:cardview-v7:28.0.0@aar
+--- com.google.android.gms:play-services-auth-api-phone:16.0.0@aar
+--- com.google.android.gms:play-services-auth-base:16.0.0@aar
+--- com.google.firebase:firebase-auth-interop:16.0.1@aar
+--- com.google.android.gms:play-services-flags:16.0.1@aar
+--- com.google.firebase:firebase-analytics:16.4.0@aar
+--- com.google.android.gms:play-services-measurement-api:16.4.0@aar
+--- com.google.firebase:firebase-iid:17.0.3@aar
+--- com.google.firebase:firebase-iid-interop:16.0.1@aar
+--- com.google.android.gms:play-services-base:16.0.1@aar
+--- com.google.firebase:firebase-common:16.1.0@aar
+--- com.google.android.gms:play-services-tasks:16.0.1@aar
+--- com.google.android.gms:play-services-measurement:16.4.0@aar
+--- com.google.android.gms:play-services-measurement-sdk:16.4.0@aar
+--- com.google.android.gms:play-services-measurement-impl:16.4.0@aar
+--- com.google.android.gms:play-services-measurement-sdk-api:16.4.0@aar
+--- com.google.android.gms:play-services-measurement-base:16.4.0@aar
+--- com.google.android.gms:play-services-stats:16.0.1@aar
+--- com.google.firebase:firebase-measurement-connector:17.0.1@aar
+--- com.google.android.gms:play-services-ads-identifier:16.0.0@aar
+--- com.google.android.gms:play-services-basement:16.2.0@aar
+--- com.android.support:support-v4:26.1.0@aar
+--- com.android.support:support-fragment:28.0.0@aar
+--- com.android.support:animated-vector-drawable:28.0.0@aar
+--- com.android.support:support-core-ui:28.0.0@aar
+--- com.android.support:support-core-utils:28.0.0@aar
+--- com.android.support:support-vector-drawable:28.0.0@aar
+--- com.android.support:transition:28.0.0@aar
+--- com.android.support:loader:28.0.0@aar
+--- com.android.support:viewpager:28.0.0@aar
+--- com.android.support:coordinatorlayout:28.0.0@aar
+--- com.android.support:drawerlayout:28.0.0@aar
+--- com.android.support:slidingpanelayout:28.0.0@aar
+--- com.android.support:customview:28.0.0@aar
+--- com.android.support:swiperefreshlayout:28.0.0@aar
+--- com.android.support:asynclayoutinflater:28.0.0@aar
+--- com.android.support:support-media-compat:26.1.0@aar
+--- com.android.support:support-compat:28.0.0@aar
+--- com.android.support:versionedparcelable:28.0.0@aar
+--- com.android.support:collections:28.0.0@jar
+--- com.android.support:cursoradapter:28.0.0@aar
+--- android.arch.lifecycle:runtime:1.1.1@aar
+--- com.android.support:documentfile:28.0.0@aar
+--- com.android.support:localbroadcastmanager:28.0.0@aar
+--- com.android.support:print:28.0.0@aar
+--- android.arch.lifecycle:viewmodel:1.1.1@aar
+--- com.android.support:interpolator:28.0.0@aar
+--- android.arch.lifecycle:livedata:1.1.1@aar
+--- android.arch.lifecycle:livedata-core:1.1.1@aar
+--- android.arch.lifecycle:common:1.1.1@jar
+--- android.arch.core:runtime:1.1.1@aar
+--- android.arch.core:common:1.1.1@jar
+--- com.android.support:support-annotations:28.0.0@jar
+--- com.android.support.constraint:constraint-layout-solver:1.1.3@jar
+--- com.google.api-client:google-api-client:1.23.0@jar
+--- com.google.http-client:google-http-client-android:1.23.0@jar
+--- com.google.firebase:firebase-database-collection:16.0.1@aar
+--- com.google.firebase:protolite-well-known-types:16.0.1@aar
+--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava@jar
+--- io.grpc:grpc-okhttp:1.16.1@jar
+--- com.squareup.okhttp:okhttp:2.7.5@jar
+--- io.grpc:grpc-android:1.16.1@aar
+--- io.grpc:grpc-protobuf-lite:1.16.1@jar
+--- io.grpc:grpc-stub:1.16.1@jar
+--- com.google.oauth-client:google-oauth-client:1.23.0@jar
+--- com.google.http-client:google-http-client-jackson2:1.23.0@jar
+--- com.google.guava:guava-jdk5:17.0@jar
+--- com.google.http-client:google-http-client:1.23.0@jar
+--- com.google.auto.value:auto-value-annotations:1.6@jar
+--- com.google.protobuf:protobuf-lite:3.0.1@jar
+--- com.squareup.okio:okio:1.13.0@jar
+--- io.grpc:grpc-core:1.16.1@jar
+--- com.google.guava:guava:26.0-android@jar
+--- com.google.code.findbugs:jsr305:3.0.2@jar
+--- com.fasterxml.jackson.core:jackson-core:2.1.3@jar
+--- io.grpc:grpc-context:1.16.1@jar
+--- com.google.code.gson:gson:2.7@jar
+--- io.opencensus:opencensus-contrib-grpc-metrics:0.12.3@jar
+--- io.opencensus:opencensus-api:0.12.3@jar
+--- com.google.errorprone:error_prone_annotations:2.2.0@jar
+--- org.codehaus.mojo:animal-sniffer-annotations:1.17@jar
+--- org.checkerframework:checker-compat-qual:2.5.2@jar
\--- com.google.j2objc:j2objc-annotations:1.1@jar
答案 0 :(得分:0)
对此进行了尝试并起作用- Error: Program type already present: com.google.common.annotations.Beta
configurations {
all*.exclude module: 'guava-jdk5'
}
添加此遇到的问题后- 错误:无法在单个dex文件中容纳请求的类 为此,我通过以下操作解决了问题: Error: Cannot fit requested classes in a single dex file (# methods: 67593 > 65536)