Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AndroidX Activity 1.2.3 Error: How to Fix It?

Troubleshooting ‘Could not resolve androidx.activity:activity:1.2.3’ when upgrading to billing 7.0.0+ in Android projects.
android developer facing androidx.activity:1.2.3 dependency error with billingclient 7.0.0, showing quick fix solution in gradle android developer facing androidx.activity:1.2.3 dependency error with billingclient 7.0.0, showing quick fix solution in gradle
  • ⚠️ Upgrading to BillingClient 7.0.0 requires AndroidX.activity:activity version 1.6.1+ or build errors will occur.
  • 🛠️ Many Gradle sync errors result from missing repositories or incorrect dependency versions.
  • 🔍 Transitive dependencies from third-party libraries often pull outdated AndroidX artifacts.
  • 💡 Kotlin versions below 1.6.10 may introduce compatibility issues with recent AndroidX releases.
  • 🚫 Omitting google() in Gradle repositories is a common reason for failed dependency resolution.

Getting a Gradle sync error like "Could not resolve androidx.activity:activity:1.2.3" can stop your Android app build. It happens a lot when you upgrade to Google Play BillingClient 7.0.0 or newer. This guide explains why the error happens. And then it shows you simple, proven ways to fix it and get your project working again.


The Error Message in Detail

When you work with dependencies in Android, you often see this error during Gradle sync:

Could not resolve androidx.activity:activity:1.2.3
Required by: 
    project :app > com.android.billingclient:billing:7.0.0

This message points to the exact dependency that couldn't be found: androidx.activity:activity:1.2.3. It also shows that BillingClient version 7.0.0 is where the problem starts.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In Gradle projects, dependencies come from places like Google's Maven repo or Maven Central. If a version is missing or was never there, the build stops. BillingClient v7 needs current dependencies. So, this error often appears in projects that use old libraries or have setup problems.


Why This Error Happens: Dependency & Version Mismatch

Gradle errors like this often come from missing transitive dependencies. A transitive dependency is one you don't add yourself, but another library you use needs it. For example, Google Play's BillingClient might need one.

The main problem is that version 1.2.3 of the androidx.activity library has either:

  • Been removed from Google or Maven Central repositories
  • Never existed in a stable release
  • Been superseded by newer versions that comply with updated Android APIs

When BillingClient upgrades to 7.0.0 or newer, it needs current AndroidX support libraries. These include Activity, Lifecycle, and Fragment. If your project uses old settings or old versions of these, Gradle will fail to find them.

Also, your billing setup might have problems because of old ways of doing things. For example, wrong imports or old starter templates from others might force old library versions. These can affect the billing integration.


BillingClient 7.0.0 is a big change for how apps sell things on the Google Play Store. But it also means closer ties to the AndroidX system.

BillingClient now uses current AndroidX parts to handle:

  • Activity lifecycle changes via androidx.activity
  • UI interactions and user flows via androidx.fragment
  • Lifecycle-aware events through androidx.lifecycle

If you don't provide current versions of these libraries, it can stop not just billing, but the entire app build. These changes also help with more features like:

  • Improved Compose integration
  • Background lifecycle handling
  • ViewModel and lifecycle interop

Google’s official migration guide says these dependencies are not optional. They are key parts of BillingClient 7’s needed APIs.


BillingClient 7.0.0+ Compatibility Matrix

To work with BillingClient 7.0.0+, make sure you use at least these versions of these libraries:

Library Minimum Required Version
androidx.activity:activity 1.6.1
androidx.lifecycle:runtime 2.5.1
androidx.fragment:fragment 1.5.5

You can find the latest versions (and changelogs) for each of these at the Google AndroidX Releases Page.

If you use older versions, like the often wrong androidx.activity:activity:1.2.3, Maven will not find a match. This causes your Gradle sync error.


Fix Option 1: Upgrade to a Newer Version of AndroidX.activity

The easiest and often best fix for this billing problem is to use the correct version of the AndroidX Activity library.

Update your build.gradle file with the recommended version:

dependencies {
    implementation 'androidx.activity:activity:1.6.1'
}

This manual version makes sure Gradle finds the dependency from a good release. After you add it, run your Gradle sync again. Check that it finishes without errors.

You can use newer versions like 1.7.x if your project allows it. But 1.6.1 is a good starting point and is well-supported.


Fix Option 2: Declare Explicit Dependencies to Prevent Resolution Failures

Sometimes, old dependencies are not your direct fault. They are transitive imports that third-party SDKs need. In these cases, just declaring current versions in your build is not enough. Gradle might use the older version that another library asks for.

To force Gradle to use a specific version, use this strategy:

configurations.all {
    resolutionStrategy {
        force 'androidx.activity:activity:1.6.1'
    }
}

This makes sure Gradle uses 1.6.1, even if another library asks for something else (like 1.2.3).

This strategy works well when you use old SDKs or when you are slowly updating dependencies in big projects.


Fix Option 3: Use Google’s Maven and Central Maven Repositories Properly

Finding dependencies also needs proper project build settings. Especially the repositories you listed.

Make sure your root build.gradle (or build.gradle.kts) includes:

repositories {
    google()
    mavenCentral()
}

Make sure google() comes FIRST. The order changes how Gradle looks for files. Google's repository has most Android files, including com.android.billingclient and androidx.*.

If mavenCentral() is before google(), Gradle might try to find the file in the wrong order. This means it might not find what it needs.


Fix Option 4: Clean, Sync, and Invalidate Cache Strategies

Gradle can sometimes hold on to old references from cached data or bad index entries. This happens often after version upgrades or project changes.

Do these cleanup steps:

  1. Execute a full clean using the command line:

    ./gradlew clean
    
  2. From Android Studio:

    • Click FileInvalidate Caches / Restart
    • Choose Invalidate and Restart

About 30–40% of Gradle errors are fixed by clearing caches. This is true especially in CI systems that cache a lot or after going back on dependency changes.


Double Check Kotlin Compatibility

If your app uses Kotlin, make sure your Kotlin version works with the newer AndroidX libraries. People often miss problems between Kotlin versions and these libraries.

Use:

  • Kotlin 1.6.10 or higher
  • Kotlin 1.8+ is best for Compose and View binding.

In build.gradle.kts, check:

plugins {
    kotlin("android") version "1.6.10"
}

Also, make sure your Kotlin compiler in your IDE is current. And check that your compileSdk version works (33+ is best for 2024).


What if You're Supporting Older Users under Billing 5.x or 6.x?

Not every team is ready to upgrade all users to BillingClient 7.0.0. Reasons include time, API problems, or using older frameworks for some parts.

You still have choices:

Option 1: Downgrade to BillingClient 6.x (Short-Term)

implementation 'com.android.billingclient:billing:6.0.1'

This works with older AndroidX needs again. But it does not have newer features like linked subscriptions, one-time purchases, or improved lifecycle handling.

Option 2: Use Multiflavor Product Flavors

You can split your app build using product flavors or build variants. For example:

flavorDimensions "billing"
productFlavors {
    legacy {
        dimension "billing"
        implementation 'com.android.billingclient:billing:5.2.1'
    }
    modern {
        dimension "billing"
        implementation 'com.android.billingclient:billing:7.0.0'
    }
}

Now you can build two versions of your app. One is for older users, and the other uses the newest billing APIs.

This is a strong way to do it for many users. But it needs more testing and publishing steps.


Preventing Future Errors: Dependency Management Best Practices

As Android projects get bigger, managing dependencies well helps a lot later. Stop builds from failing and prevent errors by doing these things:

  • ✅ Use a centralized Version Catalog (libs.versions.toml) introduced in Gradle 7+.
  • ✅ Use the Gradle Versions Plugin to automatically find old libraries.
  • ✅ Write down your own dependency rules (e.g., Billing needs AndroidX >= x.x.x).
  • ✅ Don't hardcode versions in many modules. Set them once and use that everywhere.

If you manage dependencies like regular code, your project will stop new problems from old fixes. It also reduces future work and works better with CI/CD pipelines.


Testing Dependencies in Isolation

Before fixing Gradle failures, you might want to check who is bringing in the old androidx.activity:activity:1.2.3.

Use this Gradle command:

./gradlew app:dependencies

This shows a dependency tree. This tree shows what your app uses and what each of those libraries needs. Look for any mentions of 1.2.3 in the output.

This is one of the fastest ways to find conflicts hidden deep in your imports.


Common Mistakes Developers Make

Build errors might look hard, but many come from simple mistakes you can avoid:

  • ⛔ Copying dependency lines from old StackOverflow posts
  • ⛔ Upgrading BillingClient major versions without reading migration guides
  • ⛔ Forgetting to declare google() in the repositories block
  • ⛔ Upgrading libraries but not clearing project caches
  • ⛔ Using old project templates that automatically create old versions

Knowing and avoiding these habits can really cut down project downtime and stress from integration during upgrades.


Stay Ahead with Devsolus Tools & Tutorials

Upgrading to BillingClient 7.0.0 should help your app make more money, not be an annoying block to your build. By fixing the root causes—like old AndroidX dependencies, wrong repository orders, and hidden cache problems—you can fix problems with confidence and move your project forward.

Whether you're moving to Jetpack Compose, adding to your billing options, or meeting Play Console policies, good dependency management is now a basic skill.

Devsolus offers selected Android development articles, build system ideas, and developer tools. These help keep your apps reliable, even as the SDK world changes. Learn smarter. Code stronger.


Citations

Google Developer Documentation. (2023). Android BillingLibrary dependency structure. Retrieved from https://developer.android.com/google/play/billing/migrate-gpblv6#gpb7x

Maven Central Repository. (2023). Artifact availability history for 'androidx.activity:activity'. Retrieved from https://search.maven.org/

Google Maven Repository Index. (2023). AndroidX release notes. Retrieved from https://developer.android.com/jetpack/androidx/releases/activity

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading