Open marcio-pessoa opened 1 year ago
Hi, here the same issue on Godot 3.5.3:
/Users/meme/Documents/Godot/Juegos/MultiplicarconMax/android/build/src/debug/AndroidManifest.xml:28:13-64 Error:
Attribute provider#androidx.core.content.FileProvider@authorities value=(com.mmicoe.elementaryschoolmultiply.android.fileprovider) from [godot-lib.debug.aar] AndroidManifest.xml:28:13-64
is also present at [GodotShare.release.aar] AndroidManifest.xml:18:13-51 value=(com.mmicoe.elementaryschoolmultiply.android).
Suggestion: add 'tools:replace="android:authorities"' to
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
Help is needed because this plugin is very useful for me!
Thanks a lot.
try it:
Add to your AndroidManifest.xml file, inside the application tag:
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"
tools:replace="android:resource" />
</provider>
Thank you @gumaciel
The last solution you sent me works! Thank you very much for your solution!!!!
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/godot_provider_paths"
tools:replace="android:resource" />
</provider>
All the best!
The snippet from @gumaciel fixed the issue. Thanks buddy!
I closed this issue, but opened it again as the documentation for this plugin should include the @gumaciel snippet. Otherwise the plugin won't work in Godot version 3.5.3 (and later - maybe).
try it:
Add to your AndroidManifest.xml file, inside the application tag:
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" tools:replace="android:resource" /> </provider>
What's the path of the manifest file to be edited?
What's the path of the manifest file to be edited?
What's the path of the manifest file to be edited?
Thank you @gumaciel
The last solution you sent me works! Thank you very much for your solution!!!!
<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/godot_provider_paths" tools:replace="android:resource" /> </provider>
All the best!
What's the path of the manifest file to be edited?
I modified the "project root/android/build/Androidmanifest.xml" file.
By adding @gumaciel's <provider>
tag as a child of the <application>
tag, I succeeded in building it.
Unfortunately, I found that the photo sharing feature did not work on Android.
Here's the output from my logcat
11-25 02:08:53.635 17107 17221 D godot : sharePic called
11-25 02:08:53.636 17107 17221 E godot : The selected file can't be shared: /data/data/xxx.yyy.zzz/files/tmp.png
I've resolved the issue following the guidance provided by @gumaciel with the following modifications:
<provider>
tag as a child of the <application>
tag:<!-- Any tag in this line after android:icon will be erased when doing custom builds. -->
<!-- If you want to add tags manually, do before it. -->
<!-- WARNING: This should stay on a single line until the parsing code is improved. See GH-32414. -->
<application android:label="@string/godot_project_name_string" android:allowBackup="false" android:isGame="true" android:hasFragileUserData="false" android:requestLegacyExternalStorage="false" tools:ignore="GoogleAppIndexingWarning" android:icon="@mipmap/icon">
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/godot_provider_paths"
tools:replace="android:resource" />
</provider>
<!-- Records the version of the Godot editor used for building -->
<meta-data
android:name="org.godotengine.editor.version"
android:value="${godotEditorVersion}" />
...
It was crucial to set the value of android:authorities
to ${applicationId}
to resolve the issue. This value should match the applicationId
specified in the "GodotProjectRoot/android/build/build.gradle" file under android.defaultConfig.applicationId
. By default, it is set in the build.gradle file as follows:
applicationId getExportPackageName()
Created the directory "GodotProjectRoot/android/build/res/xml".
Created the file "GodotProjectRoot/android/build/res/xml/godot_provider_paths.xml".
Configured the godot_provider_paths.xml file as follows:
<?xml version="1.0" encoding="utf-8"?>
<paths>
<files-path name="share_path" path="."/>
<!-- 'files-path' points to the 'files' directory within the app's internal storage. -->
<!-- 'path="."' means it includes all files within the files directory. -->
</paths>
func take_screenshot():
var share_plugin = null
if Engine.has_singleton("GodotShare"):
share_plugin = Engine.get_singleton("GodotShare")
if share_plugin == null:
print("share plugin is null")
return
var _screenshot = get_viewport().get_texture().get_data()
_screenshot.flip_y()
# Set the amount to crop from the top of the captured image
var top_space_height = 0
var crop_height = _screenshot.get_height() - top_space_height
var cropped_img := Image.new() as Image
cropped_img.create(_screenshot.get_width(), crop_height, false, _screenshot.get_format())
cropped_img.blit_rect(_screenshot, Rect2(0, top_space_height, _screenshot.get_width(), crop_height), Vector2.ZERO)
var _image_save_path = OS.get_user_data_dir() + "/tmp.png"
var _rand = cropped_img.save_png(_image_save_path)
share_plugin.sharePic(_image_save_path, "AAA", "BBB", "CCC")
Thanks to this plugin, I was able to easily share my game screen. I am always grateful to the developers for their work.
@zungm2 I followed your steps exactly but I have a erorr in building the project because of SDK 32 Godot v 3.5.3 GodotShare Version 3.0.0
try it:
Add to your AndroidManifest.xml file, inside the application tag:
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" tools:replace="android:resource" /> </provider>
Didn't work. Another error pops up.
@zungm2 I followed your steps exactly but I have a erorr in building the project because of SDK 32 Godot v 3.5.3 GodotShare Version 3.0.0
its working fine I'm dumb i forget to add this codre below sorry and thank you so much <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/godot_provider_paths" tools:replace="android:resource" />
Thank you @gumaciel and @zungm2 ! No way I would have ever figured this out myself. This should be in the documentation 100%
I've resolved the issue following the guidance provided by @gumaciel with the following modifications:
1. In the "GodotProjectRoot/android/build/AndroidManifest.xml" file, I added the following `<provider>` tag as a child of the `<application>` tag:
<!-- Any tag in this line after android:icon will be erased when doing custom builds. --> <!-- If you want to add tags manually, do before it. --> <!-- WARNING: This should stay on a single line until the parsing code is improved. See GH-32414. --> <application android:label="@string/godot_project_name_string" android:allowBackup="false" android:isGame="true" android:hasFragileUserData="false" android:requestLegacyExternalStorage="false" tools:ignore="GoogleAppIndexingWarning" android:icon="@mipmap/icon"> <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/godot_provider_paths" tools:replace="android:resource" /> </provider> <!-- Records the version of the Godot editor used for building --> <meta-data android:name="org.godotengine.editor.version" android:value="${godotEditorVersion}" /> ...
It was crucial to set the value of
android:authorities
to${applicationId}
to resolve the issue. This value should match theapplicationId
specified in the "GodotProjectRoot/android/build/build.gradle" file underandroid.defaultConfig.applicationId
. By default, it is set in the build.gradle file as follows:
applicationId getExportPackageName()
2. Created the directory "GodotProjectRoot/android/build/res/xml". 3. Created the file "GodotProjectRoot/android/build/res/xml/godot_provider_paths.xml". 4. Configured the godot_provider_paths.xml file as follows:
<?xml version="1.0" encoding="utf-8"?> <paths> <files-path name="share_path" path="."/> <!-- 'files-path' points to the 'files' directory within the app's internal storage. --> <!-- 'path="."' means it includes all files within the files directory. --> </paths>
5. Shared the code used in my game to capture and share the screen using this plugin:
func take_screenshot(): var share_plugin = null if Engine.has_singleton("GodotShare"): share_plugin = Engine.get_singleton("GodotShare") if share_plugin == null: print("share plugin is null") return var _screenshot = get_viewport().get_texture().get_data() _screenshot.flip_y() # Set the amount to crop from the top of the captured image var top_space_height = 0 var crop_height = _screenshot.get_height() - top_space_height var cropped_img := Image.new() as Image cropped_img.create(_screenshot.get_width(), crop_height, false, _screenshot.get_format()) cropped_img.blit_rect(_screenshot, Rect2(0, top_space_height, _screenshot.get_width(), crop_height), Vector2.ZERO) var _image_save_path = OS.get_user_data_dir() + "/tmp.png" var _rand = cropped_img.save_png(_image_save_path) share_plugin.sharePic(_image_save_path, "AAA", "BBB", "CCC")
Thanks to this plugin, I was able to easily share my game screen. I am always grateful to the developers for their work.
I'm in love with you. Please marry me. You have saved my life.
Hi dears.
I found an issue when building to Android using latest Godot version (3.5.3):
Could you please kindle help me to solve this issue?
Thanks a lot.