nhn / gpm.unity

A brand of NHN providing free services required for game development.

Home Page:https://gameplatform.nhncloud.com/en/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gradle build failed for getting apk

aliagha-huseynli opened this issue · comments

Service

  • WebView

Version

Unity - 2021.3.16f1
GPM - Version 2.2.4 - May 08, 2023

Summary

When I try to build and run or build I got error on gradle side.
Interesting thing is when I try to build without check "Custom Main Gradle Template" in Project settings > Player,
it builds well. But When I check it as you instruct me on documentation I got these errors. Please help me to fix my issue thanks in advance.

Screenshots

Screenshot 2023-05-23 141817
Screenshot 2023-05-23 141033
Screenshot 2023-05-23 141027
Screenshot 2023-05-23 141020

Additional context

I don't see #if UNITY_ANDROID part your example code:

`using Gpm.WebView;
using System.Collections.Generic;
using UnityEngine;

public class WebViewTest : MonoBehaviour
{
// FullScreen
public void ShowUrlFullScreen ()
{
GpmWebView.ShowUrl (
"https://google.com/",
new GpmWebViewRequest.Configuration ()
{
style = GpmWebViewStyle.FULLSCREEN,
orientation = GpmOrientation.LANDSCAPE,
isClearCookie = true,
isClearCache = true,
isNavigationBarVisible = true,
navigationBarColor = "#4B96E6",
title = "The page title.",
isBackButtonVisible = true,
isForwardButtonVisible = true,
supportMultipleWindows = true,
#if UNITY_IOS
contentMode = GpmWebViewContentMode.MOBILE
#endif
},
OnCallback,
new List ()
{
"USER_ CUSTOM_SCHEME"
});
}

// Popup default
public void ShowUrlPopupDefault ()
{
	GpmWebView.ShowUrl (
			"https://google.com/",
			new GpmWebViewRequest.Configuration ()
			{
				style = GpmWebViewStyle.POPUP,
				orientation = GpmOrientation.LANDSCAPE,
				isClearCookie = true,
				isClearCache = true,
				isNavigationBarVisible = false,
				supportMultipleWindows = true,

#if UNITY_IOS
contentMode = GpmWebViewContentMode.MOBILE,
isMaskViewVisible = true,
#endif
},
OnCallback,
new List ()
{
"USER_ CUSTOM_SCHEME"
});
}

// Popup custom position and size
public void ShowUrlPopupPositionSize ()
{
	GpmWebView.ShowUrl (
			"https://google.com/",
			new GpmWebViewRequest.Configuration ()
			{
				style = GpmWebViewStyle.POPUP,
				orientation = GpmOrientation.LANDSCAPE,
				isClearCookie = true,
				isClearCache = true,
				isNavigationBarVisible = false,
				position = new GpmWebViewRequest.Position
				{
					hasValue = true,
					x = (int)(Screen.width * 0.1f),
					y = (int)(Screen.height * 0.1f)
				},
				size = new GpmWebViewRequest.Size
				{
					hasValue = true,
					width = (int)(Screen.width * 0.8f),
					height = (int)(Screen.height * 0.8f)
				},
				supportMultipleWindows = true,

#if UNITY_IOS
contentMode = GpmWebViewContentMode.MOBILE,
isMaskViewVisible = true,
#endif
}, null, null);
}

// Popup custom margins
public void ShowUrlPopupMargins ()
{
	GpmWebView.ShowUrl (
			"https://google.com/",
			new GpmWebViewRequest.Configuration ()
			{
				style = GpmWebViewStyle.POPUP,
				orientation = GpmOrientation.LANDSCAPE,
				isClearCookie = true,
				isClearCache = true,
				isNavigationBarVisible = false,
				margins = new GpmWebViewRequest.Margins
				{
					hasValue = true,
					left = (int)(Screen.width * 0.1f),
					top = (int)(Screen.height * 0.1f),
					right = (int)(Screen.width * 0.1f),
					bottom = (int)(Screen.height * 0.1f)
				},
				supportMultipleWindows = true,

#if UNITY_IOS
contentMode = GpmWebViewContentMode.MOBILE,
isMaskViewVisible = true,
#endif
}, null, null);
}

private void OnCallback (
		GpmWebViewCallback.CallbackType callbackType,
		string data,
		GpmWebViewError error)
{
	Debug.Log ("OnCallback: " + callbackType);
	switch (callbackType)
	{
		case GpmWebViewCallback.CallbackType.Open:
			if (error != null)
			{
				Debug.LogFormat ("Fail to open WebView. Error:{0}", error);
			}
			break;
		case GpmWebViewCallback.CallbackType.Close:
			if (error != null)
			{
				Debug.LogFormat ("Fail to close WebView. Error:{0}", error);
			}
			break;
		case GpmWebViewCallback.CallbackType.PageLoad:
			if (string.IsNullOrEmpty (data) == false)
			{
				Debug.LogFormat ("Loaded Page:{0}", data);
			}
			break;
		case GpmWebViewCallback.CallbackType.MultiWindowOpen:
			Debug.Log ("MultiWindowOpen");
			break;
		case GpmWebViewCallback.CallbackType.MultiWindowClose:
			Debug.Log ("MultiWindowClose");
			break;
		case GpmWebViewCallback.CallbackType.Scheme:
			if (error == null)
			{
				if (data.Equals ("USER_ CUSTOM_SCHEME") == true || data.Contains ("CUSTOM_SCHEME") == true)
				{
					Debug.Log (string.Format ("scheme:{0}", data));
				}
			}
			else
			{
				Debug.Log (string.Format ("Fail to custom scheme. Error:{0}", error));
			}
			break;
			break;
		case GpmWebViewCallback.CallbackType.GoBack:
			Debug.Log ("GoBack");
			break;
		case GpmWebViewCallback.CallbackType.GoForward:
			Debug.Log ("GoForward");
			break;
		case GpmWebViewCallback.CallbackType.ExecuteJavascript:
			Debug.LogFormat ("ExecuteJavascript data : {0}, error : {1}", data, error);
			break;
	}
}

}`

Hello. @aliagha-huseynli.

We will let you know through a comment after checking the contents.

Thank you.

Hello. @aliagha-huseynli.

Locate the gradle.properties file in the Project\Library folder, add android.useAndroidX=true, and rebuild.
e.g. Project\Library\Bee\Android\Prj\Mono2x\Gradle\gradle.properties

org.gradle.jvmargs=-Xmx4096M
org.gradle.parallel=true
android.enableR8=false
unityStreamingAssets=
unityTemplateVersion=3
android.useAndroidX=true

We will update the guide document by organizing the contents from the other versions.

If you have any questions, please feel free to contact us.
Thank you.

Hello. @aliagha-huseynli.

We are sending this again after finding a better method than previously mentioned.
Select the Custom Gradle Properties Template in Unity Editor > Project Settings > Player > Publishing Settings,
add android.useAndroidX=true, and rebuild.

Thank you.

Hello. @aliagha-huseynli.

Has the issue been resolved with the provided information?
If there are no further issues, we will proceed to close it.
If you have any additional questions, please feel free to comment here.

Thank you.

thank you