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 how to update androidx.fragment:fragment latest

Discussion in 'Getting Started' started by shockedgamestudio, Jul 5, 2023.

  1. shockedgamestudio

    shockedgamestudio

    Joined:
    Oct 26, 2021
    Posts:
    28
    Recently I’ve just updated one of my apps and Google has show me this message:

    Warning

    The developer of androidx.fragment:fragment (androidx.fragment:fragment) has reported version 1.0.0 as outdated. Consider upgrading to one of the following versions before publishing a new release: 1.1.0+.

    please help me

    Learn more about the SDKs that you’re using and make informed SDK choices with Google Play SDK Index 2.
     
  2. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    I have been searching for a solution for this for a week and have not found anything remotely useful on how to fix this.
     
    shockedgamestudio likes this.
  3. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    383
    Have you tried adding a dependency to a newer version of the library using an EDM4U Dependencies.xml file?

    <dependencies>
    <androidPackages>
    <androidPackage spec="androidx.fragment:fragment:1.1.0" />
    </androidPackages>
    </dependencies>


    This will override older versions that other android libraries depend upon.
     
  4. PortalArcher

    PortalArcher

    Joined:
    Sep 9, 2020
    Posts:
    8
    I am still frustrated. Anybody know how to get rid of this warning?
     
  5. mohammadrezaazari

    mohammadrezaazari

    Joined:
    May 12, 2022
    Posts:
    1
    Same problem. Does anybody know how to get rid of this warning?
     
  6. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    Mine magically disappeared.

    I did change a few unrelated things, just not sure which one solved the issue.

    1. I added admob.
    2. I added unity ads (through admob mediation).
    3. I added facebook ads (through admob mediation).
     
  7. iqbalsurya77

    iqbalsurya77

    Joined:
    Jul 12, 2018
    Posts:
    1
    how??pls make youtube tutorial
     
  8. Roman_Baranov

    Roman_Baranov

    Joined:
    Feb 12, 2017
    Posts:
    2
    Hey everyone.
    Have same problem here.
    Does anyone managed to fix this?
     
  9. fadizant

    fadizant

    Joined:
    Dec 17, 2016
    Posts:
    6
    Any tips to fix this issue? Google Play Console keeps warning me to update it :(

    upload_2023-8-13_9-2-50.png
     
  10. ahmed_ameen2

    ahmed_ameen2

    Joined:
    Jul 3, 2012
    Posts:
    5
    Hi guys, I have fixed it by applying the above solution, I am using Firebase so I added this line
    <androidPackage spec="androidx.fragment:fragment:1.1.0" />
    to AnalyticsDependencies.xml located in \Assets\Firebase\Editor

    Good luck.
     
    nobluff67 likes this.
  11. fadizant

    fadizant

    Joined:
    Dec 17, 2016
    Posts:
    6
    I try it but the Google Play Console still warning me!
     
  12. shockedgamestudio

    shockedgamestudio

    Joined:
    Oct 26, 2021
    Posts:
    28
    How you fixed it please let me know make a small video
     
  13. shockedgamestudio

    shockedgamestudio

    Joined:
    Oct 26, 2021
    Posts:
    28
    Same here
     
  14. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,092
    The reason for me is / was the Google Play Game Services (v0.11.01).
    Play Services Source: https://github.com/playgameservices/play-games-plugin-for-unity/tree/master/current-build

    The Google Play Services package has not seen a new release within the last year. I find it disturbing that they show a warning in the console while they do not update their own package to prevent said warning. Seems like those two teams are not communicating. Maybe someone from Unity could go poke them so they update the package.

    Here is the gradle dependencies graph (notice the outdated androidx.fragment:fragment:1.0.0 instead of the recommended 1.1.0). Created following this guide. The "dependencies" command is very useful to find out where exactly it is coming from.

    > Task :unityLibrary:dependencies

    ------------------------------------------------------------
    Project :unityLibrary
    ------------------------------------------------------------

    +--- com.google.games:gpgs-plugin-support:0.11.01
    | +--- com.google.android.gms:play-services-games-v2:17.0.0
    | | +--- com.google.android.gms:play-services-base:18.0.1
    | | | +--- androidx.collection:collection:1.0.0
    | | | | \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    | | | +--- androidx.core:core:1.2.0
    | | | | +--- androidx.annotation:annotation:1.1.0
    | | | | +--- androidx.lifecycle:lifecycle-runtime:2.0.0
    | | | | | +--- androidx.lifecycle:lifecycle-common:2.0.0
    | | | | | | \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    | | | | | +--- androidx.arch.core:core-common:2.0.0
    | | | | | | \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    | | | | | \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    | | | | \--- androidx.versionedparcelable:versionedparcelable:1.1.0
    | | | | +--- androidx.annotation:annotation:1.1.0
    | | | | \--- androidx.collection:collection:1.0.0 (*)
    | | | +--- androidx.fragment:fragment:1.0.0
    | | | | +--- androidx.core:core:1.0.0 -> 1.2.0 (*)
    | | | | +--- androidx.legacy:legacy-support-core-ui:1.0.0
    | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    | | | | | +--- androidx.core:core:1.0.0 -> 1.2.0 (*)
    | | | | | +--- androidx.legacy:legacy-support-core-utils:1.0.0
    | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    | | | | | | +--- androidx.core:core:1.0.0 -> 1.2.0 (*)
    | | | | | | +--- androidx.documentfile:documentfile:1.0.0
    | | | | | | | \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    | | | | | | +--- androidx.loader:loader:1.0.0
    | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    | | | | | | | +--- androidx.core:core:1.0.0 -> 1.2.0 (*)
    | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.0.0
    | | | | | | | | +--- androidx.arch.core:core-runtime:2.0.0
    | | | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    | | | | | | | | | \--- androidx.arch.core:core-common:2.0.0 (*)
    | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0
    | | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.0.0 (*)
    | | | | | | | | | +--- androidx.arch.core:core-common:2.0.0 (*)
    | | | | | | | | | \--- androidx.arch.core:core-runtime:2.0.0 (*)
    | | | | | | | | \--- androidx.arch.core:core-common:2.0.0 (*)
    | | | | | | | \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0
    | | | | | | | \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    ...


    @tessellation 's solution is working.

    Step by step guide:

    1) Create a folder Assets/Editor

    2) Add a file (name ending with "Dependencies.xml"). I Chose "OverrideDependencies.xml"
    Content of the file:
    Code (csharp):
    1.  
    2. <!-- see https://forum.unity.com/threads/how-to-update-androidx-fragment-fragment-latest.1456870/#post-9136117 -->
    3. <dependencies>
    4.   <androidPackages>
    5.     <repositories>
    6.       <repository>https://repo.maven.apache.org/maven2</repository>
    7.     </repositories>
    8.     <androidPackage spec="androidx.fragment:fragment:1.1.0" />
    9.   </androidPackages>
    10. </dependencies>
    3) Force resolve with the dependency mananger from google (formerly jar resolver):
    upload_2023-8-22_12-13-35.png

    If you are using GameService you may have to apply this fix too.
     
    brendanw, D-Ulriken and tessellation like this.
  15. shockedgamestudio

    shockedgamestudio

    Joined:
    Oct 26, 2021
    Posts:
    28
    I try your methods but It is still showing the Google Play Console Error
     
  16. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,092
    Have you tried using the gradle "dependencies" command to check where the dependency is coming from? You can run the command on the created gradle file in the build and it will show you the source.

    Also, Google did show the warning for me even after upgrading. That's when I noticed that they are also checking any old alpha or beta releases. It's a bit confusing but maybe your build is already fine and it's just an old beta that's causing it.
     
    nobluff67 likes this.
  17. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    118
    From youtube, you need add
    constraints.implementation 'androidx.fragment:fragment:1.3.6'
    to `mainTemplate.gradle`

    upload_2023-8-28_12-37-37.png
     
  18. bitterness

    bitterness

    Joined:
    Sep 19, 2013
    Posts:
    14
    The dependency list in mainTemplate.gradle is actually generated by the Android Resolver and adding something into that list might result in it being overridden next time the resolver runs (maybe if you add it outside the Android Resolver comments it won't be erased depending on whether your gradle file is set to be auto-generated or not, haven't tested)

    See how on each dependency line in the gradle file there's a commented out XML dependency file name? This actually ties in with the solution posed by tesselation and __geo__ -- these dependencies are actually being parsed from the Assets/*Dependency.XML files listed.

    I added my own Assets/Editor/MyDependencies.xml and then ran the resolver (Assets -> External Dependency Manager -> Android Resolver -> Force resolve) and checked mainTemplate.gradle, and the androidx.fragment dependency override appeared in the same spot as in restush96's post. So I'd advise taking the XML approach instead!
     
    hid_ likes this.
  19. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    118
    bitterness likes this.
  20. hid_

    hid_

    Joined:
    Apr 5, 2021
    Posts:
    10
    It works. Thank you guys.

    but in my case helped this dependency file

    Code (CSharp):
    1. <dependencies>
    2.   <androidPackages>
    3.     <androidPackage spec="androidx.fragment:fragment:1.1.0">
    4.       <androidSdkPackageIds>
    5.         <androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
    6.       </androidSdkPackageIds>
    7.     </androidPackage>
    8.   </androidPackages>
    9. </dependencies>
    And IMPORTANT things to do is:
    1. Force Resolve (Assets > External Dependency Manager > Android Resolver > Force Resolve)
    2. Then remove {yourProject}/Libraries/Bee/Android folder
    3. Build

    Cheers. Hope it will help