androidInstall 任务导致 "No connected devices!" 错误

androidInstall task causes a "No connected devices!" error

这里有人问Running error using javafx ports但没有给出有用的答案

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':androidInstall'. > com.android.builder.testing.api.DeviceException: java.lang.RuntimeException: No connected devices!

如果需要,这里是构建文件:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
    }
}

apply plugin: 'org.javafxports.jfxmobile'
jfxmobile {
    downConfig {
        version = '3.0.0'
        plugins 'display', 'lifecycle', 'statusbar', 'storage'
    }
    android {
        compileSdkVersion = 23
        manifest = 'src/android/AndroidManifest.xml'
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
        forceLinkClasses = [
                'com.gluonhq.**.*',
                'javax.annotations.**.*',
                'javax.inject.**.*',
                'javax.json.**.*',
                'org.glassfish.json.**.*'
        ]
    }
}

apply plugin: 'com.github.johnrengelman.shadow'
shadowJar {
    configurations = [project.configurations.desktopRuntime]
}

apply plugin: 'eclipse'

repositories {
    jcenter()
    maven {
        url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
    }
}

mainClassName = 'main.GluonApplication'

dependencies {
    compile 'com.gluonhq:charm:4.0.1'
    compileOnly "org.projectlombok:lombok:1.16.10"
}

该设备是 Xperia Z5 紧凑型 Android 6.0。 Windows 10 显示设备已连接,我可以在资源管理器中访问它的文件夹。

不知道我是否需要某种驱动程序或什么。

"No connected devices" 错误通常意味着您没有在您的设备上启用开发者选项。

为此,只需转至设置 -> 关于 phone。向下滚动到底部并找到内部版本号。点击内部版本号字段七次以启用开发人员选项。最后,您会看到消息 "You are now a developer!".

完成后,转到新选项“设置”->“开发人员选项”,向下滚动到“调试”部分,然后启用 "USB Debugging" 开关。第一次将设备插入计算机时,您将被提升为允许 USB 调试。如果你在你的开发机器上,标记复选框,这样它就不会再问你了。

此外,建议您在设置 -> 安全中授权安装来自未知来源的 apk。

现在再次将您的设备连接到计算机的 USB 端口,打开终端并转到 android SDK 文件夹,进入 platform-tools 目录和 运行 adb devices.您应该会看到您的设备已列出。

在那种情况下,您可以再次 运行 gradlew androidInstall