每当我尝试运行我的Android应用程序时,我都会在运行消息日志中收到错误消息.
I/O Error: D:\Apps\Application\app\build\intermediates\classes\debug\app.apk (The system cannot find the file specified)
Run Code Online (Sandbox Code Playgroud)
我不相信这是一个编码错误,因为android studio并没有告诉我我的java类或xml布局中有错误,但是如果你想要代码,请注释.我认为错误在gradle依赖项中.任何人都可以解释如何解决这个问题?
Gradle依赖项:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:7.0.0'
}
Run Code Online (Sandbox Code Playgroud)
注意:我已经google了这个错误,但唯一一个也有这个问题的是这个人(android studio cant build),但答案不适用于我.
这是我的onTouchEvent(MotionEvent事件)的代码:
@Override
public boolean onTouchEvent(MotionEvent event){
int action = event.getAction();
int x = Math.round(event.getX());
int y = Math.round(event.getY());
//play is an imageView
int viewLeft = play.getLeft();
int viewRight = play.getRight();
int viewTop = play.getTop();
int viewBottom = play.getBottom();
boolean onPoint = false;
switch (action) {
case MotionEvent.ACTION_DOWN:
//Checks if the touched area falls within the imageView play
if ((x >= viewLeft && x <= viewRight) && (y >= viewTop && y <= viewBottom)) {
onPoint = true;
play.setImageResource(R.drawable.playyellow);
}
case …Run Code Online (Sandbox Code Playgroud)