Search in sources :

Example 1 with AndroidProjectSettingsService

use of com.android.tools.idea.gradle.structure.editors.AndroidProjectSettingsService in project android by JetBrains.

the class RenderService method getPlatform.

@Nullable
private static AndroidPlatform getPlatform(@NotNull final Module module, @Nullable RenderLogger logger) {
    AndroidPlatform platform = AndroidPlatform.getInstance(module);
    if (platform == null && logger != null) {
        if (!AndroidMavenUtil.isMavenizedModule(module)) {
            RenderProblem.Html message = RenderProblem.create(ERROR);
            logger.addMessage(message);
            message.getHtmlBuilder().addLink("No Android SDK found. Please ", "configure", " an Android SDK.", logger.getLinkManager().createRunnableLink(() -> {
                Project project = module.getProject();
                ProjectSettingsService service = ProjectSettingsService.getInstance(project);
                if (AndroidProjectInfo.getInstance(project).requiresAndroidModel() && service instanceof AndroidProjectSettingsService) {
                    ((AndroidProjectSettingsService) service).openSdkSettings();
                    return;
                }
                AndroidSdkUtils.openModuleDependenciesConfigurable(module);
            }));
        } else {
            String message = AndroidBundle.message("android.maven.cannot.parse.android.sdk.error", module.getName());
            logger.addMessage(RenderProblem.createPlain(ERROR, message));
        }
    }
    return platform;
}
Also used : Project(com.intellij.openapi.project.Project) AndroidProjectSettingsService(com.android.tools.idea.gradle.structure.editors.AndroidProjectSettingsService) ProjectSettingsService(com.intellij.openapi.roots.ui.configuration.ProjectSettingsService) AndroidPlatform(org.jetbrains.android.sdk.AndroidPlatform) AndroidProjectSettingsService(com.android.tools.idea.gradle.structure.editors.AndroidProjectSettingsService) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with AndroidProjectSettingsService

use of com.android.tools.idea.gradle.structure.editors.AndroidProjectSettingsService in project android by JetBrains.

the class GradleApkProvider method validate.

@NotNull
@Override
public List<ValidationError> validate() {
    AndroidModuleModel androidModuleModel = AndroidModuleModel.get(myFacet);
    // This is a Gradle project, there must be an AndroidGradleModel.
    assert androidModuleModel != null;
    if (androidModuleModel.getMainArtifact().isSigned()) {
        return ImmutableList.of();
    }
    AndroidArtifactOutput output = GradleUtil.getOutput(androidModuleModel.getMainArtifact());
    final String message = AndroidBundle.message("run.error.apk.not.signed", output.getMainOutputFile().getOutputFile().getName(), androidModuleModel.getSelectedVariant().getDisplayName());
    Runnable quickFix = new Runnable() {

        @Override
        public void run() {
            Module module = myFacet.getModule();
            ProjectSettingsService service = ProjectSettingsService.getInstance(module.getProject());
            if (service instanceof AndroidProjectSettingsService) {
                ((AndroidProjectSettingsService) service).openSigningConfiguration(module);
            } else {
                service.openModuleSettings(module);
            }
        }
    };
    return ImmutableList.of(ValidationError.fatal(message, quickFix));
}
Also used : AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) AndroidProjectSettingsService(com.android.tools.idea.gradle.structure.editors.AndroidProjectSettingsService) ProjectSettingsService(com.intellij.openapi.roots.ui.configuration.ProjectSettingsService) AndroidProjectSettingsService(com.android.tools.idea.gradle.structure.editors.AndroidProjectSettingsService) AndroidArtifactOutput(com.android.builder.model.AndroidArtifactOutput) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

AndroidProjectSettingsService (com.android.tools.idea.gradle.structure.editors.AndroidProjectSettingsService)2 ProjectSettingsService (com.intellij.openapi.roots.ui.configuration.ProjectSettingsService)2 AndroidArtifactOutput (com.android.builder.model.AndroidArtifactOutput)1 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 Module (com.intellij.openapi.module.Module)1 Project (com.intellij.openapi.project.Project)1 AndroidPlatform (org.jetbrains.android.sdk.AndroidPlatform)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1