本文整理汇总了Java中org.jetbrains.android.sdk.AndroidSdkUtils类的典型用法代码示例。如果您正苦于以下问题:Java AndroidSdkUtils类的具体用法?Java AndroidSdkUtils怎么用?Java AndroidSdkUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidSdkUtils类属于org.jetbrains.android.sdk包,在下文中一共展示了AndroidSdkUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSelectedDevices
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
@NotNull
public IDevice[] getSelectedDevices() {
int[] rows = mySelectedRows != null ? mySelectedRows : myDeviceTable.getSelectedRows();
List<IDevice> result = new ArrayList<IDevice>();
for (int row : rows) {
if (row >= 0) {
Object serial = myDeviceTable.getValueAt(row, SERIAL_COLUMN_INDEX);
final AndroidDebugBridge bridge = AndroidSdkUtils.getDebugBridge(myFacet.getModule().getProject());
if (bridge == null) {
return EMPTY_DEVICE_ARRAY;
}
IDevice[] devices = getFilteredDevices(bridge);
for (IDevice device : devices) {
if (device.getSerialNumber().equals(serial.toString())) {
result.add(device);
break;
}
}
}
}
return result.toArray(new IDevice[result.size()]);
}
开发者ID:zzz40500,项目名称:ADB-Duang,代码行数:23,代码来源:MyDeviceChooser.java
示例2: chooseDevice
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
private IDevice chooseDevice() {
AndroidDebugBridge adb = AndroidSdkUtils.getDebugBridge(project);
if (adb == null) {
showErrorNotification("ADB connection error");
return null;
}
List<IDevice> devices = Arrays.asList(adb.getDevices());
if (devices.isEmpty()) {
showErrorNotification("Can't find any devices");
return null;
}
if (devices.size() == 1) {
return devices.get(0);
}
return new ChooseDialog<IDevice>(project, "Choose Device", devices) {
@Override
protected String getItemName(IDevice d) {
return d.getProperty(IDevice.PROP_DEVICE_MANUFACTURER) + " " + d.getProperty(IDevice.PROP_DEVICE_MODEL)
+ " [" + d.getSerialNumber() + "]";
}
}
.showAndGetResult();
}
开发者ID:shchurov,项目名称:SharedPreferences-Editor-Plugin,代码行数:24,代码来源:OpenEditorAction.java
示例3: computeDownloadSize
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
private long computeDownloadSize(List<IPkgDesc> packages) {
AndroidSdkData data = AndroidSdkUtils.tryToChooseAndroidSdk();
SdkState state = SdkState.getInstance(data);
// Should already be loaded at this point--just reload to be sure.
state.loadSynchronously(SdkState.DEFAULT_EXPIRATION_PERIOD_MS, false, null, null, null, false);
Map<String, UpdatablePkgInfo> sdkPackages = state.getPackages().getConsolidatedPkgs();
long size = 0;
boolean preview =
SdkComponentSource.PREVIEW_CHANNEL.equals(UpdateSettings.getInstance().getExternalUpdateChannels().get(SdkComponentSource.NAME));
for (IPkgDesc pkg : packages) {
String iid = pkg.getInstallId();
UpdatablePkgInfo updatablePkgInfo = sdkPackages.get(iid);
if (updatablePkgInfo == null && iid.endsWith(PkgDesc.PREVIEW_SUFFIX)) {
iid = iid.substring(0, iid.indexOf(PkgDesc.PREVIEW_SUFFIX));
updatablePkgInfo = sdkPackages.get(iid);
}
size += updatablePkgInfo.getRemote(preview).getDownloadSize();
}
return size;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:UpdateInfoDialog.java
示例4: fetchPackages
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
@NotNull
private static Multimap<PkgType, RemotePkgInfo> fetchPackages() {
ConnectionState connectionState = checkInternetConnection();
switch (connectionState) {
case OK:
break;
case NO_CONNECTION:
return ImmutableMultimap.of();
default:
throw new IllegalArgumentException(connectionState.name());
}
SdkState state = SdkState.getInstance(AndroidSdkUtils.tryToChooseAndroidSdk());
state.loadSynchronously(SdkState.DEFAULT_EXPIRATION_PERIOD_MS, false, null, null, null, true);
return state.getPackages().getRemotePkgInfos();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AndroidStudioWelcomeScreenProvider.java
示例5: getSdkDownloadUrl
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
/**
* @return Android SDK download URL
*/
@NotNull
public static String getSdkDownloadUrl() {
String url = System.getProperty("android.sdkurl");
if (!StringUtil.isEmptyOrSpaces(url)) {
File file = new File(url);
if (file.isFile()) {
// Can't use any path => URL utilities as they don't add two slashes
// after the protocol as required by IJ downloader
return LocalFileSystem.PROTOCOL_PREFIX + PathUtil.toSystemIndependentName(file.getAbsolutePath());
}
else {
System.err.println("File " + file.getAbsolutePath() + " does not exist.");
}
}
String downloadUrl = AndroidSdkUtils.getSdkDownloadUrl();
if (downloadUrl == null) {
throw new IllegalStateException("Unsupported OS");
}
return downloadUrl;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FirstRunWizardDefaults.java
示例6: getInitialSdkLocation
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
/**
* Returns initial SDK location. That will be the SDK location from the installer
* handoff file in the handoff case, sdk location location from the preference if set
* or platform-dependant default path.
*/
@NotNull
public static File getInitialSdkLocation(@NotNull FirstRunWizardMode mode) {
File dest = mode.getSdkLocation();
if (dest != null) {
return dest;
}
else {
List<Sdk> sdks = AndroidSdkUtils.getAllAndroidSdks();
Sdk sdk = Iterables.getFirst(sdks, null);
if (sdk != null) {
VirtualFile homeDirectory = sdk.getHomeDirectory();
if (homeDirectory != null) {
return VfsUtilCore.virtualToIoFile(homeDirectory);
}
}
return getDefaultSdkLocation();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FirstRunWizardDefaults.java
示例7: getLabel
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
@NotNull
private static String getLabel(@NotNull IAndroidTarget target) {
if (target.isPlatform()
&& target.getVersion().getApiLevel() <= SdkVersionInfo.HIGHEST_KNOWN_API) {
if (target.getVersion().isPreview()) {
return target.getVersion().getApiString() + ": " + target.getName();
}
String name = SdkVersionInfo.getAndroidName(target.getVersion().getApiLevel());
if (name == null) {
return "API " + Integer.toString(target.getVersion().getApiLevel());
} else {
return name;
}
} else {
return AndroidSdkUtils.getTargetLabel(target);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FormFactorApiComboBox.java
示例8: putSdkDependentParams
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
/**
* Populate the given state with a set of variables that depend on the user's installed SDK. This method should
* be called early in the initialization of a wizard or path.
* Variables:
* Build Tools Version: Used to populate the project level build.gradle with the correct Gradle plugin version number
* If the required build tools version is not installed, a request is added for installation
* SDK Home: The location of the installed SDK
* @param state the state store to populate with the values stored in the SDK
*/
public static void putSdkDependentParams(@NotNull ScopedStateStore state) {
final AndroidSdkData sdkData = AndroidSdkUtils.tryToChooseAndroidSdk();
BuildToolInfo buildTool = sdkData != null ? sdkData.getLatestBuildTool() : null;
FullRevision minimumRequiredBuildToolVersion = FullRevision.parseRevision(SdkConstants.MIN_BUILD_TOOLS_VERSION);
if (buildTool != null && buildTool.getRevision().compareTo(minimumRequiredBuildToolVersion) >= 0) {
state.put(WizardConstants.BUILD_TOOLS_VERSION_KEY, buildTool.getRevision().toString());
} else {
// We need to install a new build tools version
state.listPush(WizardConstants.INSTALL_REQUESTS_KEY, PkgDesc.Builder.newBuildTool(minimumRequiredBuildToolVersion).create());
state.put(WizardConstants.BUILD_TOOLS_VERSION_KEY, minimumRequiredBuildToolVersion.toString());
}
if (sdkData != null) {
// Gradle expects a platform-neutral path
state.put(WizardConstants.SDK_HOME_KEY, FileUtil.toSystemIndependentName(sdkData.getPath()));
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ConfigureAndroidProjectPath.java
示例9: actionPerformed
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
Notifications.Bus.notify(new Notification("Android", "ADB", "ADB requested.", NotificationType.INFORMATION));
Project project = getEventProject(e);
File adb = project == null ? null : AndroidSdkUtils.getAdb(project);
if (adb == null) {
return;
}
ListenableFuture<AndroidDebugBridge> bridge = AdbService.getInstance().getDebugBridge(adb);
Futures.addCallback(bridge, new FutureCallback<AndroidDebugBridge>() {
@Override
public void onSuccess(AndroidDebugBridge result) {
Notifications.Bus.notify(new Notification("Android", "ADB", "ADB obtained", NotificationType.INFORMATION));
}
@Override
public void onFailure(Throwable t) {
Notifications.Bus.notify(new Notification("Android", "ADB", "ADB error: " + t.toString(), NotificationType.INFORMATION));
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GetAdbAction.java
示例10: findProblemPackages
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
/**
* Find packages that might not be able to be installed while studio is running.
* Currently this means packages that are upgrades on windows systems, since windows locks files that are in use.
* @return
*/
private Set<IPkgDesc> findProblemPackages() {
Set<IPkgDesc> result = Sets.newHashSet();
if (!SystemInfo.isWindows) {
return result;
}
SdkState state = SdkState.getInstance(AndroidSdkUtils.tryToChooseAndroidSdk());
state.loadSynchronously(SdkState.DEFAULT_EXPIRATION_PERIOD_MS, false, null, null, null, false);
Set<String> available = Sets.newHashSet();
for (UpdatablePkgInfo update : state.getPackages().getUpdatedPkgs()) {
if (update.hasRemote(false)) {
available.add(update.getRemote(false).getPkgDesc().getInstallId());
}
if (update.hasPreview()) {
available.add(update.getRemote(true).getPkgDesc().getInstallId());
}
}
for (IPkgDesc request : myRequestedPackages) {
if (available.contains(request.getInstallId())) {
// This is an update
result.add(request);
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:SdkQuickfixWizard.java
示例11: performFinishingActions
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
@Override
public void performFinishingActions() {
List<IPkgDesc> skipped = myState.get(SKIPPED_INSTALL_REQUESTS_KEY);
if (skipped != null && !skipped.isEmpty()) {
StringBuilder warningBuilder = new StringBuilder("The following packages were not installed.\n\n Would you like to exit ");
warningBuilder.append(ApplicationNamesInfo.getInstance().getFullProductName());
warningBuilder.append(" and install the following packages using the standalone SDK manager?");
for (IPkgDesc problemPkg : skipped) {
warningBuilder.append("\n");
warningBuilder.append(problemPkg.getListDescription());
}
String restartOption = String.format("Exit %s and launch SDK Manager", ApplicationNamesInfo.getInstance().getProductName());
int result = Messages.showDialog(getProject(), warningBuilder.toString(), "Warning", new String[]{restartOption, "Skip installation"},
0, AllIcons.General.Warning);
if (result == 0) {
startSdkManagerAndExit();
}
}
// We've already installed things, so clearly there's an SDK.
AndroidSdkData data = AndroidSdkUtils.tryToChooseAndroidSdk();
SdkState.getInstance(data).loadAsync(SdkState.DEFAULT_EXPIRATION_PERIOD_MS, false, null, null, null, true);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SdkQuickfixWizard.java
示例12: getRemoteArchives
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
private List<ArchiveInfo> getRemoteArchives(boolean includeAll) {
SdkState state = SdkState.getInstance(AndroidSdkUtils.tryToChooseAndroidSdk());
state.loadSynchronously(SdkState.DEFAULT_EXPIRATION_PERIOD_MS, false, null, null, null, false);
List<ArchiveInfo> result = Lists.newArrayList();
for (UpdatablePkgInfo update : state.getPackages().getConsolidatedPkgs().values()) {
for (RemotePkgInfo remote : update.getAllRemotes()) {
if (includeAll || !remote.isObsolete()) {
for (Archive archive : remote.getArchives()) {
if (archive.isCompatible()) {
result.add(new ArchiveInfo(archive, update.getLocalInfo(), null));
}
}
}
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:UpdaterData.java
示例13: testGradlePlus
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
public void testGradlePlus() throws Exception {
// Needs a valid SDK; can't use the mock one in the test data.
AndroidSdkData prevSdkData = AndroidSdkUtils.tryToChooseAndroidSdk();
if (prevSdkData == null) {
String recentSdkPath = AndroidTestBase.getRecentSdkPath();
String platformDir = AndroidTestBase.getRecentPlatformDir();
if (recentSdkPath == null || platformDir == null) {
System.out.println("Not running " + this.getClass() + "#" + getName() + ": Needs SDK with Support Repo installed");
return;
}
Sdk androidSdk = createAndroidSdk(recentSdkPath, platformDir);
AndroidPlatform androidPlatform = AndroidPlatform.getInstance(androidSdk);
assertNotNull(androidPlatform);
// Put default platforms in the list before non-default ones so they'll be looked at first.
AndroidSdkUtils.setSdkData(androidPlatform.getSdkData());
}
// NOTE: The android support repository must be installed in the SDK used by the test!
doTestWithFix(new AndroidLintInspectionToolProvider.AndroidLintGradleDynamicVersionInspection(),
"Replace with specific version", "build.gradle", "gradle");
AndroidSdkUtils.setSdkData(prevSdkData);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AndroidLintTest.java
示例14: testJdk7
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
public void testJdk7() throws Exception {
if (DISABLED) {
return;
}
AndroidSdkData sdkData = AndroidSdkUtils.tryToChooseAndroidSdk();
assertNotNull(sdkData);
if (ConfigureAndroidModuleStep.isJdk7Supported(sdkData)) {
IAndroidTarget[] targets = sdkData.getTargets();
IAndroidTarget target = targets[targets.length - 1];
Map<String,Object> overrides = Maps.newHashMap();
overrides.put(ATTR_JAVA_VERSION, "1.7");
NewProjectWizardState state = createNewProjectState(true, sdkData);
// TODO: Allow null activity state!
File activity = findTemplate("activities", "BlankActivity");
TemplateWizardState activityState = state.getActivityTemplateState();
assertNotNull(activity);
activityState.setTemplateLocation(activity);
checkApiTarget(19, 19, target, state, "Test17", null, overrides);
} else {
System.out.println("JDK 7 not supported by current SDK manager: not testing");
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TemplateTest.java
示例15: testJdk5
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
public void testJdk5() throws Exception {
if (DISABLED) {
return;
}
AndroidSdkData sdkData = AndroidSdkUtils.tryToChooseAndroidSdk();
assertNotNull(sdkData);
IAndroidTarget[] targets = sdkData.getTargets();
IAndroidTarget target = targets[targets.length - 1];
Map<String,Object> overrides = Maps.newHashMap();
overrides.put(ATTR_JAVA_VERSION, "1.5");
NewProjectWizardState state = createNewProjectState(true, sdkData);
// TODO: Allow null activity state!
File activity = findTemplate("activities", "BlankActivity");
TemplateWizardState activityState = state.getActivityTemplateState();
assertNotNull(activity);
activityState.setTemplateLocation(activity);
checkApiTarget(8, 18, target, state, "Test15", null, overrides);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:TemplateTest.java
示例16: initDevices
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
private boolean initDevices(Project project) {
boolean update = true;
if (bridge == null) {
bridge = AndroidSdkUtils.getDebugBridge(project);
}
deviceList.clear();
if (bridge != null) {
IDevice[] devices = bridge.getDevices();
if (devices != null) {
for (IDevice device : devices) {
if (selectDevice != null) {
if (device.getName().equals(selectDevice.getName()) && device.getSerialNumber().equals(selectDevice.getSerialNumber())) {
selectDevice = device;
update = false;
}
}
deviceList.add(device);
}
}
if (deviceList.size() > 0 && selectDevice == null) {
selectDevice = deviceList.get(0);
update = true;
}
} else {
update = false;
}
return update;
}
开发者ID:zzz40500,项目名称:ADB-Duang,代码行数:29,代码来源:WindowTool.java
示例17: getAdbPath
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
public static String getAdbPath() {
String adbPath = Properties.instance().pjLevel().getValue(Config.ADB_PATH);
if (Utils.isBlank(adbPath)) {
final File adbFile = AndroidSdkUtils.getAdb(Global.instance().project());
if (adbFile != null) {
adbPath = adbFile.getAbsolutePath();
Properties.instance().pjLevel().setValue(Config.ADB_PATH, adbPath);
}
}
return adbPath;
}
开发者ID:huazhouwang,项目名称:WIFIADB,代码行数:15,代码来源:Utils.java
示例18: createComponent
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
@Nullable
@Override
public JComponent createComponent() {
AndroidSdkData data = AndroidSdkUtils.tryToChooseAndroidSdk();
if (data == null) {
JPanel errorPanel = new JPanel();
errorPanel.add(new JBLabel("Failed to find android sdk"));
return errorPanel;
}
final Runnable channelChangedCallback = new Runnable() {
@Override
public void run() {
boolean newIncludePreview =
SdkComponentSource.PREVIEW_CHANNEL.equals(UpdateSettings.getInstance().getExternalUpdateChannels().get(SdkComponentSource.NAME));
if (newIncludePreview != myIncludePreview) {
myIncludePreview = newIncludePreview;
myPanel.setIncludePreview(myIncludePreview);
}
}
};
SdkState state = SdkState.getInstance(data);
myPanel = new SdkUpdaterConfigPanel(state, channelChangedCallback);
JComponent component = myPanel.getComponent();
component.addAncestorListener(new AncestorListenerAdapter() {
@Override
public void ancestorAdded(AncestorEvent event) {
channelChangedCallback.run();
}
});
return myPanel.getComponent();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:SdkUpdaterConfigurable.java
示例19: initIfNecessary
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
private boolean initIfNecessary() {
if (mySdkState != null) {
return true;
}
AndroidSdkData data = AndroidSdkUtils.tryToChooseAndroidSdk();
if (data == null) {
Logger.getInstance(getClass()).warn("Couldn't find existing SDK");
return false;
}
mySdkState = SdkState.getInstance(data);
mySources = mySdkState.getRemoteSdk().fetchSources(RemoteSdk.DEFAULT_EXPIRATION_PERIOD_MS, ILOG);
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:SdkComponentSource.java
示例20: loadDevices
import org.jetbrains.android.sdk.AndroidSdkUtils; //导入依赖的package包/类
private void loadDevices() {
final AndroidDebugBridge bridge = AndroidSdkUtils.getDebugBridge(myProject);
final IDevice[] devices = bridge != null ? getDevicesWithValidDeviceId(bridge) : new IDevice[0];
final String deviceId = myDataSource.getState().deviceId;
final DefaultComboBoxModel model = new DefaultComboBoxModel(devices);
Object selectedItem = null;
if (deviceId != null && deviceId.length() > 0) {
for (IDevice device : devices) {
if (deviceId.equals(AndroidDbUtil.getDeviceId(device))) {
selectedItem = device;
break;
}
}
if (selectedItem == null) {
model.addElement(deviceId);
myMissingDeviceIds = deviceId;
selectedItem = deviceId;
}
}
myDeviceComboBoxModel = model;
myDeviceComboBox.setModel(model);
if (selectedItem != null) {
myDeviceComboBox.setSelectedItem(selectedItem);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidDataSourcePropertiesDialog.java
注:本文中的org.jetbrains.android.sdk.AndroidSdkUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论