Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Unable to build app in React native version 0.59.9 #25294

Closed
NweThazin opened this issue Jun 18, 2019 · 21 comments
Closed

Android: Unable to build app in React native version 0.59.9 #25294

NweThazin opened this issue Jun 18, 2019 · 21 comments
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@NweThazin
Copy link

NweThazin commented Jun 18, 2019

React Native version:
"react": "^16.8.3",
"react-native": "^0.59.9",
Platform : Android

buildToolsVersion = "27.0.3"
minSdkVersion = 19
compileSdkVersion = 26
targetSdkVersion = 26
supportLibVersion = "26.1.0"

Building app on android before today is still working fine. but today suddenly got issues

Android resource linking failed
........gradle\caches\transforms-1\files-1.1\design-26.1.0.aar\93c55e022cb5155751ad48023aa48e94\res\values\values.xml:159:5-202: AAPT: error: resource android:attr/fontVariationSettings not found.
............gradle\caches\transforms-1\files-1.1\design-26.1.0.aar\93c55e022cb5155751ad48023aa48e94\res\values\values.xml:159:5-202: AAPT: error: resource android:attr/ttcIndex not found.
error: failed linking references.

So, upgrade to sdk version but keep getting new issues
Android sdk and libraries version:
buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"

D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy

Steps To Reproduce

Describe what you expected to happen:

Snack, code example, or link to a repository:

@NweThazin NweThazin added the Bug label Jun 18, 2019
@developerashish01
Copy link

i am having same issue

android.support.v4.app.INotificationSideChannel$Stub$Proxy

@react-native-bot react-native-bot added the Platform: Android Android applications. label Jun 18, 2019
@theodorusyoga
Copy link

I'm having the same issue despite doing nothing (no new packages and recently didn't execute react native link).

@matthiasleitner
Copy link

Seeing the same thing with 0.59.8, worked till yesterday. No dependency changes since then.

@scesbron
Copy link

Same for me. My build worked until yesterday and now without any changes I have

Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
        is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
        Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-117 to override.

It seems this is tied to google update https://developers.google.com/android/guides/releases but I don't know how to correct this problem

@Navidhp
Copy link

Navidhp commented Jun 18, 2019

i have same problem

@lnminh58
Copy link

how to resolve it ???

@remarcus
Copy link

remarcus commented Jun 18, 2019

Can confirm, haven't found solution yet. If following added to manifest

...
<application
tools:replace="android:appComponentFactory"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
...

then gradle can't resolve androidx dependencies for packages like react-native-firebase or react-native gesture-handler

Also tried to run Refactor -> Migrate to AndroidX... in Android studio, for some it might help, for me it doesn't as I depend on custom dependency which can't be resolved.

@developerashish01
Copy link

@remarcus same issue here

@Forsaken-sl
Copy link

Forsaken-sl commented Jun 18, 2019

seem here,

<application
tools:replace="android:appComponentFactory"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"

After doing this, will cause some other problem, add after

android.enableJetifier=true
android.useAndroidX=true

some library(react-native-i18n) will show error not found support-v4..kind of thing.

@ghost
Copy link

ghost commented Jun 18, 2019

It looks like two things seems to happen (maybe for the same reason)

On versions

  • 0.56.0
  • 0.51.0

I get following error (looks to be the same as in the original post)
`

Android resource linking failed
Output: {{path}}/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:271: error: resource android:attr/fontVariationSettings not found.
{{path}}/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:271: error: resource android:attr/ttcIndex not found.
error: failed linking references.`

On version

  • 0.57.8

I get a error message that suggest to add something to the Manifest as seen in some other comments.

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-117 to override.

@scesbron
Copy link

For me the problem does not occur on a fresh new react-native project. After adding my dependencies one at a time I found that it was react-native-device-info that causes the problem. After upgrading this dependency from 0.13.0 to 2.1.2 the problem is gone.

@amansharmarepository
Copy link

Same for me. It was working few hours ago and now i'm getting
Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:7:5-117 to override

Tried updating manifest.

@supervons
Copy link

supervons commented Jun 18, 2019

For me the problem does not occur on a fresh new react-native project. After adding my dependencies one at a time I found that it was react-native-device-info that causes the problem. After upgrading this dependency from 0.13.0 to 2.1.2 the problem is gone.

thanks, i use "[email protected]" , then update 2.1.2 the problem is gone.

@ComicScrip
Copy link

ComicScrip commented Jun 18, 2019

For me the problem does not occur on a fresh new react-native project. After adding my dependencies one at a time I found that it was react-native-device-info that causes the problem. After upgrading this dependency from 0.13.0 to 2.1.2 the problem is gone.

Thank you so much, my app is building again after this change.
I have other apps affected by this issue and they are not using react-native-device-info.
@scesbron May I ask how did you do to figure out that this library was the source of the problem ?

@supervons
Copy link

For me the problem does not occur on a fresh new react-native project. After adding my dependencies one at a time I found that it was react-native-device-info that causes the problem. After upgrading this dependency from 0.13.0 to 2.1.2 the problem is gone.
Hello, how can I find out the problem and solve it? I want to learn it.

@scesbron
Copy link

@ComicScrip I started with a fresh new react-native app and tried to app the dependencies of my app one at a time and check when the react-native run-android command fails.

@nodece
Copy link

nodece commented Jun 18, 2019

[email protected] resolved without the need to migrate to AndroidX: #25293 (comment)

@supervons
Copy link

supervons commented Jun 18, 2019

@ComicScrip I started with a fresh new react-native app and tried to app the dependencies of my app one at a time and check when the react-native run-android command fails.

so amazing,got it~

@kelset
Copy link
Contributor

kelset commented Jun 18, 2019

hey everyone - this seems to not be strictly caused by React Native itself, but some third party dependency that you may have installed.

In particular, it seems to me that it's on Gradle side (we've seen similar issues in the past).
Also it seems that it's connected to AndroidX and/or react-native-device-info.

I'll close this - and reopen someone can provide a repro of a clean react-native init'd project on 0.59.9 failing consistently. But if you want to help, please comment ahead - I'm not planning to lock this until it spins out of control - and add new details that you may notice/find 🤗

I'll also reach out to the other RNCommunity maintainers to ask for help - as soon as we have a reliable understanding of what's going on & a workaround, I'll update the top post with it.


As always, please refrain from posting useless comments like "happens to me to/+1/etc. You can use the reactions to signal the extent of the issue.

@kelset kelset closed this as completed Jun 18, 2019
@firstyuyu
Copy link

For me the problem does not occur on a fresh new react-native project. After adding my dependencies one at a time I found that it was react-native-device-info that causes the problem. After upgrading this dependency from 0.13.0 to 2.1.2 the problem is gone.

Thanks @scesbron
I upgraded react-native-device-info from 0.11.0 to 2.1.2 and I got another error

project-name/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:394: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
^
symbol: variable P
location: class VERSION_CODES

Then I change compileSdkVersion on ./android/build.gradle from 27 to 28 and the problem is gone

Note: when upgrading react-native-device-info you might need to first unlink the existing installation (automatic using npm unlink react-native-device-info or manually)

@kelset
Copy link
Contributor

kelset commented Jun 18, 2019

Ok it seems to be related to google releasing a new version of their Play Service: please refer to this comment.

EDIT: locking this so that we will use the other issue for further comments.

@facebook facebook locked as resolved and limited conversation to collaborators Jun 18, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jun 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests