• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by HandsIndustries · Dec 03, 2018 at 08:41 AM · manifest

File Paths XML file provider Manifest

Hi,

Anybody got an idea where I need to put the file_paths file for the file provider in Unity please? Here's the snippet from the manifest:

 <meta-data android:name="android.support.FILE_PROVIDER_PATHS"
     android:resource="@xml/file_paths" />

I need to know where to but the file_paths.xml that is used by the android:resource?

Thanks

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by HandsIndustries · Dec 07, 2018 at 02:03 PM

I managed to sort this in the end, I don't have the details to hand at the moment but ill post them here later. @Terrortronics

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Terrortronics · Dec 07, 2018 at 04:42 PM 0
Share

@HandsIndustries

I'm excited. I'm really curious about what you found out.

avatar image
0

Answer by Terrortronics · Dec 04, 2018 at 09:29 PM

@HandsIndustries

I'm also doing this. Maybe we can figure it out together.

This stack overflow walks through your question in more detail: https://stackoverflow.com/questions/45012523/how-to-install-android-apk-from-code-in-unity/45012767

But it still isn't going to work, I'm afraid. With all the XML stuff setup correctly, Unity still isn't going to be able to actually find FileProvider. "adb logcat" will blow out an error saying that it can't find the FileProvider library, at least.

Looking through the above post, I've copied the support-core-utils-25.3.1.aar file over to the /Assets/Plugins/Android/ directory, so I should be able to use it.

Now I'm looking at this line of code:

 AndroidJavaObject fileProvider = new AndroidJavaObject("[WHAT THE HECK DO I PUT HERE?].FileProvider");

I think I need to replace [WHAT THE HECK TO I PUT HERE?], and then it should be good to go. Maybe I'm missing some assumed knowledge about how to format this.

I hope this gets us a step further.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HandsIndustries · Dec 08, 2018 at 09:50 AM 1
Share

Hi there,

First thing to do is to make sure you have defined the FileProvider in the Android$$anonymous$$anifest which is located at \Assets\Plugins\Android\Android$$anonymous$$anifest.xml.

Then you need to define the file paths file in the Android Resources X$$anonymous$$L folder which should be \Assets\Plugins\Android\res\xml, if this doesn't exist create it and add your file paths xml in here.

In terms of using the FileProvider here's the code to use, note that the fileProvider class references the actual class from Android itself:

     AndroidJavaClass fileProvider = new AndroidJavaClass("android.support.v4.content.FileProvider");
     AndroidJavaObject uri = fileProvider.CallStatic<AndroidJavaObject>("getUriForFile", currentActivity, authority, file);

Hope this helps

avatar image Terrortronics HandsIndustries · Dec 08, 2018 at 04:03 PM 0
Share

Thanks.

It's this line that's the issue for me.

 AndroidJavaClass fileProvider = new AndroidJavaClass("android.support.v4.content.FileProvider");

It's here that logcat dumps and error saying the this class cannot be found.

$$anonymous$$aybe I do have my Android$$anonymous$$anifest setup incorrectly? I having a working Android project, and I'm using that as a template.

I wonder why you're having success with instantiating a FileProvider object, and I'm not.

avatar image Terrortronics HandsIndustries · Dec 13, 2018 at 06:22 PM 0
Share

I found this, too:

https://www.youtube.com/watch?v=EkF1pB1Ut-$$anonymous$$

https://github.com/cwgtech/AndroidUnityShareScreenShot

avatar image
0

Answer by thejox · Apr 18, 2019 at 09:45 AM

So the answer is: in order that Unity can find the file when building, it has to be put underneath /Assets/Plugins/Android/res/. In this case specifically /Assets/Plugins/Android/res/xml/file_paths.xml.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

96 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

android tablet resolution? how to restrict 0 Answers

Android App not showing in Play search results? 1 Answer

How to display a detailed game startup log during splash screen? 0 Answers

How To fix FacebookSDK merge error in androidmanifest.xml ? 0 Answers

android AndroidManifest.xml:5: error: String types not allowed - with 2017.2.03f 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges