/r/androiddev

Photograph via snooOG

News for Android developers with the who, what, where, when and how of the Android community.

News / Articles / Talks / Tools / Open source!

About

News for Android app developers with the who, what, where, when, and how of the Android community. Probably mostly the how.

Here, you'll find:

  • News for Android developers
  • Thoughtful, informative articles
  • Insightful talks and presentations
  • Useful libraries
  • Handy tools
  • Open source applications for studying

Alternatives

This sub-reddit isn't about phones' and apps' general functionality, support, or system software development (ROMs). For news and questions about these topics try using other subs like

New Developer Resources

Build your first app

Starting Android career in 2022

Android Job Interview Questions and Answers

App Portfolio Ideas, Tiered List

Awesome Android UI

Material Design Icons

7000 Icons for Jetpack

Weekly Threads Calendar

Autoposted at approx 9AM EST / 2PM GMT

Links

Rules!

Wiki and FAQ!

Discord!

/r/androiddev

242,609 Subscribers

3

Created Paranoid's Pal - Android application for locking device

Hi r/androiddev šŸ‘¾

If you are paranoid and obsessed with privacy the app will help you in critical situations.

I wanted to combine usability and would be happy to get your feedback šŸš€

You can check out the source code - https://github.com/hardalgorithm/ParanoidsPal-PrivacyLock

0 Comments
2024/11/10
08:30 UTC

1

Need Guidance on Legal Requirements for Android Apps

Hi everyone,

Iā€™m an independent Android developer with several apps published on the Google Play Store. My apps are simple and only display AdMob ads; they donā€™t collect, store, or process any user data beyond what AdMob might handle.

Recently, Iā€™ve been concerned about the legal side of things, especially since Iā€™m based in Europe and need to comply with GDPR. I want to make sure my apps are completely legal, but the process feels overwhelming for a small developer like me. Hereā€™s what Iā€™ve done and what Iā€™m unsure about:

1.	GDPR Consent: I understand that in Europe, I need to display a consent dialog for AdMob ads. How exactly should this be implemented to be compliant?
2.	Privacy Policy: I know I need one, but what should it include if my apps donā€™t collect data directly (only AdMob does)?
  1. Play Store Data Safety Section: Iā€™m confused about what to declare here since AdMob handles the data. If I use mediation and other ad networks in the future, would I need to update this and my privacy policy? 4. Privacy Policy Link in the App: Should I also include a link to my privacy policy within the app itself? Iā€™ve noticed many apps donā€™t seem to do this. Is it required? 5. Googleā€™s Role in Compliance: If Google approves my app for publication, does that mean my app is fully legal and compliant, or is compliance entirely on me regardless of Googleā€™s approval?

What I also find confusing is whether most developers actually follow these legal requirements. There are so many apps out there, and it seems like not everyone is doing this. Do developers often skip these steps, or is this something Google and regulatory bodies take very seriously?

I want to ensure everything is legal and avoid any future issues, but I feel lost with all the regulations. If anyone can share clear steps or resources (especially for small developers like me), Iā€™d really appreciate it.

Thanks for your help!

1 Comment
2024/11/10
07:42 UTC

5

Why is my app icon and app name not showing?

I have recently been in the closed testing phase for my app and have noticed that my app only displays a default app icon and not the name that I chose on for the Google Play Store. How do I fix this or is this normal for the closed testing period?

3 Comments
2024/11/10
01:03 UTC

8

Do room database ā€œfree upā€ deleted pk for autoGenerate?

Say I use int for my auto generated pk, and the limit of int is about 2 billion, does that mean I can have simultaneously 2B entry, or a total of 2B inserts to this database?

If I delete the item with pk 1, will autoGenerate know 1 is available to be the pk again?

9 Comments
2024/11/09
17:36 UTC

3

šŸ”„ New features available in Inspektify šŸ”„

Android-related features:

  • Stable Ktor 3.0.0 support
  • Shortcut for mobile client
  • Pretty print of request and response payloads
  • Search in Details Pages of Network Traffic
  • Text Selection Enabled on Details Pages

Read more about it here:
https://medium.com/p/93d7fddae8c0

1 Comment
2024/11/08
10:18 UTC

54

Toughest interview questions you ever got asked?

I will start. Weirdest question I got was probably this:

Do you agree or disagree that we can replace Builder pattern with data classes in Kotlin?

I answered some gibberish but the correct answer was that Builder pattern is still very useful when we want to initialize complex objects.

90 Comments
2024/11/08
08:52 UTC

5

How to build subscription tiers?

Hi,

For my company we are developing an app where we have multiple subscriptions. All these subscriptions belong to one "group" as so to speak. When reading the docs it is confusing how Google Play Store handles this.

In the docs they come with different tiers ("Gold", "Silver"). In their documentation and images this one tier represents a single subscription.

But at the section Allow Users to upgrade, downgrade, change their subscription, they say this: If you sell multiple subscription tiers, such as basic and premium subscriptions, you can allow users to switch tiers by purchasing different subscription's base plan or offer.

I'm not a native speaker, but in my opinion this contradicts eachother. So atm I do not know which way to pick.

As an business example:

A user buys a subscription which allows him 50 items on a monthly basis. When he buys the subscription which gives access to 100 items, this means that he should be able upgrade to 100 items on a monthly basis, disregarding the earlier 50 since this is a lower tier.

With apple you have such thing as subscription groups, which is exactly what we wanted. When you upgrade, apple let's you pay the difference in cost and you use the upgraded subscription until the end of the month where it gets renewed with the upgraded subscription.

1 Comment
2024/11/08
07:54 UTC

0

Catching Incoming RCS Messages

Hi! I'm looking for a way to get notified about incoming RCS messages from different services or users, specifically to handle incoming message events. I found Google's RCS Business Messaging API, but it seems like it's only meant for businesses to send messages, not to receive them.

Iā€™ve also heard about a Samsung API for RCS. Does it work on newer Android devices?

Lastly, is there a way to check if RCS is supported or enabled on the phone programmatically?

Any info is appreciated. Thanks!

2 Comments
2024/11/08
05:07 UTC

2

Personal vs organization google console account

I made an app for a real state agency that showcases it's projects etc Now they want to publish it on Google play The problem is the company is located in algeria and don't have duns number yet which takes a month to get Is it a good approach to create an individual account for the CEO and publish the app in that account even though it's about his "organization"?

7 Comments
2024/11/08
04:45 UTC

2

Google Play shows "not compatible with your device" despite device being listed as compatible in Play Console

I'm losing my mind here. I have a React Native app on Google Play that works fine for most people, but some users can't even find it in the store. When they use a direct link, they get the "not compatible with your device" message.

The weird part? These EXACT SAME devices:

  • Are listed as compatible in Play Console
  • Can run the app perfectly when I give them the APK directly
  • Are in the right country (app is Czech Republic only)
  • Previously had the app installed via APK during testing (but that was uninstalled)

I've checked literally everything:

  • App targets Android 6.0+ (SDK 23)
  • No weird hardware requirements
  • No screen size restrictions
  • No RAM requirements
  • No device blocklist
  • All permissions are standard (location, audio, etc.)
  • Using standard app bundle (.aab)
  • Published over a week ago, so caches should be updated
  • Users have 18+ accounts

Tested on:

  • Realme 6 (Android 11)
  • Some Samsung with Android 9

(Probably affects more devices but these are the ones I could test)

I've gone through all the Android manifest stuff, checked all Play Console settings multiple times, and everything LOOKS correct. The app is doing fine with most users, but these specific devices just won't play ball with the Play Store version.

Any ideas what could be causing this? Happy to provide more technical details if needed, but I'm running out of things to check. šŸ˜©

Edit: If anyone needs the technical nitty-gritty (manifest, config), I can add it in the comments.

15 Comments
2024/11/07
22:15 UTC

32

Android Studio plugin to automatically generate Compose @Previews

Hey Android Devs!

A while ago I thought would be nice to automate generating composables @ Previews with standard placeholders by "simply pressing a button" in the IDE. I then thought that could actually become true by developing an intelliJ plugin, so here I am :)

I added a few options and have a few more in mind. The plugin is also K2 compatible.

Curious if you also find this useful and if you have any feature requests.

You can find it in the plugin marketplace

šŸ‘‹

1 Comment
2024/11/07
21:46 UTC

6

Architecture testing

Is there a way to validate the architecture of an app? I mean for example I have my usual data, domain, presentation split and I want to enforce Viewmodel classes only being inside the presentation package, usecases being inside the domain package and repository implementation being in the data package. This is just a rough example for clean architecture.

Is there a tool to test this? I know it sounds draconian but a lot of companies seem to do this and I was just wondering whether there is an open-source tool that can do this.

12 Comments
2024/11/07
11:34 UTC

17

What Compose Interview question have you been asked in an interview/As an Interviewer

I have interview coming up and I'm having a competency based interview under the following categories in native android development. It's an Android II

Kotlin + key language features, Compose and other key frameworks, basic architecture

I'm fairly confident in all Kotlin/coroutines and it's features but haven't haven't had much interview experience in Compose. I'm fairly familiar with Compose but don't know what to expect.

18 Comments
2024/11/06
22:45 UTC

19

Is it just me or is the way screen transitions work in navigation-compose extremely counter-intuitive?

Specifically speaking about animating screen changes. I've found little to no discussion on this and Google's sample apps offer no guidance. I am extremely curious to hear what people here think.
So let's say we have the following, simple setup:

From Screen A I can navigate towards a Screen B and a Screen C.
Screen B is supposed to slide in from the right as Screen A slides out to the left and vice versa when the backstack is popped.
Screen C should slide in from the bottom while Screen A is not animated at all during the transition.

When navigating from Screen A to one of the other screens, the enter transition is used based on my destination declaration of B/C so they slide in from the right/bottom as expected. But instead of using the exit transition declared in B/C, it uses the exit transition declared in A! So now I'd have to check whether I'm transitioning to B or C in my setup for Screen A when determining the exit transition, which is doable in this simple setup but very quickly becomes unreasonably difficult to manage in a more complex app. It seems incredibly counter-intuitive to me that the exit transition isn't taken from the destination that I'm navigating towards, similar to how it works in XML when executing a fragment transaction.
I had implemented a generic solution, passing in my desired transition as a navigation argument to each screen and retrieving it from the target state in the enter/exit and from the initial state in the popEnter/popExit transition lambdas. That worked totally fine and was very easy to use after the initial setup but refactoring an app of mine to use type-safe destinations has opened this question for me again. How do other folks here deal with this? I'm kind of baffled that I haven't managed to find discussion or any helpful samples on this as it seems like an extremely common issue to me?

1 Comment
2024/11/06
19:07 UTC

6

Incredibly slow debugger with jetpack compose

Hey folks, wondering if anyone else is running into issues using the debugger in AS with their (large) jetpack compose app.

We've got an app written 100% in jetpack compose - it's fairly large - a quick git ls-files shows 183k LOC.

The app is pretty slow in debug mode which I believe is expected, but if I attempt to run the debugger or attach the debugger to an already running project everything grinds to an absolute halt. If the debugger gets running at all it takes multiple minutes between any action (click a button to go to a new page or something) to see the screen progressing and to eventually hit the breakpoint. It becomes effectively unusable.

I'm wondering if anyone else has run into something similar or has any tips to debug this type of issue.

For reference I have a 2023 macbook pro with 38 gigs of memory so I feel like I should be fine on the hardware side.

9 Comments
2024/11/06
17:15 UTC

8

Subtyping Composables

9 Comments
2024/11/06
16:05 UTC

38

Why do so few Android apps work in landscape mode on phones, tablets and ChromeBooks?

The majority of Android apps, including Reddit, some parts of Facebook, Facebook Messenger, Instagram and many many more, simply do not work in landscape mode on phones, tablets or ChromeBooks? Their website counterparts work fine in landscape mode using browsers on PCs, laptops, tablets and ChromeBooks. Some apps cannot even be installed on tablets and ChromeBooks from Google Play Store.

However, many apps from smaller organisations and independent developers do work just fine in landscape mode and cope admirably with rotation of the screen, usually expanding the data displayed to avail of the screen width or switching to splitscreen mode as is the case with Android Settings, WhatsApp and a variety of e-mail apps.

52 Comments
2024/11/06
15:35 UTC

5

Compose screenshot testing - pros, cons, pitfalls

Hey everyone,

Does anyone use Compose Preview Screenshot Testing for UI localization testing?

We currently go to screen in the app on emulator, take a screenshot and send it to the vrt (visualtesting) , where QA approve the standard of screenshot. And the nex time screenshots will be compared. And we can see the differents

I want to understand whether Compose screenshot testing can be used instead of our approach or is it more like an addition

3 Comments
2024/11/06
13:32 UTC

1

Play Asset Delivery not working (on WearOS)

I was playing with Play Asset Delivery and I created 2 versions of the same app to target different devices (mobiles and watches). Since the app is very simple, the two versions of the application shares the model and the viewmodel in which the AssetManager is called to download an Assetpack. The issue is that it works perfectly fine on the mobile but on the watch as soon as I call the requestPackStates function the application crashes and I get a "Failed to bind to the service" error. Has anyone of you encountered the same issue?

com.google.android.play.core.tasks.RuntimeExecutionException: com.google.android.play.core.internal.aa: Failed to bind to the service.
0 Comments
2024/11/06
11:55 UTC

13

New to Android Development? Need some personal advice? This is the November newbie thread!

Android development can be a confusing world for newbies; I certainly remember my own days starting out. I was always, and I continue to be, thankful for the vast amount of wonderful content available online that helped me grow as an Android developer and software engineer. Because of the sheer amount of posts that ask similar "how should I get started" questions, the subreddit has a wiki page and canned response for just such a situation. However, sometimes it's good to gather new resources, and to answer questions with a more empathetic touch than a search engine.

As we seek to make this community a welcoming place for new developers and seasoned professionals alike, we are going to start a rotating selection of highlighted threads where users can discuss topics that normally would be covered under our general subreddit rules. (For example, in this case, newbie-level questions can generally be easily researched, or are architectural in nature which are extremely user-specific.)

So, with that said, welcome to theĀ November newbie thread! Here, we will be allowing basic questions, seeking situation-specific advice, and tangential questions that are related but not directly Android development.

If you're looking for the previous October thread, you can find it here.

40 Comments
2024/11/05
22:54 UTC

2

log4k: A Comprehensive Logging and Tracing Solution for Kotlin Multiplatform.

Hello!

Recently, I started working on a new logging/tracing library, written exclusively in kotlin. Is compatible with the OpenTelemetry standard. In the latest version I added the ability to create metrics (such as counters, gauges, etc.) for your application and also an easy way to extract those metrics in the OpenMetrics standard (aka Prometheus). If you want take a look here: https://github.com/smyrgeorge/log4k

2 Comments
2024/11/05
17:23 UTC

5

Correct approach to passing nav arguments to the screen's ViewModel

Let's say that I have a screen called ItemScreen with an ItemViewModel. To navigate to it I use a route called Item defined as follows:

@Serializable
data class Item(val id: String)

What approach should I take to pass that id to the ViewModel?

Should I fetch the route in the ViewModel itself using SavedStateHandle like this:

@HiltViewModel
class ItemViewModel @Inject constructor(
    private val savedStateHandle: SavedStateHandle,
) : ViewModel() {
    val item = savedStateHandle.toRoute<Item>()
}

Or should I pass it to the screen composable:

composable<ItemScreen> { backStackEntry ->
    val item: Item = backStackEntry.toRoute()

    ItemScreen(
        id = item.id,
    )
}

And then pass it to the ViewModel from the composable e.g. using LaunchedEffect with the id as the key:

LaunchedEffect(id) {
    viewModel.setId(id)
}

The first approach is mentioned in the Android docs here. Is it the right approach to get nav args in the ViewModel when using a screen-scoped ViewModel?

5 Comments
2024/11/05
13:03 UTC

4

Gradle does not recognize the AndroidManifest.xml file in the processDebugMainManifest task, despite the file existing in the specified path

Problem Description: I am working on an Android project in Android Studio, and each time I try to build or sync the project, I encounter the following error:

A problem was found with the configuration of task ':app:processDebugMainManifest' (type 'ProcessApplicationManifest').
- In plugin 'com.android.internal.version-check' type 'com.android.build.gradle.tasks.ProcessApplicationManifest' property 'mainManifest' specifies file 'E:\15kmes\GESTIONALOYA\APP\gestionalo\app\src\main\AndroidManifest.xml' which doesn't exist.

Reason: An input file was expected to be present but it doesn't exist.
Possible solutions:
  1. Make sure the file exists before the task is called.
  2. Make sure that the task which produces the file is declared as an input.

Environment Details:

  • Operating System: Windows 10
  • Project Path: E:\15kmes\GESTIONALOYA\APP\gestionalo
  • Gradle Version in gradle-wrapper.properties: Gradle 8.7
  • JDK: Java 17
  • Android Studio: Latest stable version
  • Path to AndroidManifest.xml: E:\15kmes\GESTIONALOYA\APP\gestionalo\app\src\main\AndroidManifest.xml

What Iā€™ve Tried So Far:

  1. Verifying the Existence of the AndroidManifest.xml File: I have confirmed that the AndroidManifest.xml file is in the path E:\15kmes\GESTIONALOYA\APP\gestionalo\app\src\main. I even tried replacing the file with a new one to ensure itā€™s not corrupted.
  2. Permissions: I checked that the AndroidManifest.xml file and the containing folder (src/main) have proper read and write permissions.
  3. Configuration in build.gradle:
    • I configured the app/build.gradle file to ensure the sourceSets block points to the correct manifest file: sourceSets { main { manifest.srcFile 'src/main/AndroidManifest.xml' java.srcDirs = ['src/main/java'] res.srcDirs = ['src/main/res'] assets.srcDirs = ['src/main/assets'] jniLibs.srcDirs = ['src/main/jniLibs'] } }
    • I tried using both absolute and relative paths, but the error persists.
  4. Syncing and Rebuilding the Project: After each change, I sync the project and try a full rebuild. This has not resolved the issue.
  5. Clearing the .gradle Folder:
    • I deleted the .gradle folder in the project directory (E:\15kmes\GESTIONALOYA\APP\gestionalo\.gradle) to force a cache and configuration regeneration. Then, I rebuilt the project, but the issue remains.
  6. Changing the Gradle Version:
    • I tried changing the Gradle version in gradle-wrapper.properties to previous versions, such as 7.5 and 8.3, but I encounter the same error regardless of the version.
  7. Java and Gradle Configurations:
    • I confirmed that the Java version in JAVA_HOME and in Android Studio match (Java 17).
    • I also tried launching the project with different JDK versions to check for compatibility issues, but the error did not change.
  8. Gradle Commands with --stacktrace and --info:
    • I ran the ./gradlew build --stacktrace --info command to get more error details, and it consistently points to the AndroidManifest.xml file not being found in the specified path.

Summary: Despite all the above attempts, the error persists, and Gradle continues to fail to recognize the AndroidManifest.xml file in the specified path, even though the file is indeed there.

Question: Has anyone experienced a similar problem or can suggest other methods to solve this issue? I am looking for help in identifying if there are any additional configurations or tool version conflicts that could be causing this. Any suggestions would be greatly appreciated.

3 Comments
2024/11/05
13:27 UTC

19

Step-by-step guide on how to upload an Android app to the Google Play Store

Hello! Iā€™d like to share with you a step-by-step guide on how to upload an app to the Google Play Store.

I hope you find it helpful!

1 Comment
2024/11/05
13:23 UTC

48 Comments
2024/11/05
13:10 UTC

1

Tests pipeline

Hello, Iā€™m working on a new compose app and i need to make it build and run all tests in git pipeline, but here is the catch, I need to run ui tests for phone version in portrait and landscape and the same for tablet.

Why do I need that? I need to get the coverage report because we use sonar and the minimum accepted coverage is 70%. (We use jacoco and we are aware about the issue in compose code coverage)

My question is how do you guys deal with it? Is there any git repository that I can use as an example ?

1 Comment
2024/11/05
12:25 UTC

Back To Top