question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android : Unable to build app

See original GitHub issue

EDIT by @kelset:

TL;DR:

  • Google released a new Major version of their Google Play services and Firebase
  • this new version has BREAKING CHANGES (release notes)
  • some third-party libraries used in react-native projects have loose dependencies on said services, most likely in the :+ form in their gradle configuration
  • this is causing Gradle buils to fail because of those BC mentioned above
  • to fix, you need to set the dependency to a precise version instead of the :+
  • you can find out which libraries are “pulling in” this new version by running gradlew app:dependencies and searching the output for androidx (more details here)

Please refer to this comment (and the follow ups) for more details on how to fix - in particular, for debugging, read this comment.


React Native version: 0.58.0 Platform : android

Here are android version: buildToolsVersion = “27.0.3” minSdkVersion = 19 compileSdkVersion = 26 targetSdkVersion = 26 supportLibVersion = “26.1.0”

Building app on android before today is working fine. and suddenly got this issue in android manifest file …\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:46: AAPT: No resource identifier found for attribute ‘appComponentFactory’ in package ‘android’

Steps To Reproduce

Describe what you expected to happen:

Snack, code example, or link to a repository:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:31
  • Comments:65 (2 by maintainers)

github_iconTop GitHub Comments

33reactions
kelsetcommented, Jun 18, 2019

hey @nodece thanks for the investigation, that seems to be the root cause!

It seems that google released a new version of their Play Services, and in particular com.google.android.gms:play-services-gcm - so if you are depending on latest (via something like com.google.android.gms:play-services-gcm:+) then you need to change it to instead rely on the previous version, in the example 16.0.0.

So you may have to do something like

implementation(project(":react-native-device-info"),  {
  exclude group: "com.google.android.gms"
})
implementation "com.google.android.gms:play-services-gcm:16.0.0"

I’m going to close this, as it seems to be caused by third-party libraries and not react native per-se - if something else pops up please comment ahead!


EDIT: if you are still experiencing the issue, it’s likely one of these two reasons:

  1. you have other libraries (not device-info) that depend on latest, and you need to debug/find out which ones
  2. you need to clean the gradle cache, you can use this: ./gradlew cleanBuildCache & ./gradlew clean from the /android folder

If it’s neither because of these, please provide a repro so that it can be investigated.

27reactions
MR03webcommented, Jun 18, 2019

update: The root cause is related to androidx, google play service… try upgrade project to androidx

This problem seems to be triggered by the version of react-native-device-info? 2.1.2 constrain play services dependency to pre-AndroidX 16.1.0 react-native-device-info

yarn upgrade react-native-device-info@2.1.2
cd android && gradlew clean
react-native run-android

It working for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to build project in Android Studio - Stack Overflow
I have already installed google support repository as mentioned in other places. This is my build.gradle: apply plugin: 'com.android.application ...
Read more >
Known issues with Android Studio and Android Gradle Plugin
When you navigate to Build > Generate Signed Bundle / APK and attempt to configure app signing for an app bundle or an...
Read more >
Can't build app for android - Other - Solar2D Game Engine
google.android.gms:play-services-location:[10.2.1, 16.0.99]. ... Failed to list versions for com.google.android.gms:play-services-location. Unable ...
Read more >
Unable to build app(android/ios) - Bug - AppGyver
Unable to build app (android/ios) ... +1 - we are stuck at queued as well for several hours now… ... Same here. I...
Read more >
Android Studio unable to build any projects in SDK...
Android Studio unable to build any projects in SDK/Build instructions incorrect ... After spending probably 8 hours trying to install and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found