gpt4 book ai didi

java - 错误 :- Execution failed for task ':app:dexDebug' in android studio

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:28:34 26 4
gpt4 key购买 nike

我新的Android项目启动了一个新的默认项目。每次我尝试启动应用程序时都会发生此错误:

build.gradle(模块:app)

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.example.jdevani.validationdemo"
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}

build.gradle(项目:EmerGencyHelp)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

我的错误是

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava
Note: C:\Users\vfinava\Desktop\Project\EmerGencyHelp\app\src\main\java\com\example\vfinava\emergencyhelp\DataHelper.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:preDexDebug
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_20\bin\java.exe'' finished with non-zero exit value 2

Information:BUILD FAILED
Information:Total time: 5.684 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

请帮帮我提前致谢,

最佳答案

可能你没有在项目中正确添加 suport-v4 库。
检查这个:

  1. 你已经将这个库添加到所有需要它的模块中(如果你有不仅仅是项目中的模块,如主模块和库模块)。
  2. 检查您是否添加了该库两次。

最后,如果这没有解决您的问题,请尝试从导入的库列表和项目模块依赖项列表中删除该库,然后从一个来源导入并再次将其添加到您的项目中,然后尝试重建项目或重新启动 IDE。
我希望这种方式可以帮助你:)

关于java - 错误 :- Execution failed for task ':app:dexDebug' in android studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29361693/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com