【问题标题】:Java.exe error while building project in Android Studio在 Android Studio 中构建项目时出现 Java.exe 错误
【发布时间】:2016-01-01 17:19:53
【问题描述】:

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

我在网上搜了一下,他们说可能是由于 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'
}

【问题讨论】:

  • 但是在最新版本的android studio中没有名为libraries的文件夹
  • 没有任何效果,请帮忙!!
  • 您的项目有问题,这就是您收到此错误的原因。然后尝试各种 gradle 构建作业(“构建”、“组装”)以获得更好的错误消息,这很难提供帮助。 (可能是 65K 方法限制,另一个问题是很多东西都可能出错)
  • 你的问题与 Gradle 完全无关。阅读错误信息。 You need to use Theme.AppCompat (or descendant) with the design library. 已经得到了非常多的回答here

标签: java android gradle


【解决方案1】:

尝试删除这一行:

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

或者你可以设置 multiDexEnabled true

defaultConfig {        
    // Enabling multidex support.
    multiDexEnabled true
}

然后再试一次。希望对您有所帮助。

【讨论】:

  • 对不起,我想我错误地发布了错误的错误图像。我整天都在互联网上寻找解决此错误的方法,但没有解决方案。请查看更新后的屏幕截图。
猜你喜欢
  • 1970-01-01
  • 2019-03-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-14
相关资源
最近更新 更多