简体   繁体   English

如何修复Android Studio中正在运行的应用程序错误

[英]How to fix running application error in Android Studio

I want import this project from Github : NotePad . 我想从Github导入此项目: NotePad
But when running application on my phone, not running and show me this error : 但是在手机上运行应用程序时,无法运行并显示此错误:
在此处输入图片说明

My android studio version is 2.1.3 and this version has lasted version! 我的android studio版本是2.1.3并且这个版本是持续版本! How can I fix this? 我怎样才能解决这个问题?

You should do exactly what the message says. 您应该按照消息中所说的去做。 You have two choices: 您有两种选择:

  1. Disable Instant Run by going to File -> Settings in the menu. 通过转到菜单中的文件->设置禁用即时运行。 In the search bar at the top right of the window, type "Instant Run" and press Enter. 在窗口右上方的搜索栏中,键入“ Instant Run”,然后按Enter。 Now select the checkbox that disables Instant Run. 现在,选中禁用即时运行的复选框。

  2. Update the Gradle plugin by opening build.gradle from the root directory of your project (not the one in the app module). 通过从项目的根目录(而不是app模块中的根目录)中打开build.gradle来更新Gradle插件。 Then find the line that has compile com.android.tools.build:gradle: followed by some version number. 然后找到已compile com.android.tools.build:gradle:的行,后跟一些版本号。 Change the version to 2.1.3 . 将版本更改为2.1.3

I suggest doing the later as you will then be less likely to run into other problems in the future. 我建议您稍后再做,因为这样以后您就不太可能遇到其他问题。

You are miss understanding the error. 您很想了解该错误。 Try updating the following in your gradle file 尝试在gradle文件中更新以下内容

buildscript {
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.3'
    }
}

Here is a reference to the compatibility docs . 这是对兼容性文档的引用。

Go to build.gradle and change this line 转到build.gradle并更改此行

    classpath 'com.android.tools.build:gradle:2.2.0-beta1'

to

    classpath 'com.android.tools.build:gradle:2.1.2'

It should work. 它应该工作。

I'm already using this config with Andorid Studio 2.1.3 我已经在Andorid Studio 2.1.3中使用了此配置

Remove second and third line from dependencies and Add this code 从依赖项中删除第二行和第三行并添加此代码

dependencies {

    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:design:+'
    compile project(':NotePad')

}

It should work Note that you have to provide path of NotePad project inside compile project('') 它应该正常工作,注意您必须在compile project('')提供NotePad项目的路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM