Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question AndroidX CoreComponentFactory problem on 2019.3

Discussion in '2019.3 Beta' started by RobertTry, Nov 14, 2019.

  1. RobertTry

    RobertTry

    Joined:
    Jan 25, 2015
    Posts:
    8
    My project is building fine on Unity 2018.4 - 2019.2 when i switch to Unity 2019.3.0b7 - 2019.3.0b10 - 2020.1
    I am getting error:

    Code (CSharp):
    1. Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:1
    2. is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    3. Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:3-121 to override.
    if i add
    tools:replace="android:appComponentFactory
    it start to show:

    Code (CSharp):
    1.  
    2. java.lang.RuntimeException: Duplicate class android.support.customtabs.ICustomTabsCallback found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:27.0.2)
    3.   Duplicate class android.support.customtabs.ICustomTabsCallback$Stub found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:27.0.2)
    4.   Duplicate class android.support.customtabs.ICustomTabsCallback$Stub$Proxy found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:27.0.2)
    5.   Duplicate class android.support.customtabs.ICustomTabsService found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:27.0.2)
    6.   Duplicate class android.support.customtabs.ICustomTabsService$Stub found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:27.0.2)
    7.   Duplicate class android.support.customtabs.ICustomTabsService$Stub$Proxy found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:27.0.2)
    8.   Duplicate class android.support.customtabs.IPostMessageService found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:27.0.2)
    9.   Duplicate class android.support.customtabs.IPostMessageService$Stub found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:27.0.2)
    10.   Duplicate class android.support.customtabs.IPostMessageService$Stub$Proxy found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:27.0.2)
    11.   Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    12.   Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    13.   Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    14.   Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    15.   Duplicate class android.support.v4.os.IResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    16.   Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    17.   Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    18.   Duplicate class android.support.v4.os.ResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    19.   Duplicate class android.support.v4.os.ResultReceiver$1 found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    20.   Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    21.   Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    22.   Duplicate class androidx.core.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    23.   Duplicate class androidx.core.internal.package-info found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
    24.   Duplicate class androidx.versionedparcelable.CustomVersionedParcelable found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
    25.   Duplicate class androidx.versionedparcelable.NonParcelField found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
    26.   Duplicate class androidx.versionedparcelable.ParcelField found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
    27. ...
    28.  
    everything is related with
    classes.jar
    with is Unity jar

    I have view SDK like Facebook, Firebase, Mopub Mediation with start to requer to use AndroidX. Is there a way to resolve it ? Or it is a Unity Bug?
     
  2. VaidasM

    VaidasM

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    41
    Hey, could you submit a bug report and post the number here? Please make sure you include your project, or at least the piece that reproduces the issue.
     
  3. RobertTry

    RobertTry

    Joined:
    Jan 25, 2015
    Posts:
    8
    Hey @VaidasM I submit a bug report: Case 1199775
     
    LeonhardP likes this.
  4. Tonyt6363

    Tonyt6363

    Joined:
    Jun 3, 2016
    Posts:
    2
    I am seeing this same error when upgrading from 2018 to 2019.3
     
  5. vokh_demetro

    vokh_demetro

    Joined:
    Dec 4, 2019
    Posts:
    7
    I have this problem. Unity 2019.2.15 build okey.
     
  6. YakDevBrandon

    YakDevBrandon

    Joined:
    Feb 12, 2018
    Posts:
    3
    I filed a bug report with Unity. Hopefully they'll get this sorted soon. Will post here if I find anything out.
     
  7. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,106
  8. YakDevBrandon

    YakDevBrandon

    Joined:
    Feb 12, 2018
    Posts:
    3
    It's certainly possible. But the issue I've been encountering only appeared in 2019.3. That bug you linked has reproducibility since 2018.2.
     
  9. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,049
  10. RobertTry

    RobertTry

    Joined:
    Jan 25, 2015
    Posts:
    8
    I found solution for Unity 2019.3
    Add file in Plugins/Android/gradleTemplate.properties - using unity settings

    org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
    org.gradle.parallel=true
    android.useAndroidX=true
    android.enableJetifier=true
    **ADDITIONAL_PROPERTIES**

    If You wan to enable multidex on android <= 4.4
    Add file in Plugins/Android/launcherTemplate.gradle - using unity settings
    and add:

    // Android Resolver Repos Start
    ([rootProject] + (rootProject.subprojects as List)).each {
    ext {
    it.setProperty("android.useAndroidX", true)
    it.setProperty("android.enableJetifier", true)
    }
    }

    dependencies {
    implementation project(':unityLibrary')
    implementation 'androidx.multidex:multidex:2.0.1'
    }


    upload_2020-5-19_11-3-30.png
     
  11. mekusje

    mekusje

    Joined:
    Aug 27, 2018
    Posts:
    2
    Nicely done, @RobertTry and thank you for sharing! A couple of quick notes:
    1) I also needed to explicitly enable multidex in the launcherTemplate, like so (added last line):

    defaultConfig {
    minSdkVersion **MINSDKVERSION**
    targetSdkVersion **TARGETSDKVERSION**
    applicationId '**APPLICATIONID**'
    ndk {
    abiFilters **ABIFILTERS**
    }
    versionCode **VERSIONCODE**
    versionName '**VERSIONNAME**'
    multiDexEnabled true
    }


    2) In your picture, you have the bottom arrow pointing at "Custom Proguard Template", when it should be pointing to "Custom Gradle Properties Template". That said, the written instructions were correct so all good.

    Thanks again!
     
  12. Santosh-Patil

    Santosh-Patil

    Joined:
    Apr 1, 2013
    Posts:
    7
    Really helpful @RobertTry
     
  13. Deleted User

    Deleted User

    Guest

    Thank you, works like a charm
     
  14. Andelusiy

    Andelusiy

    Joined:
    Mar 24, 2020
    Posts:
    4
    Hello guys, can someone help me please to fix this
    upload_2020-10-1_14-48-38.png

    Im fighting this error for like 5 days already, still can resolve it. Already tried to put in my project.properties file this two lines of code
    android.enableJetifier=false
    android.useAndroidX=true

    Also tried to follow the suggestion of Unity tools:replace="android:appComponentFactory" , still nothing and tools underlined in red upload_2020-10-1_14-51-19.png

    Hope someone know how to fix it. Thanks in advance
     
  15. phengavalli

    phengavalli

    Joined:
    May 13, 2020
    Posts:
    1
    I was seeing this error while trying to upgrade my Unity project to support newer Android dependencies (in my case Mopub 5.17 and Admob).

    After updating the custom gradle template to use gradle version 3.4.3 (to solve the previous error "AAPT: error: unexpected element <queries> found in <manifest>"), I started facing this issue.

    This was the only post on the internet that really worked, needed to do the multidex part as well.