1. ホーム
  2. ヒラメキ

WindowsでFlutterを設定する際にAndroidのライセンス状態がわからない

2022-03-20 08:48:55

flutter doctorを実行すると、Androidのライセンスステータスが不明であることがわかります。

ArcEngine

flutter doctor --android-licensesを実行すると、エラーが発生します。

Full map export

javaの問題のようです。javac -version で jdk のバージョンを確認してください。

Area export

バージョンが高すぎるため、jdk8への移行が必要です。

jdk8を再ダウンロードした後、環境変数を変更してください。

where javaでjavaのパスがある場所を探し、3つのjavaファイルを削除してください。

再起動後、jdk のバージョンを確認する java -version

Use ESRI.ArcGIS.Carto;
Display;
Output; using ESRI;
Output; using System;
Text; using System;
Forms;

Forms; namespace Win
Forms; namespace Win
    public partial class MainForm : Form
    Form
        public MainForm()
        {
            InitializeComponent();
            axMapControl1.LoadMxFile(@"C:\Users\DSF\Desktop\data\Untitled.mxd");
        }

        //// 

        /// Export button
        /// 
        /// 

        //// 

        private void btnExport_Click(object sender, EventArgs e)
        {
            StringBuilder filter = new StringBuilder();
            filter.Append("PDF(*.pdf)|*.pdf|");
            filter.Append("SVG(*.svg)|*.svg|");
            filter.Append("AI(*.ai)|*.ai|");
            filter.Append("EMF(*.emf)|*.emf|");
            filter.Append("EPS(*.eps)|*.eps|");
            filter.Append("BMP(*.bmp)|*.bmp|");
            filter.Append("PNG(*.png)|*.png|");
            filter.Append("JPEG(*.jpeg)|*.jpeg|");
            filter.Append("TIFF(*.tif)|*.tif|");
            filter.Append("GIF(*.gif)|*.gif");

            // Save the file
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Title = "Export";
            ToString(); saveFileDialog.Filter = filter;
            saveFileDialog.RestoreDirectory = true;
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            OK) {
                ExportMap(saveFileDialog.FileName, 300, 1);
            }
        }

        /// 

        /// Export map method
        /// 
        /// 
Export path
        //// 
Export resolution
        /// 
Resample registration
        private void ExportMap(string filePath, double resolution, int resample)
        {
            IExport pExport = null;
            switch (System.IO.Path.GetExtension(filePath))
            {
                case ".pdf":
                    pExport = new ExportPDF() as IExport;
                    break;
                case ".svg":
                    pExport = new ExportSVG() as IExport;
                    break;
                case ".ai":
                    pExport = new ExportAI() as IExport;
                    break;
                case ".emf":
                    pExport = new ExportEMF() as IExport;
                    break;
                case ".eps":
                    pExport = new ExportPS() as IExport;
                    break;
                case ".bmp":
                    pExport = new ExportBMP() as IExport;
                    break;
                case ".png":
                    pExport = new ExportPNG() as IExport;
                    break;
                case ".jpeg":
                    pExport = new ExportJPEG() as IExport;
                    break;
                case ".tif":
                    pExport = new ExportTIFF() as IExport;
                    break;
                case ".gif":
                    pExport = new ExportGIF() as IExport;
                    break;
                default:
                    pExport = new ExportPDF() as IExport;
                    break;
            }

            // set the export path
            pExport.ExportFileName = filePath;

            // if the exported image, set the resampling level
            if (pExport is IOutputRasterSettings)
            {
                IOutputRasterSettings pOutputRasterSettings = pExport as IOutputRasterSettings;
                pOutputRasterSettings.ResampleRatio = resample;
            }

            // If exporting TIFF, set the coordinate information
            if (pExport is IExportTIFF)
            {
                IExportTIFF pExportTIFF = pExport as IExportTIFF;
                pExportTIFF.GeoTiff = true;
                pExportTIFF.CompressionType = esriTIFFCompression.esriTIFFCompressionJPEG;
            }

            // If you export PDF, then set the PDF format
            if (pExport is IExportPDF)
            {
                IExportPDF pExportPDF = pExport as IExportPDF;
                pExportPDF.Compressed = true;
                EmbedFonts = true. pExportPDF;
                pExportPDF.ImageCompression = esriExportImageCompression.esriExportImageCompressionNone;
            }

            // export the map
            IPrintAndExport pPrintAndExport = new PrintAndExport();
            pPrintAndExport.Export(axMapControl1.ActiveView, pExport, resolution, false, null);
        }
    }
}



再度flutter doctorを実行すると、Androidのライセンスが受け付けられないというエラーが発生します。

Using ESRI.ArcGIS.Carto;
Display;
Display; using ESRI.ArcGIS.esriSystem;
Geometry; using ESRI.ArcGIS;
Output; using ESRI;
Output; using System;
Text; using System;
Forms;

Forms; namespace Win
Forms; namespace Win
    public partial class MainForm : Form
    Form
        public MainForm()
        {
            InitializeComponent();
            axMapControl1.LoadMxFile(@"C:\Users\DSF\Desktop\data\Untitled.mxd");
        }

        //// 

        /// Export button
        /// 
        /// 

        //// 

        private void btnExport_Click(object sender, EventArgs e)
        {
            StringBuilder filter = new StringBuilder();
            filter.Append("PDF(*.pdf)|*.pdf|");
            filter.Append("SVG(*.svg)|*.svg|");
            filter.Append("AI(*.ai)|*.ai|");
            filter.Append("EMF(*.emf)|*.emf|");
            filter.Append("EPS(*.eps)|*.eps|");
            filter.Append("BMP(*.bmp)|*.bmp|");
            filter.Append("PNG(*.png)|*.png|");
            filter.Append("JPEG(*.jpeg)|*.jpeg|");
            filter.Append("TIFF(*.tif)|*.tif|");
            filter.Append("GIF(*.gif)|*.gif");

            // Save the file
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Title = "Export";
            ToString(); saveFileDialog.Filter = filter;
            saveFileDialog.RestoreDirectory = true;
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                ExportMap(saveFileDialog.FileName, 300, 1);
            }
        }

        /// 

        /// Export map method
        /// 
        /// 
Export path
        //// 
Export resolution
        /// 
Resample registration
        private void ExportMap(string filePath, double resolution, int resample)
        {
            IExport pExport = null;
            switch (System.IO.Path.GetExtension(filePath))
            {
                case ".pdf":
                    pExport = new ExportPDF() as IExport;
                    break;
                case ".svg":
                    pExport = new ExportSVG() as IExport;
                    break;
                case ".ai":
                    pExport = new ExportAI() as IExport;
                    break;
                case ".emf":
                    pExport = new ExportEMF() as IExport;
                    break;
                case ".eps":
                    pExport = new ExportPS() as IExport;
                    break;
                case ".bmp":
                    pExport = new ExportBMP() as IExport;
                    break;
                case ".png":
                    pExport = new ExportPNG() as IExport;
                    break;
                case ".jpeg":
                    pExport = new ExportJPEG() as IExport;
                    break;
                case ".tif":
                    pExport = new ExportTIFF() as IExport;
                    break;
                case ".gif":
                    pExport = new ExportGIF() as IExport;
                    break;
                default:
                    pExport = new ExportPDF() as IExport;
                    break;
            }

            // if the exported image, then set the resampling level
            if (pExport is IOutputRasterSettings)
            {
                IOutputRasterSettings pOutputRasterSettings = pExport as IOutputRasterSettings. pOutputRasterSettings;
                pOutputRasterSettings.ResampleRatio = resample;
            }

            // If exporting TIFF, set the coordinate information
            if (pExport is IExportTIFF)
            {
                IExportTIFF pExportTIFF = pExport as IExportTIFF;
                pExportTIFF.GeoTiff = true;
                pExportTIFF.CompressionType = esriTIFFCompression.esriTIFFCompressionJPEG;
                IWorldFileSettings pWorldFileSettings = pExport as IWorldFileSettings;
                pWorldFileSettings.MapExtent = axMapControl1.Extent;
            }

            // If you export PDF, then set the PDF format
            if (pExport is IExportPDF)
            {
                IExportPDF pExportPDF = pExport as IExportPDF;
                pExportPDF.Compressed = true;
                EmbedFonts = true. pExportPDF;
                pExportPDF.ImageCompression = esriExportImageCompression.esriExportImageCompressionNone;
            }

            // Get the resolution
            IActiveView pActiveView = axMapControl1.ActiveView;
            int screenResolution = (int)axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.Resolution;
            int outputResolution = (int)resolution;

            // Calculate the exported range
            tagRECT rect = new tagRECT();
            rect.left = 0;
            rect.top = 0;
            rect.right = (int)(1.0 * pActiveView.ExportFrame.right * outputResolution / screenResolution);
            rect.bottom = (int)(1.0 * pActiveView.ExportFrame.bottom * outputResolution / screenResolution);

            // Set the export range
            IEnvelope pEnvelope = new Envelope() as IEnvelope;
            pEnvelope.PutCoords(rect.left, rect.bottom, rect.right, rect.top);

            // Export parameters
            pExport.Resolution = outputResolution;
            pExport.ExportFileName = filePath;
            pExport.PixelBounds = pEnvelope;

            // Export
            pActiveView.Output(pExport.StartExporting(), outputResolution, ref rect, pActiveView.Extent, null);
            FinishExporting(). pExport;
            Cleanup(). pExport;
        }
    }
}



flutter doctor --android-licensesの後、ずっとyと入力するだけです。

最終結果です。

using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Output;
using System.Text;
using System.Windows.Forms;

namespace Win
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
            axMapControl1.LoadMxFile(@"C:\Users\DSF\Desktop\data\Untitled.mxd");
        }

        /// 

        /// 区域导出
        /// 
        /// 
绘制的矩形
        /// 
导出路径
        /// 
导出分辨率
        /// 
重采样等级
        private void ExportMap(IEnvelope pTrackEnvelope, string filePath, double resolution, int resample)
        {
            IExport pExport = null;
            switch (System.IO.Path.GetExtension(filePath))
            {
                case ".pdf":
                    pExport = new ExportPDF() as IExport;
                    brechen;
                case ".svg":
                    pExport = new ExportSVG() as IExport;
                    break;
                case ".ai":
                    pExport = new ExportAI() as IExport;
                    break;
                case ".emf":
                    pExport = new ExportEMF() as IExport;
                    break;
                case ".eps":
                    pExport = new ExportPS() as IExport;
                    break;
                case ".bmp":
                    pExport = new ExportBMP() as IExport;
                    break;
                case ".png":
                    pExport = new ExportPNG() as IExport;
                    break;
                case ".jpeg":
                    pExport = new ExportJPEG() as IExport;
                    break;
                case ".tif":
                    pExport = new ExportTIFF() as IExport;
                    break;
                case ".gif":
                    pExport = new ExportGIF() as IExport;
                    break;
                default:
                    pExport = new ExportPDF() as IExport;
                    break;
            }

            // 若导出图片,则设置重采样等级
            if (pExport ist IOutputRasterSettings)
            {
                IOutputRasterSettings pOutputRasterSettings = pExport as IOutputRasterSettings;
                pOutputRasterSettings.ResampleRatio = resample;
            }

            // 若导出TIFF,则设置坐标信息
            if (pExport ist IExportTIFF)
            {
                IExportTIFF pExportTIFF = pExport as IExportTIFF;
                pExportTIFF.GeoTiff = true;
                pExportTIFF.CompressionType = esriTIFFCompression.esriTIFFCompressionJPEG;
                IWorldFileSettings pWorldFileSettings = pExport as IWorldFileSettings;
                pWorldFileSettings.MapExtent = axMapControl1.Extent;
            }

            // 若导出PDF,则设置PDF格式
            if (pExport ist IExportPDF)
            {
                IExportPDF pExportPDF = pExport as IExportPDF;
                pExportPDF.Compressed = true;
                pExportPDF.EmbedFonts = true;
                pExportPDF.ImageCompression = esriExportImageCompression.esriExportImageCompressionNone;
            }

            // 分辨率
            IActiveView pActiveView = axMapControl1.ActiveView;
            int screenResolution = (int)axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.Resolution;
            int outputResulotion = (int)resolution;

            // 计算导出区域
            tagRECT rect = new tagRECT();
            pActiveView.ScreenDisplay.DisplayTransformation.TransformRect(pTrackEnvelope, ref rect, 8);
            rect.right = (int)(1.0 * (rect.right - rect.left) * outputResulotion / screenResolution);
            rect.bottom = (int)(1.0 * (rect.bottom - rect.top) * outputResulotion / screenResolution);
            rect.left = 0;
            rect.top = 0;

            // 设置导出区域
            IEnvelope pEnvelope = new Envelope() as IEnvelope;
            pEnvelope.PutCoords(rect.left, rect.top, rect.right, rect.bottom);
            pExport.ExportFileName = filePath;
            pExport.PixelBounds = pEnvelope;

            // 导出
            pActiveView.Output(pExport.StartExporting(), outputResulotion, ref rect, pTrackEnvelope, null);
            pExport.FinishExporting();
            pExport.Cleanup();
        }

        /// 


        /// axMapControl1_OnMouseDown
        /// 
        /// 

        /// 

        private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
        {
            // 绘制一个矩形框
            IEnvelope pTrackEnvelope = axMapControl1.TrackRectangle();
            if (pTrackEnvelope.IsEmpty)
            {
                zurück;
            }

            // 导出文件类型d
            StringBuilder filter = new StringBuilder();
            filter.Append("PDF(*.pdf)|*.pdf|");
            filter.Append("SVG(*.svg)|*.svg|");
            filter.Append("AI(*.ai)|*.ai|");
            filter.Append("EMF(*.emf)|*.emf|");
            filter.Append("EPS(*.eps)|*.eps|");
            filter.Append("BMP(*.bmp)|*.bmp|");
            filter.Append("PNG(*.png)|*.png|");
            filter.Append("JPEG(*.jpeg)|*.jpeg|");
            filter.Append("TIFF(*.tif)|*.tif|");
            filter.Append("GIF(*.gif)|*.gif");

            // 保存文件
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Title = "导出";
            saveFileDialog.Filter = filter.ToString();
            saveFileDialog.RestoreDirectory = true;
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                ExportMap(pTrackEnvelope, saveFileDialog.FileName, 300, 1);
            }
        }
    }
}