<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dmitrii Leonov</title>
    <description>The latest articles on DEV Community by Dmitrii Leonov (@leonov_dmitrii).</description>
    <link>https://dev.to/leonov_dmitrii</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F673211%2F5201cfc6-4452-4f04-adc5-03a069e37e75.jpeg</url>
      <title>DEV Community: Dmitrii Leonov</title>
      <link>https://dev.to/leonov_dmitrii</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/leonov_dmitrii"/>
    <language>en</language>
    <item>
      <title>Debugging Deep Links and App Links in Android</title>
      <dc:creator>Dmitrii Leonov</dc:creator>
      <pubDate>Mon, 18 Jul 2022 15:23:00 +0000</pubDate>
      <link>https://dev.to/leonov_dmitrii/debugging-deep-links-and-app-links-in-android-3ih5</link>
      <guid>https://dev.to/leonov_dmitrii/debugging-deep-links-and-app-links-in-android-3ih5</guid>
      <description>&lt;p&gt;Most of the time, it is quite simple to debug a deep link just run your app start attach debugger, and fire a deep link, it is straightforward and can be done without any adb command. &lt;/p&gt;

&lt;p&gt;But what if you need to start an app with a deep link/app link? How do you attach the debugger then? Well, it's time for adb. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;1. Run this command once, so that your app will be waiting for the debugger to be attached before starting it.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb shell am set-debug-app -w --persistent &amp;lt;com.app.package&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;2. Trigger your deep link specifying activity that has an intent filter to recognize deep link sheme&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb shell am start -W -a android.intent.action.VIEW -d "&amp;lt;your-deep-link-url&amp;gt;" &amp;lt;com.app.package&amp;gt;.&amp;lt;your-activity-that-handle-intent&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;n. Once done, remove the effect applied by step #1&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb shell am clear-debug-app &amp;lt;com.app.package&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;More concrete example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb shell am set-debug-app -w --persistent com.example.myapp

adb shell am start -W -a android.intent.action.VIEW -d "https://my-app-host-link.com/detail_screen_path?id=100" com.example.myapp.MainActivity

adb shell am clear-debug-app com.example.myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>android</category>
      <category>kotlin</category>
    </item>
    <item>
      <title>Gradle and Groovy Magic</title>
      <dc:creator>Dmitrii Leonov</dc:creator>
      <pubDate>Mon, 18 Jul 2022 15:17:00 +0000</pubDate>
      <link>https://dev.to/leonov_dmitrii/gradle-and-groovy-magic-4aa2</link>
      <guid>https://dev.to/leonov_dmitrii/gradle-and-groovy-magic-4aa2</guid>
      <description>&lt;p&gt;Gradle can be pretty confusing at times, especially for Android developers working on small and medium projects. In Android project Gradle is set up by default and we rarely feel a need to explore how and why things work.&lt;/p&gt;

&lt;p&gt;Here are some questions and answers that you might've had regarding Gradle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Why do we use &lt;code&gt;gradlew taskName&lt;/code&gt; instead of &lt;code&gt;gradle taskName&lt;/code&gt; to execute a task?&lt;/strong&gt;&lt;br&gt;
It is because in our projects we use Gradle wrapper to have 1 version of Gradle among all the developers of the project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Android Studio's Modules and Gradle's Projects&lt;/strong&gt;&lt;br&gt;
An Android project is also a Gradle project. Gradle has a 1-to-1 relationship between its projects and &lt;code&gt;build.gralde&lt;/code&gt; files. At the same what Android studio calls a "module", in Gradle is referred as sub-project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Should I use &lt;code&gt;'&lt;/code&gt; or &lt;code&gt;"&lt;/code&gt; for string literals?&lt;/strong&gt;&lt;br&gt;
Groovy, which is one of the languages used along with Kotlin to describe Gradle script, recognises both double and single quotation marks as a string.&lt;br&gt;
String types in Groovy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;'Hello World 1' - String&lt;/li&gt;
&lt;li&gt;"Hello World 2" - String&lt;/li&gt;
&lt;li&gt;"Hello World $count" - GString&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Function calls, properties, and when to use round brackets?&lt;/strong&gt;&lt;br&gt;
In Groovy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If a function has at least one parameter you can ignore curly brackets.
Fields are properties, so each class field generates setter and getter for a declared field.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Look at the code below and try to guess, how many times will the &lt;code&gt;Foo.name()&lt;/code&gt; function will be triggered when executing &lt;code&gt;./gradlew showMagic&lt;/code&gt;?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Foo {
    def name = ""

    void name(String newString) {
        name = newString
        println("Foo.name() triggered")
    }
}

tasks.create("showMagic") {
    doFirst {
        group "Whole new group"
        description "Check setter and getter capabilities"

        def foo = new Foo()

        foo.name = "string 1"
        println("showMagic() ${foo.name}")
        foo.name("string 2")
        println("showMagic() ${foo.name}")
        foo.name "string 3"
        println("showMagic() ${foo.name}")
        foo.setName("string 4")
        println("showMagic() ${foo.name}")
        foo.setName "string 5"
        println("showMagic() ${foo.name}")
        String propertyOrFunctionName = "name"
        foo."$propertyOrFunctionName" = "string 6"
        println("showMagic() ${foo.name}")
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;showMagic() string 1
Foo.name() triggered
showMagic() string 2
Foo.name() triggered
showMagic() string 3
showMagic() string 4
showMagic() string 5
showMagic() string 6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Functions with multiple parameters&lt;/strong&gt;&lt;br&gt;
As you might have guessed from the code above, we can ignore round brackets and pass multiple parameters separated by commas:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void foo(String url, String parameter) {
    println url
    println parameter
}

tasks.create("callFoo") {
    doFirst {
        foo "google.com", 'consistency'
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>gradle</category>
      <category>android</category>
    </item>
  </channel>
</rss>
