use of com.android.repository.api.ProgressIndicator in project kotlin by JetBrains.
the class LintClient method getTargets.
/**
* Returns all the {@link IAndroidTarget} versions installed in the user's SDK install
* area.
*
* @return all the installed targets
*/
@NonNull
public IAndroidTarget[] getTargets() {
if (mTargets == null) {
AndroidSdkHandler sdkHandler = getSdk();
if (sdkHandler != null) {
ProgressIndicator logger = getRepositoryLogger();
Collection<IAndroidTarget> targets = sdkHandler.getAndroidTargetManager(logger).getTargets(logger);
mTargets = targets.toArray(new IAndroidTarget[targets.size()]);
} else {
mTargets = new IAndroidTarget[0];
}
}
return mTargets;
}
use of com.android.repository.api.ProgressIndicator in project android by JetBrains.
the class UnresolvedDependenciesReporter method report.
private void report(@NotNull String dependency, @NotNull Module module, @Nullable VirtualFile buildFile) {
String group = "Unresolved Android dependencies";
GradleCoordinate coordinate = GradleCoordinate.parseCoordinateString(dependency);
RepoPackage constraintPackage = null;
if (coordinate != null) {
ProgressIndicator indicator = new StudioLoggerProgressIndicator(getClass());
reloadRemoteSdkWithModalProgress();
Collection<RemotePackage> remotePackages = getRemotePackages(indicator);
constraintPackage = findBestPackageMatching(coordinate, remotePackages);
}
List<NotificationHyperlink> quickFixes = new ArrayList<>();
if (dependency.startsWith("com.android.support.constraint:constraint-layout:") && !canGetConstraintLayoutFromSdkManager(module)) {
quickFixes.add(new FixAndroidGradlePluginVersionHyperlink());
} else if (constraintPackage != null) {
quickFixes.add(new InstallArtifactHyperlink(constraintPackage.getPath()));
} else if (dependency.startsWith("com.android.support")) {
quickFixes.add(new InstallRepositoryHyperlink(ANDROID));
} else if (dependency.startsWith("com.google.android")) {
quickFixes.add(new InstallRepositoryHyperlink(GOOGLE));
} else {
group = "Unresolved dependencies";
Project project = module.getProject();
if (isOfflineBuildModeEnabled(project)) {
quickFixes.add(new DisableOfflineModeHyperlink());
}
}
String text = "Failed to resolve: " + dependency;
SyncMessage message;
if (buildFile != null) {
PositionInFile position = findDependencyPosition(dependency, buildFile);
message = new SyncMessage(module.getProject(), group, ERROR, position, text);
String hyperlinkText = position.line > -1 ? "Show in File" : "Open File";
quickFixes.add(new OpenFileHyperlink(buildFile.getPath(), hyperlinkText, position.line, position.column));
} else {
message = new SyncMessage(group, ERROR, NonNavigatable.INSTANCE, text);
}
if (IdeInfo.getInstance().isAndroidStudio()) {
if (coordinate != null) {
quickFixes.add(new ShowDependencyInProjectStructureHyperlink(module, coordinate));
}
}
message.add(quickFixes);
getSyncMessages(module).report(message);
}
use of com.android.repository.api.ProgressIndicator in project android by JetBrains.
the class FirstRunWizard method init.
@Override
public void init() {
File initialSdkLocation = FirstRunWizardDefaults.getInitialSdkLocation(myMode);
ConsolidatedProgressStep progressStep = new FirstRunProgressStep();
myComponentsPath = new InstallComponentsPath(myMode, initialSdkLocation, progressStep, true);
if (myMode == FirstRunWizardMode.NEW_INSTALL) {
boolean sdkExists = false;
if (initialSdkLocation.isDirectory()) {
AndroidSdkHandler sdkHandler = AndroidSdkHandler.getInstance(initialSdkLocation);
ProgressIndicator progress = new StudioLoggerProgressIndicator(getClass());
sdkExists = ((AndroidSdkHandler) sdkHandler).getLocalPackage(SdkConstants.FD_TOOLS, progress) != null;
}
addPath(new SingleStepPath(new FirstRunWelcomeStep(sdkExists)));
}
if (myMode == FirstRunWizardMode.NEW_INSTALL) {
if (initialSdkLocation.getPath().isEmpty()) {
// We don't have a default path specified, have to do custom install.
myState.put(KEY_CUSTOM_INSTALL, true);
} else {
addPath(new SingleStepPath(new InstallationTypeWizardStep(KEY_CUSTOM_INSTALL)));
}
addPath(new SingleStepPath(new SelectThemeStep(KEY_CUSTOM_INSTALL)));
}
if (myMode == FirstRunWizardMode.MISSING_SDK) {
addPath(new SingleStepPath(new MissingSdkAlertStep()));
}
addPath(myComponentsPath);
if (SystemInfo.isLinux && myMode == FirstRunWizardMode.NEW_INSTALL) {
addPath(new SingleStepPath(new LinuxHaxmInfoStep()));
}
if (myMode != FirstRunWizardMode.INSTALL_HANDOFF) {
addPath(new SingleStepPath(new LicenseAgreementStep(getDisposable())));
}
addPath(new SingleStepPath(progressStep));
super.init();
}
use of com.android.repository.api.ProgressIndicator in project android by JetBrains.
the class IdeSdks method isJdk7Supported.
public boolean isJdk7Supported(@Nullable AndroidSdkData sdkData) {
if (sdkData != null) {
ProgressIndicator progress = new StudioLoggerProgressIndicator(Jdks.class);
LocalPackage info = sdkData.getSdkHandler().getLocalPackage(SdkConstants.FD_PLATFORM_TOOLS, progress);
if (info != null) {
Revision revision = info.getVersion();
if (revision.getMajor() >= 19) {
JavaSdk jdk = JavaSdk.getInstance();
Sdk sdk = ProjectJdkTable.getInstance().findMostRecentSdkOfType(jdk);
if (sdk != null) {
JavaSdkVersion version = jdk.getVersion(sdk);
if (version != null && version.isAtLeast(JavaSdkVersion.JDK_1_7)) {
return true;
}
}
}
}
}
return false;
}
use of com.android.repository.api.ProgressIndicator in project android by JetBrains.
the class AvdWizardUtils method emulatorSupportsWebp.
@VisibleForTesting
static boolean emulatorSupportsWebp(@NotNull AndroidSdkHandler sdkHandler) {
ProgressIndicator log = new StudioLoggerProgressIndicator(AvdWizardUtils.class);
LocalPackage sdkPackage = sdkHandler.getLocalPackage(FD_EMULATOR, log);
if (sdkPackage == null) {
sdkPackage = sdkHandler.getLocalPackage(FD_TOOLS, log);
}
if (sdkPackage != null) {
Revision version = sdkPackage.getVersion();
// >= 25.2.3?
if (version.getMajor() > 25 || version.getMajor() == 25 && (version.getMinor() > 2 || version.getMinor() == 2 && version.getMicro() >= 3)) {
return true;
}
}
return false;
}
Aggregations