Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Studio“:运行“hello world”应用程序时出现应用程序:dexDebug”错误_Android_Android Studio_Build Error - Fatal编程技术网

Android Studio“:运行“hello world”应用程序时出现应用程序:dexDebug”错误

Android Studio“:运行“hello world”应用程序时出现应用程序:dexDebug”错误,android,android-studio,build-error,Android,Android Studio,Build Error,我希望你们能帮我解决这个问题: 我在Android Studio 1.0.2上一个稳定版本中创建了一个新项目,目前我正在Windows7 64位上编写这个项目。 这是一个自定义的“Hello world”应用程序新项目->空白活动,等等。 当我点击“运行应用程序”按钮时,我在Gradle控制台上收到下一个错误: Executing tasks: [:app:assembleDebug] Configuration on demand is an incubating feature. :app

我希望你们能帮我解决这个问题:

我在Android Studio 1.0.2上一个稳定版本中创建了一个新项目,目前我正在Windows7 64位上编写这个项目。 这是一个自定义的“Hello world”应用程序新项目->空白活动,等等。 当我点击“运行应用程序”按钮时,我在Gradle控制台上收到下一个错误:

Executing tasks: [:app:assembleDebug]

Configuration on demand is an incubating feature.
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
: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
:app:preDexDebug
:app:dexDebug
trouble writing output: java.security.NoSuchAlgorithmException: MessageDigest SHA-1 implementation not found

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Users\dbaker\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\dbaker\AndroidStudioProjects\MyApplication\app\build\intermediates\dex\debug --input-list=C:\Users\dbaker\AndroidStudioProjects\MyApplication\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
    2
Output:

    trouble writing output: java.security.NoSuchAlgorithmException: MessageDigest SHA-1 implementation not found


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.626 secs
这是我在项目的build.gradle文件中的内容:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.dbaker.myapplication"
        minSdkVersion 21
        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'])
}
我已经在Stackoverflow和其他网站上搜索了解决方案,但我尝试了所有可能的解决方案,没有一个对我有效,或者可能是我做错了什么

希望你能帮助我,谢谢


德里克

应该有一个文件$JAVA_JDK/jre/lib/security/JAVA.security,您必须在其中选择一个有用的提供者。在我的机器上,段落看起来像这样

你检查过这个@pyus13了吗?我已经检查过了。我为STUDIO_JDK创建了一个系统环境变量,它指向我的JDK 1.7.0_09 oracle jdkIt!Android Studio直到我创建了Studio_JDK变量才开始工作,但在运行应用程序时,程序似乎仍然使用默认的JAVA_HOME变量,而不是Studio_JDK变量。当我将JAVA_HOME的路径更改为我的JDK 7时,它起了作用!现在的问题是:如何保持JAVA_HOME变量指向ibmjdk,但仍然可以运行我的应用程序?我将检查是否可以在项目设置中的某个位置更改项目JDK路径。谢谢