问题描述
我该如何解决这个问题?
我在新电脑上安装Android的工作室,我选择了一个新的项目,我跟着向导,然后不添加任何code和不改变我试图运行新的应用程序生成的文件任何东西。
这是我得到:
How do I solve this?I installed Android Studio on a new computer, I opted for a new Project, I followed the wizard and then without adding any code and without changing anything in the generated files I tried to run the new app.This is what I get :
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files (x86)\Android\android-studio\sdk\build-tools\19.1.0\dx.bat --dex --output F:\==Android\TestingGradle2\app\build\intermediates\pre-dexed\debug\support-v4-19.1.0-e311e493b238b75da4095bd5ee7b69d76d73dc42.jar C:\Program Files (x86)\Android\android-studio\sdk\extras\android\m2repository\com\android\support\support-v4\19.1.0\support-v4-19.1.0.jar
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.io.FileNotFoundException: Android\TestingGradle2\app\build\intermediates\pre-dexed\debug\support-v4-19.1.0-e311e493b238b75da4095bd5ee7b69d76d73dc42.jar (The system cannot find the path specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:220)
at java.util.zip.ZipFile.<init>(ZipFile.java:150)
at java.util.zip.ZipFile.<init>(ZipFile.java:164)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
1 error; aborting
更新
UPDATE
本的build.gradle生成这个样子的:
The build.gradle generated looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "ro.mycomp.calinutz.testgradle4"
minSdkVersion 10
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.android.support:appcompat-v7:20.0.0'
}
并没有从一开始就出现问题......我设法在安装之后创建一个测试应用程序,但后来我试图导入不同的计算机上创建的项目(旧)。我没有成功,所以我去和手动重建项目(相关code的复制粘贴)。
最后,当我想运行重建项目,这个错误发生。从那之后,任何新的空项目我开始,出现同样的错误。
The problem did not occur from the start... I managed to create a test app right after installing, but then I tried to import a project created on a different computer (the old one). I did not succeed, so I went on and recreated the project manually (copy paste of the relevant code).At the end, when I wanted to run the recreated project , this error occured. And ever since then, any new empty project I start, the same error occurs.
但是,我仍然可以运行我的第一次测试APP?!?!?!?!为什么?为什么一个工作,并没有其他的项目?我比较了2的build.gradle文件(原项目和新的空项目)也绝对没有什么区别。
这是否有一些与此有关的Windows 8.1系统上书写的权利?我开始在Android工作室作为管理员,所以它不应该有这样的任何问题......?但究竟是什么呢?
HOWEVER, I CAN STILL RUN MY FIRST TEST APP ?!?!?!?! Why? Why does that one work, and no other project? I compared the 2 build.gradle files (original project and new empty project) and there is absolutely no difference.Does this have something to do with writing rights on this Windows 8.1 system? I start the Android Studio as Administrator, so it should not have any problems like that...? But what is it then?
重要提示
我想我已经缩小了问题:
IMPORTANTI think I have narrowed down the problem:
看来,如果我创建的分区F中的新项目,而不是C分区,出现此错误。
所以,如果我的新项目位于本地磁盘C - 它工作正常
如果我的新项目位于本地磁盘的F - ,它抛出上述错误
So if my new project is located on Local Disk C - it works fineIf my new project is located on Local Disk F - it throws the aforementioned error.
我能做些什么?我不能把基于C我所有的项目,因为它是一个SSD驱动器,它的小。
我去属性 - > Sharing->高级Sharing->为F盘的权限,并将其设置为完全访问权限。
然后我去属性 - >安全性并确保所有用户那里列出必须该驱动器完全访问。
还是 - 同样的问题
What can I do? I cannot put all my projects on C because it is a SSD drive and it's small.I went to Properties->Sharing->Advanced Sharing->Permissions for the F drive and set them to Full Access.Then I went to Properties-> Security and made sure all users listed there have Full Access to the drive.Still - same problem.
请帮我
我怎样才能解决这个问题?
谢谢
Please help meHow can I solve this?Thank you
推荐答案
您已经安装了支持库版本20,但告诉gradle这个找19版的。
You have Support library version 20 installed, but are telling gradle to look for version 19.
依赖行更改为:
compile 'com.android.support:support-v4:20.+'
和它应该正常工作
这篇关于Android的工作室 - 意外顶级例外空项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!