Android studio 无法在设备上安装应用程序

Android studio fail to install app on device

我有一台 Samsung Galaxy S5 设备 运行ning Android 4.4.2 它工作得很好,直到几周后我开始遇到这个问题,Android Studio 在我按下 运行 并构建 gradle

后无法安装应用程序

其他信息: 我尝试 运行 应用程序第一次运行时在模拟器上运行,在我做了一些更改后,我尝试 运行再次在模拟器上,但没有应用更改

这是 gradle 文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.incorp.anisvikernes.appex"
    minSdkVersion 19
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:cardview-v7:23.1.0'
} 

这是LogCat:

03:49:45 Executing tasks: [clean, :app:generateDebugSources,       :app:generateDebugAndroidTestSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources]
03:51:04 Gradle build finished in 1m 18s 412ms
05:23:54 Executing tasks: [:app:assembleDebug]
05:28:19 Gradle build finished in 4m 25s 153ms
05:28:32 Error during Sync: An existing connection was forcibly closed by the remote host
05:28:32 Session 'app': Error Installing APK

这是错误

08/20 05:28:26: Launching app
$ adb push D:\projects\appex\app\build\outputs\apk\app-debug.apk   /data/local/tmp/com.incorp.anisvikernes.appex
java.io.IOException: An existing connection was forcibly closed by the remote host
Error while Installing APK

我通过

解决了同样的问题
1. Disable USB debugging and developer options
2. Disconnect the device from USB 
3. Re enable USB debugging and developer options
4. Reconnect device 

有人说当时我遇到了杀死和重新启动 adb 的问题。

我实际上找到了解决这个问题的解决方案,它看起来真的很奇怪而且很奇怪但是在 更新我的驱动程序 之后(Win 键+x -> 设备管理器 -> 去我的设备并按下更新按钮)我 更改了用于将 phone 连接到我的 PC 的 USB 数据线 ,它立即可用

经过数小时的失败后,移除 USB 延长线对我有用。 除了您描述的安装 APK 过程之外,任何东西都可以使用 USB 延长线。也许其他人可以通过将 USB 电缆更换为短而稳定的工作电缆来修复它。