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

how to solve mainfest merger error? #25292

Closed
ydv0121 opened this issue Jun 18, 2019 · 62 comments
Closed

how to solve mainfest merger error? #25292

ydv0121 opened this issue Jun 18, 2019 · 62 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Type: Question Issues that are actually questions and not bug reports.

Comments

@ydv0121
Copy link

ydv0121 commented Jun 18, 2019

got this error today to add the tools:replace in my mainfest

Screenshot 2019-06-18 at 10 46 28 AM

when i add tools:replace="android:appComponentFactory" to my mainfest file got another error -

Screenshot 2019-06-18 at 10 47 58 AM

don't understand how to resolve this?

@ydv0121 ydv0121 added the Type: Question Issues that are actually questions and not bug reports. label Jun 18, 2019
@react-native-bot
Copy link
Collaborator

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

👉 Click here if you want to report a reproducible bug or regression in React Native.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: No Template labels Jun 18, 2019
@sajorahasan
Copy link

sajorahasan commented Jun 18, 2019

+1 I'm also facing this issue. and none of the solutions working so far.

Here is my package.json

"dependencies": { "apisauce": "1.0.2", "lodash": "4.17.11", "moment": "2.24.0", "react": "16.8.3", "react-native": "0.59.9", "react-native-device-info": "1.5.1", "react-native-fast-image": "5.3.0", "react-native-firebase": "5.3.1", "react-native-iap": "2.5.5", "react-native-image-crop-picker": "0.24.1", "react-native-keyboard-aware-scroll-view": "0.8.0", "react-native-local-mongodb": "2.2.9", "react-native-localization": "2.1.1", "react-native-pdf": "5.1.0", "react-native-router-flux": "4.0.6", "react-native-share": "1.2.1", "react-native-simple-encryption": "1.2.1", "react-native-splash-screen": "3.2.0", "react-native-vector-icons": "6.4.2", "react-native-webview": "5.8.1", "react-redux": "7.0.2", "redux": "4.0.1", "redux-logger": "3.0.6", "redux-thunk": "2.3.0", "rn-fetch-blob": "0.10.15" },

Project build.gradle

`buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven { url "https://jitpack.io" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}`

App build.gradle

`apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    applicationId "com.educationwalkthrough"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 3
    versionName "1.0"
    multiDexEnabled true
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }
}
signingConfigs {
    release {
        if (project.hasProperty('EDU_RELEASE_STORE_FILE')) {
            storeFile file(EDU_RELEASE_STORE_FILE)
            storePassword EDU_RELEASE_STORE_PASSWORD
            keyAlias EDU_RELEASE_KEY_ALIAS
            keyPassword EDU_RELEASE_KEY_PASSWORD
        }
    }
}
buildTypes {
    debug {
        matchingFallbacks = ['release', 'debug']
    }
    release {
        matchingFallbacks = ['release', 'debug']
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        signingConfig signingConfigs.release
    }
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
}
packagingOptions {
    pickFirst 'lib/x86/libc++_shared.so'
    pickFirst 'lib/x86_64/libjsc.so'
    pickFirst 'lib/arm64-v8a/libjsc.so'
    pickFirst 'lib/arm64-v8a/libc++_shared.so'
    pickFirst 'lib/x86_64/libc++_shared.so'
    pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}

}

dependencies {
implementation project(':react-native-share')
implementation project(':react-native-pdf')
implementation project(':rn-fetch-blob')
implementation project(':react-native-iap')
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-firebase')
implementation project(':react-native-splash-screen')
implementation project(':react-native-webview')
implementation project(':react-native-vector-icons')
implementation project(':react-native-localization')
implementation project(':react-native-fast-image')
implementation project(':react-native-device-info')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules

// Firebase dependencies
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-core:16.0.8"
// implementation "com.google.firebase:firebase-auth:17.0.0"

}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

apply plugin: 'com.google.gms.google-services'`

@fl-nishida
Copy link

+1!!! desperate!

@syaifulamir
Copy link

syaifulamir commented Jun 18, 2019

+1 ... I have the same issue, what is the solution ?

@novalkrnfds
Copy link

+1 same issue

@mirzasuga
Copy link

+1 same issue today...

@BhavanPatel
Copy link

BhavanPatel commented Jun 18, 2019

FIXED

I had same issue

Issue is something related to androidX , and I have lots of libraries in my package.json so I am not able to find which library causing issue.

So I decided to update all libraries to latest version,
and yet issue is fixed for me

.

make sure you delete node_modules and install again after upgrading then ./gradlew clean and delete build folder in android after

my current package json is below

Screen Shot 2019-06-18 at 12 25 47 PM
Screen Shot 2019-06-18 at 12 25 53 PM

Hope this helps !

@Tiger-man
Copy link

+1 ... I have the same issue, what is the solution ?

@firehand33
Copy link

+1...same issue here

@sjt145
Copy link

sjt145 commented Jun 18, 2019

+1......facing same issue

@ydv0121
Copy link
Author

ydv0121 commented Jun 18, 2019

FIXED

I had same issue

Issue is something related to androidX , and I have lots of libraries in my package.json so I am not able to find which library causing issue.

So I decided to update all libraries to latest version,
and yet issue is fixed for me

.

make sure you delete node_modules and install again after upgrading then ./gradlew clean and delete build folder in android after

my current package json is below

Screen Shot 2019-06-18 at 12 25 47 PM
Screen Shot 2019-06-18 at 12 25 53 PM

Hope this helps !

@BhavanPatel did this but same issue i got..remove ^ from all my package.json and npm reinstall..

@ddthuan87
Copy link

+1...... same issue today

@ddthuan87
Copy link

FIXED

I had same issue

Issue is something related to androidX , and I have lots of libraries in my package.json so I am not able to find which library causing issue.

So I decided to update all libraries to latest version,
and yet issue is fixed for me

.

make sure you delete node_modules and install again after upgrading then ./gradlew clean and delete build folder in android after

my current package json is below

Hope this helps !

@BhavanPatel this solution not work =D

@cosivox
Copy link

cosivox commented Jun 18, 2019

+1 ... SAME ISSUE!!!

@BhavanPatel
Copy link

BhavanPatel commented Jun 18, 2019

@ydv0121

*FIXED

I had same issue
Issue is something related to androidX , and I have lots of libraries in my package.json so I am not able to find which library causing issue.
So I decided to update all libraries to latest version,
and yet issue is fixed for me
.
make sure you delete node_modules and install again after upgrading then ./gradlew clean and delete build folder in android after
my current package json is below
Screen Shot 2019-06-18 at 12 25 47 PM
Screen Shot 2019-06-18 at 12 25 53 PM
Hope this helps !

@BhavanPatel did this but same issue i got..remove ^ from all my package.json and npm reinstall..

U need to upgrade all libs to latest version, not only removing ^
either you can manually put it in package json and reinstall or can be done with
npm i <package-name>@latest --save

@js7331
Copy link

js7331 commented Jun 18, 2019

  1. Check if you have a library which depends on AndroidX:

cd android && ./gradlew app:dependencies

  • For me it was Google Play Services @ 18.0.0 which depends on AndroidX.
  1. Set Google Play Services to specific version number (check https://developers.google.com/android/guides/releases for the version you want to use):
    implementation "com.google.android.gms:play-services-maps:16.0.0"

  2. If a package uses a newer version (see 1.) of the Google Play Services libraries, just exclude it in your app's build.gradle:

implementation(project(':react-native-maps')) {
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
  1. Add attributes to <application> in your AndroidManifest.xml:
android:appComponentFactory="androidx"
tools:replace="android:appComponentFactory"
  1. Add config to settings.gradle:
android.useAndroidX=false
android.enableJetifier=false

I'm not too sure about 4. and 5. but it's working for me like this. Be sure to revert this stuff when you update to 0.60+ and AndroidX support is provided by all libraries you use.

As mentioned by @firehand33 it could be that you have to force the Google Play Services libraries versions, e.g.:

implementation ("com.google.android.gms:play-services-gcm:16.1.0") {
    force = true
}

@BhavanPatel
Copy link

@ddthuan87 what steps u have followed?

@ddthuan87
Copy link

@ddthuan87 what steps u have followed?

i'm clear gradlew -> delete all node_module -> npm_install -> it still shows the old error

@BhavanPatel
Copy link

@ddthuan87 U need to upgrade packages to latest just cleaning and reinstalling wont work

@ddthuan87
Copy link

@ddthuan87 U need to upgrade packages to latest just cleaning and reinstalling wont work

thk, i will try this again :D

@percyphan86
Copy link

percyphan86 commented Jun 18, 2019

  1. Check if you have a library which depends on AndroidX:

cd android && ./gradlew app:dependencies

  • For me it was Google Play Services @ 18.0.0 which depends on AndroidX.
  1. Set Google Play Services to specific version number (check https://developers.google.com/android/guides/releases for the version you want to use):
    implementation "com.google.android.gms:play-services-maps:16.0.0"
  2. If a package uses a newer version (see 1.) of the Google Play Services libraries, just exclude it in your app's build.gradle:
implementation(project(':react-native-maps')) {
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
  1. Add attributes to <application> in your AndroidManifest.xml:
android:appComponentFactory="androidx"
tools:replace="android:appComponentFactory"
  1. Add config to settings.gradle:
android.useAndroidX=false
android.enableJetifier=false

I'm not too sure about 4. and 5. but it's working for me like this. Be sure to revert this stuff when you update to 0.60+ and AndroidX support is provided by all libraries you use.

Now it show me another error:

Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: androidx.versionedparcelable.ParcelImpl

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: androidx.versionedparcelable.ParcelImpl

@ydv0121
Copy link
Author

ydv0121 commented Jun 18, 2019

  1. Check if you have a library which depends on AndroidX:

cd android && ./gradlew app:dependencies

  • For me it was Google Play Services @ 18.0.0 which depends on AndroidX.
  1. Set Google Play Services to specific version number (check https://developers.google.com/android/guides/releases for the version you want to use):
    implementation "com.google.android.gms:play-services-maps:16.0.0"
  2. If a package uses a newer version (see 1.) of the Google Play Services libraries, just exclude it in your app's build.gradle:
implementation(project(':react-native-maps')) {
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
  1. Add attributes to <application> in your AndroidManifest.xml:
android:appComponentFactory="androidx"
tools:replace="android:appComponentFactory"
  1. Add config to settings.gradle:
android.useAndroidX=false
android.enableJetifier=false

I'm not too sure about 4. and 5. but it's working for me like this. Be sure to revert this stuff when you update to 0.60+ and AndroidX support is provided by all libraries you use.

Now it show me another error:

Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: androidx.versionedparcelable.ParcelImpl

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: androidx.versionedparcelable.ParcelImpl

+1

@js7331
Copy link

js7331 commented Jun 18, 2019

Now it show me another error:

Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: androidx.versionedparcelable.ParcelImpl

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: androidx.versionedparcelable.ParcelImpl

Please check again with cd android && ./gradlew app:dependencies if there really are no AndroidX dependencies left.

@percyphan86
Copy link

Now it show me another error:

Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: androidx.versionedparcelable.ParcelImpl

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: androidx.versionedparcelable.ParcelImpl

Please check again with cd android && ./gradlew app:dependencies if there really are no AndroidX dependencies left.

I did follow your steps, and run ./gradlew app:dependencies but no help bro :(. I think it causes my libraries...

@BhavanPatel
Copy link

@percyphan86 try my steps if it works

@ydv0121
Copy link
Author

ydv0121 commented Jun 18, 2019

Now it show me another error:

Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: androidx.versionedparcelable.ParcelImpl

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: androidx.versionedparcelable.ParcelImpl

Please check again with cd android && ./gradlew app:dependencies if there really are no AndroidX dependencies left.

tried this..and androidX is within the com.google.android.gms:play-services-base:16.1.0 -> 17.0.0

Screenshot 2019-06-18 at 2 25 06 PM

here is my dependencies

`dependencies {
compile project(':react-native-google-places')
compile project(':react-native-app-tour')
compile project(':react-native-androw')
compile project(':react-native-svg')
compile project(':react-native-vector-icons')
implementation project(':tipsi-stripe')
implementation project(':react-native-maps')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-image-crop-picker')
//implementation project(':react-native-image-base64')
implementation project(':react-native-i18n')
implementation project(':react-native-google-signin')
compile 'com.intellij:annotations:+@jar'
implementation project(':react-native-firebase')
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation project(':react-native-fbsdk')
implementation project(':react-native-device-info')
implementation project(':react-native-contacts')
implementation project(':react-native-google-places')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-places:+'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.1.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-messaging:17.1.0"
implementation 'com.google.android.gms:play-services-measurement-base:+'
implementation 'com.google.firebase:firebase-analytics:+'
implementation "com.android.support:support-v4:28.0.0"
//implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:support-annotations:+'
implementation 'com.android.support:support-compat:+'
implementation "com.android.support:support-media-compat:28.0.0"

}`

@ghost
Copy link

ghost commented Jun 18, 2019

Downgrade Google Play service version. In android/app/build.gradle change

compile 'com.google.android.gms:play-services-<service_name>:+'

to

compile 'com.google.android.gms:play-services-<service_name>:16.0.0'

So in my case <sevice_name> was location. But in someone's else case it may be any other Google Play Service (like in list here http://www.androiddocs.com/google/play-services/setup.html).

@pateldipali
Copy link

+1

@dilipchandima
Copy link

dilipchandima commented Jun 18, 2019

you can force google play service version in android> build.gradle file in ext like following

ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "16.0.0"
        googlePlayServicesVisionVersion = "17.0.2"
    }

my issue fixed :)

@dilipchandima
Copy link

@ydv0121 yes it is fixed you need to add the version which is used in your project

@igordevelops
Copy link

In my case problem was produced by react-native-push-notification package (https://github.com/zo0r/react-native-push-notification/blob/master/android/build.gradle#L50).

It has com.google.firebase:firebase-messaging as dependency and it was upgraded from 18.0.0 -> 19.0.0. What produced adroidx injection as dependency.

Solution: add firebaseVersion=18.0.0 to your gradle.properties

@ydv0121
Copy link
Author

ydv0121 commented Jun 18, 2019

solved it by updating all third party libraries as per @BhavanPatel said
and

add dependencies like this

implementation ('com.google.android.gms:play-services-tasks:16.0.1'){ force = true } implementation ('com.google.android.gms:play-services-base:16.1.0'){ force = true } implementation ('com.google.android.gms:play-services-places:16.1.0'){ force = true } implementation ('com.google.android.gms:play-services-location:16.0.0'){ force = true } implementation ('com.google.android.gms:play-services-gcm:16.1.0'){ force = true } implementation ('com.google.android.gms:play-services-maps:16.1.0'){ force = true } implementation ('com.google.android.gms:play-services-basement:16.2.0'){ force = true }

and also add this in android/build.gradle as per @dilipchandima said

ext { buildToolsVersion = "28.0.3" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = "28.0.0" googlePlayServicesVersion = "16.0.0" googlePlayServicesVisionVersion = "17.0.2" }

thank you @BhavanPatel & @dilipchandima
mix of some solutions worked for me :D

@tatva-hiral
Copy link

Same issue, build created but app crashing on start

@jrapala
Copy link

jrapala commented Jun 18, 2019

@ydv0121 Thanks for that list. Those version #s work for me!

@Arun-paramasivam
Copy link

Arun-paramasivam commented Jun 19, 2019

In my case problem was produced by react-native-push-notification package (https://github.com/zo0r/react-native-push-notification/blob/master/android/build.gradle#L50).

It has com.google.firebase:firebase-messaging as dependency and it was upgraded from 18.0.0 -> 19.0.0. What produced adroidx injection as dependency.

Solution: add firebaseVersion=18.0.0 to your gradle.properties

thanks to @igordevelops
i used similar solution. In android level build.gradle file (not which is inside app folder) i added these two lines:

buildscript {
ext {
buildToolsVersion = "28.0.2"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"

  •    googlePlayServicesVersion = "16.1.0" // default: "+"
    
  •  firebaseVersion = "18.0.0" // default: "+"
    
    }
    }

those resolved the dependency error and my app works. might help someone.
I got this manifest merger error as i used react-native-push-notification package.

@tatva-hiral
Copy link

Issue fixed by using the installed latest version of react-native-google-signin and react-native push-notification
and below configuration :
ext{
googlePlayServicesAuthVersion = "15.0.1"
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.5.0"
}
help

@nolife08021
Copy link

i solved mine with these dependencies

implementation project(':react-native-firebase')
implementation(project(':react-native-push-notification')) {
    exclude group: 'com.google.android.gms'
}
implementation ("com.google.android.gms:play-services-gcm:16.1.0") {
    force = true
}
implementation ("com.google.android.gms:play-services-base:16.1.0") {
    force = true
}
implementation ("com.google.firebase:firebase-core:16.0.9") {
    force = true
}
implementation ("com.google.firebase:firebase-messaging:18.0.0") {
    force = true
}

@firehand33 thanks BRO!!!finally build success

@hsa1280
Copy link

hsa1280 commented Jun 20, 2019

@JetCyC Thanks for the solution, it works for me.

@mkamals
Copy link

mkamals commented Jun 26, 2019

Thanks for this. It worked like charm.

@Yathousen
Copy link

I recently made an article to address this AndroidX situation, you may find it useful.

https://medium.com/@yathousen/the-day-google-decided-to-shake-the-react-native-community-4ba5cdd33388

@zsubzwary
Copy link

you can force google play service version in android> build.gradle file in ext like following

ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "16.0.0"
        googlePlayServicesVisionVersion = "17.0.2"
    }

my issue fixed :)

Thanks, wrote an article on this!! : https://medium.com/@zsubzwary/application-appcomponentfactory-issue-in-reactnative-project-possible-solution-3bc8afa97be?sk=201ea2c810de2c9199804aac06e17153

@zsubzwary
Copy link

Thanks, @Yathousen for the article that I cannot read because it isn't free to read !!

😭😭😓😓😭😭

@Yathousen
Copy link

Thanks, @Yathousen for the article that I cannot read because it isn't free to read !!

😭😭😓😓😭😭

Hi @zsubzwary, I'm sorry but that's weird, I'm not even part of the partner's program, are you sure you cannot read it? Could you share with us a screenshot?

@zsubzwary
Copy link

Hi @zsubzwary, I'm sorry but that's weird, I'm not even part of the partner's program, are you sure you cannot read it? Could you share with us a screenshot?


@Yathousen here you go...
ScreenShot

@alanmarcell
Copy link

  1. Check if you have a library which depends on AndroidX:

cd android && ./gradlew app:dependencies

  • For me it was Google Play Services @ 18.0.0 which depends on AndroidX.
  1. Set Google Play Services to specific version number (check https://developers.google.com/android/guides/releases for the version you want to use):
    implementation "com.google.android.gms:play-services-maps:16.0.0"
  2. If a package uses a newer version (see 1.) of the Google Play Services libraries, just exclude it in your app's build.gradle:
implementation(project(':react-native-maps')) {
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
  1. Add attributes to <application> in your AndroidManifest.xml:
android:appComponentFactory="androidx"
tools:replace="android:appComponentFactory"
  1. Add config to settings.gradle:
android.useAndroidX=false
android.enableJetifier=false

I'm not too sure about 4. and 5. but it's working for me like this. Be sure to revert this stuff when you update to 0.60+ and AndroidX support is provided by all libraries you use.

As mentioned by @firehand33 it could be that you have to force the Google Play Services libraries versions, e.g.:

implementation ("com.google.android.gms:play-services-gcm:16.1.0") {
    force = true
}

Could you post your output when you executes step 1?

@safciplak
Copy link

buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "16.0.0"
googlePlayServicesVisionVersion = "17.0.2"

https://stackoverflow.com/questions/36814755/sources-for-android-api-23-platform-not-found-android-studio-2-0/37283886#37283886

@facebook facebook locked as resolved and limited conversation to collaborators Jun 18, 2020
@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
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Type: Question Issues that are actually questions and not bug reports.
Projects
None yet
Development

No branches or pull requests