Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/374.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.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 程序类型已存在:android.support.v13.view.DragAndDropPermissionsCompat_Java_Android_Firebase - Fatal编程技术网

Java 程序类型已存在:android.support.v13.view.DragAndDropPermissionsCompat

Java 程序类型已存在:android.support.v13.view.DragAndDropPermissionsCompat,java,android,firebase,Java,Android,Firebase,我将Android studio更新为3.1,更新后出现此错误: Program type already present: android.support.v13.view.DragAndDropPermissionsCompat Message{kind=ERROR, text=Program type already present: android.support.v13.view.DragAndDropPermissionsCompat, sources=[Unknown s

我将Android studio更新为3.1,更新后出现此错误:

 Program type already present: android.support.v13.view.DragAndDropPermissionsCompat
    Message{kind=ERROR, text=Program type already present: android.support.v13.view.DragAndDropPermissionsCompat, sources=[Unknown source file], tool name=Optional.of(D8)}
org.gradle.api.tasks.TaskExecutionException:任务的执行失败:“应用程序:transformDexArchiveWithExternalLibsDexMergerForDebug”

原因:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException

原因:com.android.tools.r8.CompilationFailedException:编译未能完成 >


这可能是因为build.gradle文件中存在重复项。您正在使用相同库的不同版本:

 implementation 'com.google.firebase:firebase-auth:12.0.0'
 implementation 'com.google.firebase:firebase-database:12.0.0'
 implementation 'com.google.firebase:firebase-storage:12.0.0'
implementation 'com.soundcloud.android:android-crop:1.0.1@aar'
implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
implementation 'com.appeaser.sublimepickerlibrary:sublimepickerlibrary:2.1.1'

这可能就是原因。将maven{url”“}添加到根级别build.gradle,Firebase依赖项现在可以通过maven.google.com获得。首先,您必须检查模块build.gradle中是否存在重复的依赖项。如果在项目中运行以下行(在本例中,app是您的模块名):

如果您使用的是linux

或者,如果您使用的是Windows,请使用以下命令

您可以在那里查看依赖关系树并检查重复的库

以下依赖项使用旧版本的支持库:

 implementation 'com.google.firebase:firebase-auth:12.0.0'
 implementation 'com.google.firebase:firebase-database:12.0.0'
 implementation 'com.google.firebase:firebase-storage:12.0.0'
implementation 'com.soundcloud.android:android-crop:1.0.1@aar'
implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
implementation 'com.appeaser.sublimepickerlibrary:sublimepickerlibrary:2.1.1'
因此,您需要从中排除支持库

然后,您还有重复的依赖关系行

您的build.gradle依赖项应该如下所示:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    // support design implicitly using appcompat-v7 and support-v4
    //implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.android.support:support-annotations:27.1.0'
    implementation 'com.android.support:gridlayout-v7:27.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.0'


    implementation 'com.google.firebase:firebase-storage:12.0.0'
    implementation 'com.google.firebase:firebase-auth:12.0.0'
    implementation 'com.google.firebase:firebase-database:12.0.0'

    implementation ('com.soundcloud.android:android-crop:1.0.1@aar') {
         exclude group: 'com.android.support'
         exclude module: 'support-annotations'
         exclude module: 'support-v4'
    }

    implementation ('com.github.dmytrodanylyk.android-process-button:library:1.0.4') {
         exclude group: 'com.android.support'
         exclude module: 'support-v4'
    }

    implementation 'com.appeaser.sublimepickerlibrary:sublimepickerlibrary:2.1.1') {
         exclude group: 'com.android.support'
         exclude module: 'appcompat-v7'
         exclude module: 'support-v4'
         exclude module: 'support-annotations'
         exclude module: 'gridlayout-v7'
    }

    implementation 'com.github.yukuku:ambilwarna:2.0.1'
    implementation 'com.wdullaer:materialdatetimepicker:3.5.1'
    implementation 'com.hbb20:ccp:2.1.4'
    implementation 'com.github.clans:fab:1.6.4'

    implementation ('com.bignerdranch.android:recyclerview-multiselect:0.2') {
         exclude group: 'com.android.support'
         exclude module: 'appcompat-v7'
         exclude module: 'recyclerview-v7'
    }


    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.github.yalantis:ucrop:2.2.1'
}

在gradle文件的依赖项中配置它

    configurations {
    all*.exclude group: 'com.android.support', module: 'support-v13'
    }
例如:-

dependencies {

    configurations {
    all*.exclude group: 'com.android.support', module: 'support-v13'
    }
    //dependencies.....
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
}

这个应用程序级依赖项中的代码对我很有用

dependencies {
    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v13'
    }
}
对我来说:

Build->Clean项目

在Android Studio中,几乎总能解决问题,只有一次我不得不:


File->Invalidate Cache/Restart…

在cordova中,这可以通过对这些库使用相同的API级别来引入:

 implementation 'com.google.firebase:firebase-auth:12.0.0'
 implementation 'com.google.firebase:firebase-database:12.0.0'
 implementation 'com.google.firebase:firebase-storage:12.0.0'
implementation 'com.soundcloud.android:android-crop:1.0.1@aar'
implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
implementation 'com.appeaser.sublimepickerlibrary:sublimepickerlibrary:2.1.1'
cordova.system.library.1=com.android.support:support-v4:26.+ cordova.system.library.3=com.android.support:support-v13:26.+

在platforms/android的project.properties文件中。
如果这些API级别不匹配,将引入android.support.v13.view.DragAndDropPermissionsCompat错误。

同样的问题。。是support-v13库具有不同的version@xcesco是的,在花了三个小时后,我用configure'support-v13'修复了这个问题。最后我得到了解决方案,谢谢大家。我也在这上面花了好几个小时-嘿,我没有更好的事要做,对吗?我的依赖项树中没有冲突,但此修复程序在我找到的其他修复程序中没有冲突。对我来说,它是配置{all*.exclude group:'com.android.support',module:'support-v4'all*.exclude group:'com.android.support',module:'support compat'}./gradlew app:dependencies在何处添加此行以查看重复的Dependency您需要在终端上运行它(如果您使用的是Windows,则使用cmd或命令提示符)。您需要首先通过终端转到项目目录。当我删除时,它是这样写的。/prefixoops。。很抱歉,
/
是用于在linux终端上运行的。您应该使用Clearify窗口和linux命令编辑您的答案,这会对像我这样的开发人员造成误解;)