<?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: Aalaa Fahiem </title>
    <description>The latest articles on DEV Community by Aalaa Fahiem  (@itsaalaa7).</description>
    <link>https://dev.to/itsaalaa7</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%2F3859289%2Fae7b77d0-955c-4c2f-b8d1-43ddb3012a83.png</url>
      <title>DEV Community: Aalaa Fahiem </title>
      <link>https://dev.to/itsaalaa7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/itsaalaa7"/>
    <language>en</language>
    <item>
      <title>5 Things I Wish I Knew Before Writing My First Android App</title>
      <dc:creator>Aalaa Fahiem </dc:creator>
      <pubDate>Fri, 03 Apr 2026 14:06:48 +0000</pubDate>
      <link>https://dev.to/itsaalaa7/5-things-i-wish-i-knew-before-writing-my-first-android-app-41ki</link>
      <guid>https://dev.to/itsaalaa7/5-things-i-wish-i-knew-before-writing-my-first-android-app-41ki</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article is for beginners building their first Android app using Kotlin and Jetpack Compose.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So I decided to build an Android app. How hard could it be, right?&lt;/p&gt;

&lt;p&gt;Turns out — pretty hard. Not impossible, but full of surprises that nobody warns you about. I'm still learning, but I've already collected a solid list of "why didn't anyone tell me this?" moments. Here are the five biggest ones.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Architecture Isn't Just for Big Projects
&lt;/h2&gt;

&lt;p&gt;When I started, I threw everything into one file. Logic, UI, data fetching — all living together in one giant &lt;code&gt;MainActivity.kt&lt;/code&gt;. It worked… until it didn't.&lt;/p&gt;

&lt;p&gt;The moment I needed to change something, I'd break something else. I had no idea what &lt;strong&gt;MVVM (Model-View-ViewModel)&lt;/strong&gt; was, and honestly the name scared me off.&lt;/p&gt;

&lt;p&gt;Here's what I wish someone had told me earlier:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Architecture isn't about being fancy. It's about not hating your own code two weeks later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Even for a small app, separating your UI (the View) from your logic (the ViewModel) makes everything easier to read, test, and fix. Start with MVVM from day one. Android Jetpack's &lt;code&gt;ViewModel&lt;/code&gt; and  &lt;code&gt;StateFlow&lt;/code&gt;  are built for this — don't ignore them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; Before writing a single line of UI code, ask yourself: &lt;em&gt;where will the logic for this live?&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Android Will Destroy and Recreate Your Activity — Deal With It
&lt;/h2&gt;

&lt;p&gt;This one got me bad.&lt;/p&gt;

&lt;p&gt;I had a form where users filled in their details. When I rotated the phone, &lt;em&gt;everything disappeared&lt;/em&gt;. I panicked. I thought I had a bug. I didn't — that's just Android doing its thing.&lt;/p&gt;

&lt;p&gt;Android &lt;strong&gt;destroys and recreates your Activity&lt;/strong&gt; on configuration changes (like rotation, language change, or dark mode toggle). If you don't handle this, your app loses all its state every time.&lt;/p&gt;

&lt;p&gt;The fix? Use a &lt;code&gt;ViewModel&lt;/code&gt; — it survives configuration changes. Or use &lt;code&gt;rememberSaveable&lt;/code&gt; if you're on Jetpack Compose. Either way, don't store important state directly in your Activity or Fragment and expect it to stick around.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;ExampleScreen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;MyViewModel&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;state&lt;/span&gt; &lt;span class="k"&gt;by&lt;/span&gt; &lt;span class="n"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uiState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;collectAsState&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also: &lt;strong&gt;permissions&lt;/strong&gt;. Don't assume the user has granted them. Don't assume they'll stay granted. Always check before you use a camera, location, or microphone — every single time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; The Android lifecycle is not your enemy, but it will punish you if you ignore it.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Android Studio and Gradle Will Humble You
&lt;/h2&gt;

&lt;p&gt;I expected a smooth coding experience. What I got instead was:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gradle syncing for 4 minutes&lt;/li&gt;
&lt;li&gt;Mysterious build errors with no helpful message&lt;/li&gt;
&lt;li&gt;"Invalidate Caches and Restart" becoming my most-used button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Android Studio is powerful, but it's heavy. Here's what actually helped me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keep Gradle and your dependencies updated&lt;/strong&gt;, but not blindly — always check the changelog before upgrading.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learn the difference&lt;/strong&gt; between &lt;code&gt;implementation&lt;/code&gt;, &lt;code&gt;api&lt;/code&gt;, and &lt;code&gt;testImplementation&lt;/code&gt; in your &lt;code&gt;build.gradle&lt;/code&gt;. It matters.&lt;/li&gt;
&lt;li&gt;When something breaks and you don't know why: clean the project (&lt;code&gt;Build → Clean Project&lt;/code&gt;), then rebuild. Fixes more than it should.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Logcat&lt;/strong&gt; panel is your best friend. Filter by your app's package name and read the errors carefully — they're usually telling you exactly what's wrong.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; Gradle is not magic. Learn the basics of how it works and you'll save yourself hours of frustration.&lt;/p&gt;




&lt;h2&gt;
  
  
  4.  AI Agents Are Powerful — But They Can Quietly Mislead You
&lt;/h2&gt;

&lt;p&gt;When I got stuck, I started asking AI assistants (like ChatGPT or Claude) for help. And honestly? They're incredible. They explain errors in plain English, suggest fixes instantly, and can write boilerplate code in seconds.&lt;/p&gt;

&lt;p&gt;But there's a trap I fell into: &lt;strong&gt;trusting AI output without questioning it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AI agents don't always know the latest Android APIs. They can confidently suggest a method that was deprecated two versions ago, or generate code that compiles fine but behaves incorrectly at runtime. The code &lt;em&gt;looks&lt;/em&gt; right — that's what makes it dangerous for beginners.&lt;/p&gt;

&lt;p&gt;Here's how I learned to use AI tools better:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Always ask it to explain the code&lt;/strong&gt;, not just give it to you. If it can't explain a line clearly, that's a red flag.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-check with the official Android docs.&lt;/strong&gt; AI is a great starting point, not the final word.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tell it your context&lt;/strong&gt; — your API level, whether you're using Compose or XML, Kotlin or Java. Vague questions get vague answers.&lt;/li&gt;
&lt;li&gt;If something feels off about the generated code, &lt;strong&gt;trust that feeling&lt;/strong&gt; and dig deeper.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI is like a very fast, very confident pair programmer who sometimes hallucinates. Use it, but stay in the driver's seat.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; AI agents can save you hours — but only if you understand what they're giving you.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Performance Problems Are Invisible Until They're Not
&lt;/h2&gt;

&lt;p&gt;My first app felt fine on my phone. Then I tested it on an older device and it was &lt;em&gt;sluggish&lt;/em&gt;. Scrolling lists stuttered. The UI froze when loading data.&lt;/p&gt;

&lt;p&gt;Two things caused most of my problems:&lt;/p&gt;

&lt;p&gt;. &lt;strong&gt;Doing heavy work on the main thread.&lt;/strong&gt; Network calls, database reads, file operations — none of these belong on the UI thread. Use coroutines (&lt;code&gt;viewModelScope.launch { }&lt;/code&gt;) &lt;br&gt;
to move work to the background. It's easier than it sounds.&lt;/p&gt;

&lt;p&gt;You don't need to be a performance expert from day one. But knowing &lt;em&gt;that&lt;/em&gt; these issues exist means you can avoid the worst of them early.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; Run your app on a low-end device or emulator occasionally. It'll reveal problems your flagship phone hides.&lt;/p&gt;



&lt;p&gt;Android development has a steep learning curve, and that's okay. Every confusing error message, every configuration change crash, every Gradle failure — it's all part of learning how the platform works.&lt;/p&gt;

&lt;p&gt;If you're just starting out: focus on fundamentals, not features.&lt;/p&gt;

&lt;p&gt;Build small. Break things. Learn why they broke.&lt;/p&gt;

&lt;p&gt;That’s how you actually improve.&lt;/p&gt;

&lt;p&gt;Still learning. Still building. Let me know in the comments if any of these hit close to home — or if there's something &lt;em&gt;you&lt;/em&gt; wish you'd known sooner!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;``
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>android</category>
      <category>architecture</category>
      <category>beginners</category>
      <category>kotlin</category>
    </item>
  </channel>
</rss>
