我希望你们能给我一些帮助:
我在 Windows 1.0.2上的 Android Studio 1.0.2(我写这篇文章时是最后一个稳定版本)中创建了一个新项目,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:UsersdbakerAppDataLocalAndroidsdkbuild-tools21.1.2dx.bat --dex --no-optimize --output C:UsersdbakerAndroidStudioProjectsMyApplicationappbuildintermediatesdexdebug --input-list=C:UsersdbakerAndroidStudioProjectsMyApplicationappbuildintermediatestmpdexdebuginputList.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,你必须在其中选择一个有用的提供程序。在我的机器上,该段落如下所示https://stackoverflow.com/a/16895455/2438200