Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将branch.io添加到我的android项目后出现重复条目错误_Java_Android_Twitter Fabric_Branch.io_Crashlytics Android - Fatal编程技术网

Java 将branch.io添加到我的android项目后出现重复条目错误

Java 将branch.io添加到我的android项目后出现重复条目错误,java,android,twitter-fabric,branch.io,crashlytics-android,Java,Android,Twitter Fabric,Branch.io,Crashlytics Android,一切都很好,但是在把它添加到我的android项目中之后,错误生成apk开始了 Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:com/crashlytics/android/answers/shim/R.class 也

一切都很好,但是在把它添加到我的android项目中之后,错误生成apk开始了

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:com/crashlytics/android/answers/shim/R.class

也尝试排除它,但错误仍然存在。 这是我的满分

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://dl.bintray.com/hani-momanii/maven"}
}


android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.example.app"
    minSdkVersion 19
    targetSdkVersion 25
    multiDexEnabled true
    versionCode 1
    versionName "1.0"
    resConfigs "en_US", "hi_IN"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE-FIREBASE.txt'
    exclude 'META-INF/NOTICE'
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.digits.sdk.android:digits:2.0.6@aar') {
    transitive = true;

}
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
    transitive = true;
}
compile('io.fabric.sdk.android:fabric:1.3.10@aar') {
    transitive = true;
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:gridlayout-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:support-annotations:25.3.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.android.gms:play-services-places:10.2.1'
compile 'com.amazonaws:aws-android-sdk-core:2.2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.2.+'
compile 'com.amazonaws:aws-android-sdk-lambda:2.2.+'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
compile 'com.google.firebase:firebase-crash:10.2.1'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.google.firebase:firebase-storage:10.2.1'
compile 'com.google.firebase:firebase-appindexing:10.2.1'
compile 'com.github.clans:fab:1.6.4'
compile 'com.amazonaws:aws-android-sdk-cognito:2.3.9'
compile 'hani.momanii.supernova_emoji_library:supernova-emoji-library:0.0.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile('io.branch.sdk.android:library:2.6.0@aar') {
    transitive = true;
    exclude module: 'answers-shim'
}

}
apply plugin: 'com.google.gms.google-services'

如果我将exclude语句添加到branch和digits中,那么在进入应用程序时它会崩溃,如果将exclude添加到crashlytics中,错误仍然存在。但是如果不添加branch,一切都会正常工作,在apk构建过程中也不会出现错误。

我今天一整天都在努力解决这个问题。最终为我解决的是将分支回滚到2.5.9。显然,新的2.6.0版本似乎有问题

关于branch的另一个注意事项,我没有可传递的aar include,所以它只是

compile ('io.branch.sdk.android:library:2.5.9') {
    exclude module: 'answers-shim';
}

修复了从依赖项中删除
transitive=true
时的问题
compile('io.branch.sdk.android:library:2.6。0@aar“){
排除模块:“回答垫片”
}

对于希望使用最新版本的branch.io的用户,您必须在proguard文件中添加以下行

-dontwarn com.crashlytics.android.answers.shim.**
-dontwarn com.google.firebase.appindexing.**
-dontwarn com.android.installreferrer.api.**

通过此更改
排除模块:gradle文件中不需要答案填隙片。

嘿,Jarrod,你建议的解决方案就像魅力男人一样有效。干杯:-)太棒了!很高兴我能帮忙。
-dontwarn com.crashlytics.android.answers.shim.**
-dontwarn com.google.firebase.appindexing.**
-dontwarn com.android.installreferrer.api.**