簡體   English   中英

Android Studio 無法在設備上安裝應用程序

[英]Android studio fail to install app on device

我有一台運行Android 4.4.2三星 Galaxy S5設備,它運行良好,直到幾周前我開始遇到這個問題,在我按下運行並構建 gradle 后,Android Studio 無法安裝該應用程序

附加信息:我第一次嘗試在模擬器上運行該應用程序,在我做了一些更改后,我嘗試再次在模擬器上運行,但沒有應用更改

這是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 -> 設備管理器 -> 轉到我的設備並按下更新按鈕)我改變了用於連接的 USB 電纜電話到我的電腦,它立即工作

經過數小時的失敗,移除 USB 擴展電纜對我有用。 除了您所描述的安裝 APK 過程之外,任何使用 USB 擴展電纜的方法都可以使用。 也許其他人可以通過將 USB 電纜更改為短而穩定的工作電纜來修復它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM