Android的工作室摇篮错误 - preDexDebug摇篮、错误、工作室、Android

2023-09-08 08:54:06 作者:゛罗马半夏 Proven

我最近增加了一个新的活动,我的机器人工作室的项目,现在我得到一个错误,当我尝试运行它。它建立罚款,但我得到的,当我运行它的错误如下:

I recently added a new activity to my android studio project and now I am getting an error when I try and run it. It builds fine but I get the error below when I run it:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --output /Users/davidcavanagh/joshcpdandroid/app/build/intermediates/pre-dexed/debug/classes-22ecb8c50fefe43948d87c9fee8e36a6b7d1bb5a.jar /Users/davidcavanagh/joshcpdandroid/app/build/intermediates/exploded-aar/com.android.support/support-v4/20.0.0/classes.jar
  Error Code:
    1

下面是我的build.gradle文件

Here is my build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion '20.0.0'

    defaultConfig {
        applicationId "com.joshcpd.android"
        minSdkVersion 15
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:5.2.08'
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile project(':libraries:zbar')
}

我曾试图消除supportLappcompat的依赖,但后来我得到更多的错误。任何帮助非常AP preciated。

I have tried removing the supportLappcompat dependency but then I get even more errors. Any help greatly appreciated.

推荐答案

我终于被下载摇篮的最新版本解决了这个问题。

I finally solved this issue by downloading the latest version of gradle.

我仍然得到这个错误,每隔一段时间,我只是修复它通过将文件---->无效缓存/重启

I still get this error every so often and I just fix it by going to File ----> Invalidate caches/restart

我觉得Android的工作室是非常错误

I find Android Studio to be very buggy