java - 在Android Studio中构建项目时出现Java.exe错误

标签 java android gradle

创建新项目后,当我尝试运行应用程序时,它显示生成失败错误。

我在互联网上搜索它,他们说这可能是由于gradle的重复库或gradle文件中的重复依赖项引起的,但事实并非如此。

这是我的build.gradle文件:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "com.example.naveenjain.ayusch"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }   
 } 
}

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

enter image description here

最佳答案

尝试删除此行:

compile fileTree(dir: 'libs', include: ['*.jar'])

或者,您可以将multiDexEnabled 设置为true :
defaultConfig {        
    // Enabling multidex support.
    multiDexEnabled true
}

然后再试一次。希望能帮助到你。

关于java - 在Android Studio中构建项目时出现Java.exe错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34558251/

相关文章:

java - 带有 'doLast' 的空源 jar,搞砸了子项目依赖关系,但没有

java - 在 Apache Tomcat 服务器 7.0 中部署 PHP 和 Java EE 应用程序

java - 为什么 ExecutorService 等待所有线程完成而 Completablefuture 不等待?

android - 如何使用 ContentValues 将 android sqlite 数据库列值更新为 null?

java - OnRequestPermissionsResultCallback 未在 PreferenceFragment 中触发

android - 每个构建类型的 resConfig

Java 8 + Hibernate 5 MySQL TIMESTAMP/DATETIME 到 LocalDateTime 映射

java - Gradle - 将 JavaFX SDK 添加到类路径

android - 适合 Android Imageview 矩阵屏幕中心

gradle - 使用Gradle 5.x和更高版本GZip每个文件