无法打开调试端口:java.net.SocketException异常“关闭套接字” [英] Unable to open debugger port : java.net.SocketException “Socket closed”

查看:905
本文介绍了无法打开调试端口:java.net.SocketException异常“关闭套接字”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Android的工作室,有多种口味用摇篮,每一个Debug和Release类型,组织所描述的在这里,在下半部分。当我试图启动调试器,我得到这个错误:

I'm using Android Studio, with multiple flavors using Gradle, each with a Debug and Release type, organized as described here, on the bottom half.When I try to start the debugger, I get this error:

Error running androidRecover [installAppDebug]: Unable to open debugger port :     java.net.SocketException "Socket closed

我也无法将调试器附加到我的设备一旦它运行(只显示我的手机,而不是应用程序的名称)。

I'm also unable to attach the debugger to my device once it's running (it only displays the name of my phone, not the app).

3的所有口味的安装在我的手机就好了。我只是不能得到它让我调试。我还测试调试器附加上的Nexus平板电脑,而我得到了相同的结果。

All 3 flavors install on my phone just fine. I just can't get it to let me debug them. I also tested attaching the debugger on a Nexus tablet, and I got the same result.

这不是摇篮特别是作为一个整体,因为我可以运行其他的摇篮 - 基于应用程序和附加调试就好了,所以我不知道这件事情与我怎么样了设置我的摇篮项目和设置。

It's not Gradle specifically as a whole because I can run other Gradle-based apps and attach the debugger just fine so I wonder if it's something with how I've setup my Gradle project and settings.

下面是我的build.gradle:

Here's my build.gradle:

apply plugin: 'android'
apply from: 'signing.gradle'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.3'

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
    }

    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile
                     ('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    productFlavors {
        flav1 {
            packageName "com.ex.flav1"
            versionCode 32
            versionName "1.0.5"
            signingConfig signingConfigs.flav1
        }

        flav2 {
            packageName "com.ex.flav2"
            versionCode 33
            versionName "1.0.6"
            signingConfig signingConfigs.flav2
        }

        flav3 {
            packageName "com.ex.flav3"
            versionCode 27
            versionName "1.0.0"
            signingConfig signingConfigs.flav3
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:19.+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/httpmime-4.2.5.jar')
}

我真的不知道还有什么尝试。 Android的工作室是完全取决于最新的。我已经重新启动Android的工作室,我的电话,我的电脑。

I really have no idea what else to try. Android Studio is completely up-to-date. I've restarted Android Studio, my phone, and my computer.

此外,上周我是有这个问题,但它是被封锁,从试图运行仿真器和我的手机在同一时间的特定插座。我也注意到我曾多次摇篮进程运行,因为它不是杀了他们自己,这是我经常不得不杀机器人工作室要杀死他们。一旦固定,它正在关闭和打开。

Also, last week I was having this problem, but it was a specific socket that was blocked, from trying to run the emulator and my phone at the same time. I also noticed I had multiple Gradle processes running, because it wasn't killing them on its own, which I often had to kill Android Studio to kill them. Once that was fixed, it was working off and on.

让我知道如果你需要任何其他信息。

Let me know if you need any other info.

谢谢, 德文

修改我终于知道为什么@ hasanaydogar的回答工作的,为什么它可能会解决我的问题,如果我们早知道呢。见我就可以了第二评论知道为什么,但总之,你必须在选择下拉列表中匹配您的应用程序的根目录名。

Edit I finally know why @hasanaydogar's answer works and why it probably would have solved my problem if we had known it then. See my 2nd comment on it to know why, but in short, you have to select in that dropdown the name that matches your app's root directory.

推荐答案

只要按一下按钮(左边的RUN键)。

Just Click the button (left side the RUN button).

选择Android系统。然后运行。

Select Android. Then Run.

它会连接到您的设备。

和不要忘记改变构建变量

And dont forget to change build variant

这篇关于无法打开调试端口:java.net.SocketException异常“关闭套接字”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆