关于android:错误:任务执行失败’:app:dexDebug’

Error:Execution failed for task ':app:dexDebug'

本问题已经有最佳答案,请猛点这里访问。

我正在尝试创建一个简单的应用程序,但每次我尝试运行该应用程序时,都会收到此错误。

Error:Execution failed for task ':app:dexDebug'.>com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\Alejandro\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\Alejandro\Dropbox\2o DAM\AndroidStudioProjectsDropbox\FastyFast\app\build\intermediates\dex\debug --input-list=C:\Users\Alejandro\Dropbox\2o DAM\AndroidStudioProjectsDropbox\FastyFast\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: C:\Users\Alejandro\Dropbox\2?o DAM\AndroidStudioProjectsDropbox\FastyFast\app\build\intermediates\classes\debug: file not found
at com.android.dex.util.FileUtils.readFile(FileUtils.java:51)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:169)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
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)
UNEXPECTED TOP-LEVEL EXCEPTION:
java.io.FileNotFoundException: C:\Users\Alejandro\Dropbox\2?o DAM\AndroidStudioProjectsDropbox\FastyFast\app\build\intermediates\pre-dexed\debug\support-annotations-21.0.3-b29fd01b30007e41669b44d2e19fb39eea844240.jar (El sistema no puede encontrar la ruta especificada)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(Unknown Source)
at java.util.zip.ZipFile.(Unknown Source)
at java.util.zip.ZipFile.(Unknown Source)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
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)
UNEXPECTED TOP-LEVEL EXCEPTION:
java.io.FileNotFoundException: C:\Users\Alejandro\Dropbox\2?o DAM\AndroidStudioProjectsDropbox\FastyFast\app\build\intermediates\pre-dexed\debug\internal_impl-21.0.3-5a0c9ff4d81e7e53b50296e4e2549fc036b4b3db.jar (El sistema no puede encontrar la ruta especificada)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(Unknown Source)
at java.util.zip.ZipFile.(Unknown Source)
at java.util.zip.ZipFile.(Unknown Source)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
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)
UNEXPECTED TOP-LEVEL EXCEPTION:
java.io.FileNotFoundException: C:\Users\Alejandro\Dropbox\2?o DAM\AndroidStudioProjectsDropbox\FastyFast\app\build\intermediates\pre-dexed\debug\classes-1a3933f3cfbb63995646d20c10e8ee01b7f2eac5.jar (El sistema no puede encontrar la ruta especificada)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(Unknown Source)
at java.util.zip.ZipFile.(Unknown Source)
at java.util.zip.ZipFile.(Unknown Source)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
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)
UNEXPECTED TOP-LEVEL EXCEPTION:
java.io.FileNotFoundException: C:\Users\Alejandro\Dropbox\2?o DAM\AndroidStudioProjectsDropbox\FastyFast\app\build\intermediates\pre-dexed\debug\classes-1337a4751778935a1a6ca6cffc12c9f23e5cc37f.jar (El sistema no puede encontrar la ruta especificada)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(Unknown Source)
at java.util.zip.ZipFile.(Unknown Source)
at java.util.zip.ZipFile.(Unknown Source)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
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)
5 errors; aborting

我正在寻找解决方案,但我一无所获。

这是我的build.gradle文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion"21.1.2"

    defaultConfig {
        applicationId"com.fasty.fastyfast"
        minSdkVersion 15
        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'
}

这是我的AndroidManifest.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.fasty.fastyfast">

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name">
            <intent-filter>
               

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

我同步时不会崩溃。 使用Gradle Files但我尝试运行该应用程序


C: Users Alejandro Dropbox 2o DAM AndroidStudioProjectsDropbox FastyFast app build intermediates dex debug --input-list = C: Users Alejandro Dropbox 2o DAM AndroidStudioProjectsDropbox FastyFast app build中间体 tmp目录 DEX调试 inputList.txt

o Android或班级无法识别此角色。 我建议你改变项目的名称,放一些没有特殊字符的东西。


我可以看到:

UNEXPECTED TOP-LEVEL EXCEPTION: java.io.FileNotFoundException: C:\Users\Alejandro\Dropbox\2?o DAM\AndroidStudioProjectsDropbox\FastyFast\app\build\intermediates\pre-dexed\debug\internal_impl-21.0.3-5a0c9ff4d81e7e53b50296e4e2549fc036b4b3db.jar

在我看来,2?o不应该在路径中。 奇怪的编码。