elringus / unity-google-drive

Google Drive SDK for Unity game engine
https://forum.unity.com/threads/515360
MIT License
404 stars 64 forks source link

Consolidate Android manifest #85

Open hippogamesunity opened 3 years ago

hippogamesunity commented 3 years ago

Find a way to supply plugin-specific config for Android manifest (appAuthRedirectScheme), that would merge with user-supplied manifest/config


Hi! I had to enable multidex in my project (this article was used https://habr.com/ru/post/487336/), but still can't build on Android. Manifest merger failed : Attribute data@scheme at AndroidManifest.xml requires a placeholder substitution but no value for <appAuthRedirectScheme> is provided. I was trying to find a solution on web, but with no luck. Adding manifestPlaceholders = [appAuthRedirectScheme: 'com.redirectScheme.comm'] to mainTemplate.gradle doesn't help. At the same time, I can build my project with multidex enabled after removing UGD (but this is not an option for me actually).

Also I've found that some people also mentioned UGD related to appAuthRedirectScheme issue here: https://forum.unity.com/threads/gradle-nightmare-appauthredirectscheme.831934/

Hope to find a solution soon...

hippogamesunity commented 3 years ago

Some Unity guy said You could modify the template in the Unity install directory, but that is not supported and it will affect all of your projects built with that Unity version. (https://forum.unity.com/threads/cant-build-with-multidex-enabled.773348/).

I was trying to modify all .gradle files inside Unity installation folder one by one and have found a possible solution:

This is a bad solution, but at least I was able to build, although it works only for ARMv7 and crashes on app start for ARM64. Also I wonder why modifying mainTemplate.gradle (generated inside your project after enabling Custom Main Gradle Templage option) doesn't do the trick.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 14 days with no activity. It will be automatically closed in 7 days.

dustinkerstein commented 2 years ago

@hippogamesunity I had to use that same workaround. Nothing else I tried got my Android build working on Unity 2021.3.3f1.

ROBYER1 commented 2 years ago

Why is this closed if there isn't a fix in the plugin? There must be some other way to work around this in the package itself?

PhucDev02 commented 1 year ago

The way of @hippogamesunity works. But I need a solution for ARM64,because ARM64 is required for upload AAB file to Google Play Store

fmbnicola commented 1 year ago

Same issue here, but I haven't enabled multidex on my project...
Adding the line to Editor\Data\PlaybackEngines\AndroidPlayer\Tools\GradleTemplates\launcherTemplate.gradle works even for ARM64. Adding it to the custom main gradle template did not work :( Has anybody had any luck fixing this issue?

tatelax commented 1 year ago

@Elringus This issue still exists and hippo's solution works. Closing issues simply because there was no activity for 2 weeks is not a great idea.

elringus commented 1 year ago

@tatelax Feel free to send a PR to fix the issue, I'll review it.

Abbabon commented 1 year ago

Why is this closed if there isn't a fix in the plugin? There must be some other way to work around this in the package itself?

the 'culture' in this repo is to request a PR to fix the issue and then close the issue... very common these days unfortunately (github should really add this as a state)

elringus commented 1 year ago

@AmitWhalo @Abbabon The issues are closed automatically when no activity is detected in a set period of time. It's not like I'm closing them manually.

The 'culture' of many github users is, unfortunately, to treat open-source repos as a product they own and assume they're entitled for tech support just because they're using it. Please don't forget we're sharing the code and maintaining it just out of our good will.

MattLichter commented 1 year ago

Why is this closed if there isn't a fix in the plugin? There must be some other way to work around this in the package itself?

the 'culture' in this repo is to request a PR to fix the issue and then close the issue... very common these days unfortunately (github should really add this as a state)

Nothing unfortunate about it in the slightest. This software is free in every sense of the word. Nobody is entitled to support from anybody.

Abbabon commented 1 year ago

@MattLichter @Elringus

> > > Why is this closed if there isn't a fix in the plugin? There must be some other way to work around this in the package itself?

the 'culture' in this repo is to request a PR to fix the issue and then close the issue... very common these days unfortunately (github should really add this as a state)

Nothing unfortunate about it in the slightest. This software is free in every sense of the word. Nobody is entitled to support from anybody.

I'm sorry if I've touched an exposed nerve here - but the actual issue, as a bug in the software is not closed. The repo's state does not reflect the state of the said free software.

elringus commented 1 year ago

but the actual issue, as a bug in the software

I'm not even sure the issue is caused by the plugin. Looks like something android/unity-related.

tatelax commented 1 year ago

I'm only suggesting that just because an issue hasn't had replies for some period of time doesn't mean it's been resolved. Closing issues makes it harder for people to find solutions.

The fix for this might just be updating the readme to mention that you need to modify a file in your editor install to resolve issues on Android.

amoffatt commented 10 months ago

Expanding on @hippogamesunity's work around:

To avoid editing the Unity installation's gradle files, you can also use a custom launcherTemplate.gradle in your project, and apply the change to it. Enable:

Project Settings -> Player -> Android settings -> Publishing Settings -> Custom Launcher Gradle Template

Then in your project's Assets/Plugins/Android/launcherTemplate.gradle file, within the defaultConfig { } section, add the line:

manifestPlaceholders = [appAuthRedirectScheme: 'com.mydomain.myapp']

This 'com.mydomain.myapp' value is the URL scheme you want to use to launch your app via url, the same as Unity Deep Linking. I don't understand why UnityGoogleDrive uses a different method of setting this scheme than is described in Unity's Deep Linking API, but this workaround should fix the build error.

elringus commented 10 months ago

why UnityGoogleDrive uses a different method of setting this scheme than is described in Unity's Deep Linking

Because Unity Deep Linking was added in Unity 2021, while the plugin was initially released for Unity 5, and the current min. supported version (the one I'm personally using) is 2019.

Orlokun commented 8 months ago

@amoffatt This solution worked in my case. Thanks a lot!