Skip to content

Commit c4afd99

Browse files
committed
show message if devices with no permissions are found
1 parent 58d859d commit c4afd99

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/processing/mode/android/Devices.java

+18
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,26 @@ class Devices {
4444
private static final String ADB_DEVICES_ERROR =
4545
"Received unfamiliar output from “adb devices”.\n" +
4646
"The device list may have errors.";
47+
48+
private static final String DEVICE_PERMISSIONS_URL =
49+
"https://developer.android.com/studio/run/device.html";
50+
51+
private static final String DEVICE_PERMISSIONS_TITLE =
52+
"Found devices with no permissions!";
53+
54+
private static final String DEVICE_PERMISSIONS_MESSAGE =
55+
"Make sure that the device has USB debugging enabled, and that the required " +
56+
"USB drivers are installed on Windows, and that permissions are properly configured on Linux. " +
57+
"Also, on Linux, don't set the USB configuration to \"charging\" while debugging.<br><br>" +
58+
"Read this guide on <a href=\"" + DEVICE_PERMISSIONS_URL + "\">runnings apps on hardware device</a> " +
59+
"for more details.";
4760

4861
private static final Devices INSTANCE = new Devices();
4962

5063
private static final String BT_DEBUG_PORT = "4444";
5164

65+
private boolean showPermissionsErrorMessage = true;
66+
5267
private AndroidSDK sdk;
5368

5469
private Device selectedDevice;
@@ -364,6 +379,9 @@ public List<String> list() {
364379
final String[] fields = line.split("\t");
365380
if (fields[1].equals("device")) {
366381
devices.add(fields[0]);
382+
} else if (fields[1].contains("no permissions") && showPermissionsErrorMessage) {
383+
AndroidUtil.showMessage(DEVICE_PERMISSIONS_TITLE, DEVICE_PERMISSIONS_MESSAGE);
384+
showPermissionsErrorMessage = false;
367385
}
368386
}
369387
}

0 commit comments

Comments
 (0)