Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question how to update androidx.fragment:fragment latest

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

  1. PlayIgames

    PlayIgames

    Joined:
    Oct 26, 2021
    Posts:
    40
    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.
     
    PlayIgames likes this.
  3. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    399
    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:
    9
    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:
    9
    I try it but the Google Play Console still warning me!
     
  12. PlayIgames

    PlayIgames

    Joined:
    Oct 26, 2021
    Posts:
    40
    How you fixed it please let me know make a small video
     
    Aidarchik likes this.
  13. PlayIgames

    PlayIgames

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

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,406
    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.
     
  15. PlayIgames

    PlayIgames

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

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,406
    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.
     
    ahmedjalil2002 and nobluff67 like this.
  17. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    149
    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!
     
    HunnyMalik, Aidarchik and hid_ like this.
  19. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    149
    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
     
  21. Aidarchik

    Aidarchik

    Joined:
    Dec 18, 2022
    Posts:
    1

    which script did you add exactly?
     
  22. Casadev

    Casadev

    Joined:
    May 16, 2023
    Posts:
    18
    Hey folks, not sure if anyone's still having problems with this warning appearing in the Google Play Console at all, but this is the solution that worked for me:
    1: Go to project settings and find out where your mainTemplate.gradle file is located and open that in your IDE of choice, for me it was Visual studio.

    FragmentSS1.png

    After opening the file in your IDE, you should see something like this at the top:
    FragmentSS2.png

    You now want to go to https://developer.android.com/jetpack/androidx/releases/fragment to find the latest version of the fragment, which at the current moment is 1.6.2.

    For android you want to use Groovy, then proceed to copy it into your mainTemplate.gradle file in the dependencies block like so:
    FragmentSS3.png

    Then simply save your gradle file and after uploading the new build of your project, this warning should disappear from the play console.

    Hopefully this helps anyone like me that has had this warning appear in the google play console.

    Disclaimer: This worked for me, but it may not work for everyone, i'm just posting here so that it may help others.
     
    Braza, fahimkamal63 and imranmohsin5 like this.
  23. ahmedjalil2002

    ahmedjalil2002

    Joined:
    Jan 14, 2022
    Posts:
    1


    This Worked thx
     
  24. imranmohsin5

    imranmohsin5

    Joined:
    Apr 24, 2023
    Posts:
    1
    This method works but not this version 1.6.2.
    In Unity 2021.3.33
    def fragment_version = "1.2.5"
    implementation "androidx.fragment:fragment:$fragment_version"
    implementation "androidx.fragment:fragment-ktx:$fragment_version"
     
  25. monkey_games_studios

    monkey_games_studios

    Joined:
    Feb 16, 2024
    Posts:
    1

    Thank you! This solved my problem
     
    RIKKYPATRIA likes this.
  26. rodhirejab

    rodhirejab

    Joined:
    Feb 27, 2021
    Posts:
    1
    Hi I never post anything before and I found a way on how to do it after suffering for a week. So I know how you feel.


    This is how it works for me, not my solution

    (give her a sub)

    1) If you have "Editor" folder inside Assets, just add the Dependencies.xml file in that folder (I shared .xml file above)
    2) If you don't have Editor Folder, create a folder with name Editor and add .xml file
    3) If the above method is not working try to add the code I provided in mainTemplate.gradle script, inside dependencies, like this
    dependencies { implementation 'androidx.fragment:fragment:1.3.6' }

    finding mainTemplate.gradle script, is a bit tricky, I followed Casadev method

     
    Braza likes this.