<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gradle Archives - Creatronix</title>
	<atom:link href="https://creatronix.de/tag/gradle/feed/" rel="self" type="application/rss+xml" />
	<link>https://creatronix.de/tag/gradle/</link>
	<description>My adventures in code &#38; business</description>
	<lastBuildDate>Mon, 06 Jan 2025 09:28:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Pass custom objects via SafeArgs</title>
		<link>https://creatronix.de/pass-custom-objects-via-safeargs/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Tue, 28 Sep 2021 14:26:07 +0000</pubDate>
				<category><![CDATA[Android & iOS development]]></category>
		<category><![CDATA[Kotlin & Java]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[kotlin]]></category>
		<category><![CDATA[parcelable]]></category>
		<category><![CDATA[parcelize]]></category>
		<category><![CDATA[safe args]]></category>
		<guid isPermaLink="false">https://creatronix.de/?p=3711</guid>

					<description><![CDATA[<p>In Passing data between fragments using SafeArgs I showed You how to pass data between -well-  fragments. This included all basic / built-in types like Strings and Integers. In this part I will show you how you can pass custom objects. Peprare your class To use a custom class for passing between fragments it has&#8230;</p>
<p>The post <a href="https://creatronix.de/pass-custom-objects-via-safeargs/">Pass custom objects via SafeArgs</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In <a href="https://creatronix.de/passing-data-between-fragments-using-safeargs/">Passing data between fragments using SafeArgs</a> I showed You how to pass data between -well-  fragments.</p>
<p>This included all basic / built-in types like Strings and Integers.</p>
<p>In this part I will show you how you can pass custom objects.<span id="more-3711"></span></p>
<h2>Peprare your class</h2>
<p>To use a custom class for passing between fragments it has to be of type Parcelable and you must use the annotation @Parcelize</p>
<pre>import android.os.Parcelable
import kotlinx.parcelize.Parcelize

<strong>@Parcelize</strong>
class VideoPlayListItem(val videoID: String, val videoTitle: String): <strong>Parcelable</strong> {

}</pre>
<h2>Gradle Plugin</h2>
<p>Add kotlin-parcelize to your module gradle.build</p>
<pre>plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'androidx.navigation.safeargs.kotlin'
    <strong>id "kotlin-parcelize"</strong></pre>
<h2>Add argument in nav_graph.xml</h2>
<pre>&lt;fragment
    android:id="@+id/VideoPlayerFragment"
    android:name="de.creatronix.levelup.fragments.VideoPlayerFragment"
    android:label="@string/video_player_fragment_label"
    tools:layout="@layout/fragment_video_player"&gt;

    &lt;argument
        android:name="video"
        app:argType="<strong>de.creatronix.levelup.VideoPlayListItem</strong>" /&gt;
&lt;/fragment&gt;</pre>
<h2>Pass data to fragment action</h2>
<pre>val action =
    VideoFragmentDirections.actionVideoFragmentToVideoPlayerFragment(
        clickedItem
    )
findNavController().navigate(action)</pre>
<p>The post <a href="https://creatronix.de/pass-custom-objects-via-safeargs/">Pass custom objects via SafeArgs</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Log4j2 for Kotlin</title>
		<link>https://creatronix.de/log4j2-for-kotlin/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Tue, 20 Apr 2021 13:40:00 +0000</pubDate>
				<category><![CDATA[Kotlin & Java]]></category>
		<category><![CDATA[cook book]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[kotlin]]></category>
		<category><![CDATA[log4j2]]></category>
		<category><![CDATA[logger]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[recipe]]></category>
		<category><![CDATA[Zero-Day Exploit]]></category>
		<guid isPermaLink="false">https://creatronix.de/?p=3555</guid>

					<description><![CDATA[<p>Motivation Logging is a common good practice in software engineering. It enables you to monitor applications in production to gather information about crashes and other malfunctions for further analysis. It is the &#8220;little brother&#8221; of debugging and often a precursor for setting up test cases which can lead to reproducing the bugs on the developers&#8230;</p>
<p>The post <a href="https://creatronix.de/log4j2-for-kotlin/">Log4j2 for Kotlin</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Motivation</h2>
<p>Logging is a common good practice in software engineering. It enables you to monitor applications in production to gather information about crashes and other malfunctions for further analysis. It is the &#8220;little brother&#8221; of debugging and often a precursor for setting up test cases which can lead to reproducing the bugs on the developers machine.</p>
<p>Log4j2 is version 2 of the very famous Apache logging library log4j from the Java ecosystem.</p>
<p>This article describes a minimal working solution for log4j2 with Kotlin and Gradle.</p>
<h2>Dependencies</h2>
<p>To get started with log4j2 add the following lines to your build.gradle file in the dependency section:</p>
<pre>implementation 'org.apache.logging.log4j:log4j-api:2.15.0'
implementation 'org.apache.logging.log4j:log4j-core:2.15.0'</pre>
<p><strong>Please make sure to use the latest </strong><del>2.15.0</del><strong> 2.16.0 to avoid the Zero-Day Exploit! <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45046">More Details</a><br />
</strong></p>
<h2>Configuration</h2>
<p>Create a file with the name log4j2.properties under src/resources with the content:</p>
<pre>status = error

appender.console.type = Console
appender.console.name = LogToConsole
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %m%n

rootLogger.level = error
rootLogger.appenderRef.stdout.ref = LogToConsole</pre>
<h2>Logger</h2>
<p>In your code you can insert the log statements the following way:</p>
<pre>import org.apache.logging.log4j.kotlin.logger

fun main() {
    val log = logger("Main")
    log.trace("Trace")
    log.debug("Debug")
    log.info("Info")
    log.warn("Warn")
    log.error("Error")
    log.fatal("Fatal")
}</pre>
<h2>Log Levels</h2>
<p>In the configuration file you can set the log level.</p>
<p>e.g. rootLogger.level = error will log all log message which are more severe than error including error -&gt; (fatal and error)</p>
<pre>| Log msg |        |       |       |      |      |       |       |     |
|---------|--------|-------|-------|------|------|-------|-------|-----|
| trace   |        |       |       |      |      |       | x     | x   |
| debug   |        |       |       |      |      | x     | x     | x   |
| info    |        |       |       |      | x    | x     | x     | x   |
| warn    |        |       |       | x    | x    | x     | x     | x   |
| error   |        |       | x     | x    | x    | x     | x     | x   |
| fatal   |        | x     | x     | x    | x    | x     | x     | x   |
|         | off    | fatal | error | warn | info | debug | trace | all |
|         | config |       |       |      |      |       |       |     |</pre>
<p>The post <a href="https://creatronix.de/log4j2-for-kotlin/">Log4j2 for Kotlin</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Kotlin Scripts with Gradle</title>
		<link>https://creatronix.de/kotlin-scripts-with-gradle/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Tue, 20 Apr 2021 13:20:44 +0000</pubDate>
				<category><![CDATA[Kotlin & Java]]></category>
		<category><![CDATA[build.gradle]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[kotlin]]></category>
		<category><![CDATA[script]]></category>
		<guid isPermaLink="false">https://creatronix.de/?p=3553</guid>

					<description><![CDATA[<p>If you are using Gradle and you want to run a Kotlin script you have to add the following to your build.gradle file dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib" implementation 'org.jetbrains.kotlin:kotlin-script-runtime:1.4.32' }</p>
<p>The post <a href="https://creatronix.de/kotlin-scripts-with-gradle/">Kotlin Scripts with Gradle</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If you are using Gradle and you want to run a Kotlin script you have to add the following to your build.gradle file</p>
<pre>dependencies {
     implementation "org.jetbrains.kotlin:kotlin-stdlib"
     implementation 'org.jetbrains.kotlin:kotlin-script-runtime:1.4.32'
}</pre>
<p>The post <a href="https://creatronix.de/kotlin-scripts-with-gradle/">Kotlin Scripts with Gradle</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
