{"id":17505,"date":"2019-05-08T14:03:42","date_gmt":"2019-05-08T14:03:42","guid":{"rendered":"https:\/\/blog.jetbrains.com\/dotnet\/?p=21485"},"modified":"2019-05-08T14:03:42","modified_gmt":"2019-05-08T14:03:42","slug":"androidmanifest-xml-logcat-android-profiling-xamarin-android-rider-2019-1","status":"publish","type":"dotnet","link":"https:\/\/blog.jetbrains.com\/zh-hans\/dotnet\/2019\/05\/08\/androidmanifest-xml-logcat-android-profiling-xamarin-android-rider-2019-1","title":{"rendered":"AndroidManifest.xml, Logcat and Android Profiling &#8211; Xamarin Android in Rider 2019.1"},"content":{"rendered":"<p>This is the second post looking at the <strong>updated features in <a href=\"https:\/\/www.jetbrains.com\/rider\/\" target=\"_blank\" rel=\"noopener\">Rider 2019.1<\/a> for Xamarin Android<\/strong>.\u00a0In the previous post, we covered\u00a0<a href=\"https:\/\/blog.jetbrains.com\/dotnet\/2019\/05\/06\/xamarin-android-visual-designer-layout-inspector-rider-2019-1\/\">Xamarin Android Visual Designer and Layout Inspector<\/a>.\u00a0In this post, we will cover <strong>several new\u00a0UI-based development features<\/strong> for the Android flavor of Xamarin.<\/p>\n<p>We will look at <strong>working with the <em>AndroidManifest.xml<\/em> file<\/strong>, the <strong>Logcat Tool Window<\/strong>, <strong>Android Profiler<\/strong>, and more. We are very excited to be bringing these to everyone to have the best experience developing Xamarin projects.<!--more--><\/p>\n<h2>AndroidManifest.xml\u00a0Code Completion<\/h2>\n<p><strong>Editing the <em>AndroidManifest.xml<\/em> file for a Xamarin has not been easy\u00a0by hand<\/strong>.\u00a0Now, with the ability to add and modify elements in the file, developers can quickly add and update the elements of the manifest such as <code>&lt;uses-sdk&gt;<\/code> or <code>&lt;activity&gt;<\/code>.<\/p>\n<p>The\u00a0<em>AndroidManifest.xml<\/em>\u00a0file contains important information for our Android applications like defining the packaging name and components used in the project and gives the Android operating system information on resources that need permissions. <strong>We do not need to look up names for the permissions for\u00a0accessing contacts, using location services or sending SMS.<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21450\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/04\/dotnet-Rider-Xamarin-Manifest-Completion-191-EAP.png\" alt=\"Rider's Xamarin Manifest XML Completion\" width=\"800\" height=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/04\/dotnet-Rider-Xamarin-Manifest-Completion-191-EAP.gif\" \/><\/p>\n<h2>Logcat Tool Window<\/h2>\n<p>The need to debug and <strong>examine the logs on remote and emulated\u00a0Android devices<\/strong> is key to the Xamarin development process and that is the expertise of the new Logcat Tool Window. To open this Tool Window, go to <strong>View | Tool Windows | Logcat<\/strong>.<\/p>\n<p>With Logcat, you can connect and observe any process on the selected device through the dropdown lists at the top of the window. We can also filter the logs to see the information we want again through a dropdown located along the top of the window: <em>Verbose (All)<\/em>, <em>Debug<\/em>, <em>Info messages<\/em>, <em>Warnings<\/em>, <em>Errors,<\/em> and <em>Asserts<\/em>. Now we get this of this information within the Rider IDE at our fingertips.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21438\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/04\/dotnet-Rider-Xamarin-Logcat-191-EAP.png\" alt=\"Rider's Xamarin Logcat ToolWindow\" width=\"1600\" height=\"1200\" \/><\/p>\n<h2>Android Profiler<\/h2>\n<p>The Android Profiler Tool Window is the best way to explore and find those areas where our Xamarin projects may need to be looked at further. With the profiler active, we can see the <strong>CPU, memory and network utilization<\/strong>\u00a0of the selected process running\u00a0on the Android device.<\/p>\n<p>This is also nice to look at other processes that may be consuming more resources while the Xamarin Android app is running and being tested. To open this Tool Windows, go to <strong>View | Tool Windows | Android Profiler<\/strong>.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"image-21439&quot;\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/04\/dotnet-Rider-Xamarin-AndroidProfiler-191-EAP.png\" alt=\"Rider's Xamarin Android Profiler\" width=\"800\" height=\"600\" \/><\/p>\n<h2>Device File Explorer Tool Window<\/h2>\n<p>To <strong>view the files on the connected Android device or emulator<\/strong>, use the Device File tool window. You will find it in the menu under <strong>Tools | Android | Device File Explorer<\/strong>. This tool window\u00a0is useful to <strong>examine files that are created by your app, or if you need to transfer files to and from a device<\/strong>.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21440\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/04\/dotnet-Rider-Xamarin-DeviceFileExplorer-191-EAP.png\" alt=\"Rider's Xamarin Device File Explorer\" width=\"800\" height=\"600\" \/><\/p>\n<h2>AVD Manager<\/h2>\n<p>With a large number of Android devices in the market today, we need to test on a wide number of device configurations. Having enough physical devices is not possible sometimes and that is why we need to have virtual devices for testing purposes.<\/p>\n<p>Using the AVD Manager in Rider keeps track of the <strong>Android devices at our disposal for testing Xamarin projects<\/strong>. With the AVD Manager, we can create not only Android phone emulators but also wearables, tablets and TV emulators for a richer test environment. You can find the AVD Manager under <strong>Tools | Android | AVD Manager<\/strong>.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21441\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/04\/dotnet-Rider-Xamarin-AVDManager-191-EAP.png\" alt=\"Rider's Xamarin AVD Manager\" width=\"800\" height=\"600\" \/><\/p>\n<h3>Creating New Virtual Devices<\/h3>\n<p>To create a new Android virtual device, select the <strong>+ Create Virtual Device&#8230;<\/strong> button located on the AVD Manager dialog. We will be presented with a wizard that will walk through the process and allow us to selected either\u00a0a brand and model of Android devices or we can create or import new profiles. The new virtual device will then be present in the AVD Manager for testing our Xamarin projects.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21442\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/04\/dotnet-Rider-Xamarin-NewVirtualDevice-191-EAP.png\" alt=\"Rider's Xamarin New Virtual Device Dialog\" width=\"800\" height=\"600\" \/><\/p>\n<h2>Analyze APK Files in Rider<\/h2>\n<p>We can also analyze Android application package files (APK) inside Rider. To open a .apk file selected <strong>Tools | Android | Analyze APK&#8230;<\/strong>. We will be presented with a dialog to locate and select the file to be opened. This helps us to <strong>inspect embedded .dex files (Dalvik Executable Format, the bytecode of our Android program), track resources within our app, and even help reduce the size of our APK so users can download it faster<\/strong>.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21446\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/04\/dotnet-Rider-Xamarin-AnalyzeAPK-Selection-191-EAP.png\" alt=\"Rider's Xamarin Select APK File\" width=\"800\" height=\"600\" \/><\/p>\n<p>Once opened, the APK file can be audited in Rider&#8217;s window as shown below.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21447\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/04\/dotnet-Rider-Xamarin-AnalyzeAPK-191-EAP.png\" alt=\"Rider's Xamarin Analyze APK Window\" width=\"800\" height=\"600\" \/><\/p>\n<p>The additions and updates in the latest version of Rider for Xamarin Android development\u00a0are a huge step forward!<\/p>\n<p><strong><a href=\"https:\/\/www.jetbrains.com\/rider\/download\" target=\"_blank\" rel=\"noopener\">Download Rider 2019.1<\/a>\u00a0and give it a try!<\/strong> We&#8217;d love\u00a0to hear your feedback regarding the entire Xamarin development experience!<\/p>\n","protected":false},"author":774,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","categories":[1401],"tags":[156,1123,1978,1912],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet\/17505"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/types\/dotnet"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/users\/774"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=17505"}],"version-history":[{"count":0,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet\/17505\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=17505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=17505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=17505"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/cross-post-tag?post=17505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}