0

I have this App that fully works on IOS, but when I try to start on Android Device (Phisical, or Emulated) before hit any Method (OnCreate, OnStart, etc) app crashes and give me this error:

Java.Lang.RuntimeException: 'Unable to get provider androidx.startup.InitializationProvider: java.lang.ClassNotFoundException: Didn't find class "androidx.startup.InitializationProvider" on path: DexPathList[[zip file "/data/app/com.myapp.myapp123-enX6MwKxPJAu9d6bm6sajg==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp.myapp123-enX6MwKxPJAu9d6bm6sajg==/lib/arm64, /data/app/com.myapp.myapp123-enX6MwKxPJAu9d6bm6sajg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]'

Then after a long search I think the problem may come from two possible points:

-SplashScreen on Android Project

or

-Binding an .AAR file (.AAR file build action is LibraryProjectZip)

But all attempts to fix the problem have failed.

UPDATE

This is Android Manifest

<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application android:requestLegacyExternalStorage="true" android:label="My App" android:theme="@style/MainTheme">



    <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:grantUriPermissions="true" android:exported="false">
        <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" />
    </provider>
    
</application>

UPDATE 2 Code inside filepaths.xml in resources:

<paths>
    <external-path path="." name="mydocuments" />
    <external-path name="external_files" path="."/>
    <files-path name="files" path="."/>
    <internal-path name="internal_files" path="."/>
</paths>

UPDATE 3

I try to:

  • Delete my code in path and replace it whit the whole code that ColeX has mentioned in the link above (nothing)

     <paths xmlns:android="http://schemas.android.com/apk/res/android">
             <external-files-path name="my_images" path="Pictures" />
             <external-files-path name="my_movies" path="Movies" />
     </paths>
    
  • Keep my code and add the code mentioned (nothing)

     <paths xmlns:android="http://schemas.android.com/apk/res/android">
         <external-path path="." name="mydocuments" />
         <external-path name="external_files" path="."/>
         <files-path name="files" path="."/>
         <internal-path name="internal_files" path="."/>
    
         <external-files-path name="my_images" path="Pictures" />
         <external-files-path name="my_movies" path="Movies" />
     </paths>
    
  • Replace "external-path" for "external-files-path" and "internal-path" for "internal-files-path" (nothing )

  • Add and remove

xmlns:android="http://schemas.android.com/apk/res/android"

in all this tries (nothing too)

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Alex
  • 25
  • 1
  • 9
  • Have you tried to disable automatic initialization in manifest ? Check the link here :https://stackoverflow.com/questions/65321223/unable-to-get-provider-androidx-startup-initializationprovider / – ColeX Mar 30 '22 at 06:08
  • I read that post, but I think code is incompatible whit my Manifest. Now I Update my post and share my Manifest, how is suppose I have to change this? – Alex Mar 30 '22 at 08:10
  • `FileProvider` should work , did you add the xml in resources folder as mentioned in step2 here : https://github.com/jamesmontemagno/MediaPlugin#android-required-setup . – ColeX Mar 30 '22 at 08:45
  • And search to check if you're using `InitializationProvider` in your code . – ColeX Mar 30 '22 at 08:46
  • Yes, I have the xml file in resource folder called 'filepaths.xml' – Alex Mar 30 '22 at 09:00
  • I updated another time the post, and thanks for time that you dedicate for this problem ColeX – Alex Mar 30 '22 at 09:05
  • Can you copy the whole code in file_paths which is mentioned in the link I provided ? It seems that your code is incomplelte. – ColeX Mar 30 '22 at 09:37
  • I try it to and updated post for share you my codes. But it still don't work – Alex Mar 30 '22 at 10:26
  • A silly doubt , did you add `` at the beginning of the xml ? – ColeX Mar 31 '22 at 07:34
  • Sorry for responding too late. Finally I can fix the problem, and the problem I think that was a repository problem, because when I recharge all repository (whitout changing anythink in the project) App starts to work. I have spent many days to try resolve this.. Thank you ColeX for the time spent. – Alex Apr 06 '22 at 09:21
  • Ok, happy coding ~ – ColeX Apr 06 '22 at 09:41
  • If possible could you attach the solution as answer and mark it , thanks . – ColeX Apr 06 '22 at 09:42
  • try clean and rebuild :) – Samuel May 19 '22 at 18:45

1 Answers1

0

I can fix the problem, there's nothing wrong in code shared here or in any file, so I think problem has origin from repository where App is loaded. I simply delete the branch (branch equal to master) and create a new one. And now the App in android works well.

Special thanks to ColeX that supports me in this issue and help me to understand that there's nothing wrong in my code

Alex
  • 25
  • 1
  • 9