gree / unity-webview

zlib License
2.25k stars 687 forks source link

cannot find symbol unityplayeractivity while building WebViewPlugin-*.aar.tmpl #1080

Open b-phygtl opened 1 month ago

b-phygtl commented 1 month ago

Hi, I'm trying to build the WebViewPlugin-*.aar.tmpl. But I'm running into this build error. Would it be possible to help me fix this ?

Thank you in advance.

> Task :webview:compileReleaseJavaWithJavac FAILED
F:\unity-webview\plugins\Android\webview\src\main\java\net\gree\unitywebview\CUnityPlayerActivity.java:7: error: cannot find symbol
    extends UnityPlayerActivity
            ^
  symbol: class UnityPlayerActivity
F:\unity-webview\plugins\Android\webview\src\main\java\net\gree\unitywebview\CUnityPlayerActivity.java:9: error: method does not override or implement a method from a supertype
    @Override
    ^
F:\unity-webview\plugins\Android\webview\src\main\java\net\gree\unitywebview\CUnityPlayerActivity.java:11: error: cannot find symbol
        requestWindowFeature(1);
        ^
  symbol:   method requestWindowFeature(int)
  location: class CUnityPlayerActivity
F:\unity-webview\plugins\Android\webview\src\main\java\net\gree\unitywebview\CUnityPlayerActivity.java:12: error: cannot find symbol
        super.onCreate(bundle);
        ^
  symbol:   variable super
  location: class CUnityPlayerActivity
F:\unity-webview\plugins\Android\webview\src\main\java\net\gree\unitywebview\CUnityPlayerActivity.java:13: error: cannot find symbol
        getWindow().setFormat(2);
        ^
  symbol:   method getWindow()
  location: class CUnityPlayerActivity
F:\unity-webview\plugins\Android\webview\src\main\java\net\gree\unitywebview\CUnityPlayerActivity.java:14: error: cannot find symbol
        mUnityPlayer = new CUnityPlayer(this);
        ^
  symbol:   variable mUnityPlayer
  location: class CUnityPlayerActivity
F:\unity-webview\plugins\Android\webview\src\main\java\net\gree\unitywebview\CUnityPlayerActivity.java:14: error: incompatible types: CUnityPlayerActivity cannot be converted to ContextWrapper
        mUnityPlayer = new CUnityPlayer(this);
                                        ^
F:\unity-webview\plugins\Android\webview\src\main\java\net\gree\unitywebview\CUnityPlayerActivity.java:15: error: cannot find symbol
        setContentView(mUnityPlayer);
                       ^
  symbol:   variable mUnityPlayer
  location: class CUnityPlayerActivity
F:\unity-webview\plugins\Android\webview\src\main\java\net\gree\unitywebview\CUnityPlayerActivity.java:16: error: cannot find symbol
        mUnityPlayer.requestFocus();
        ^
  symbol:   variable mUnityPlayer
  location: class CUnityPlayerActivity
Note: F:\unity-webview\plugins\Android\webview\src\main\java\net\gree\unitywebview\CWebViewPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
9 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':webview:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
KojiNakamaru commented 1 month ago

You might not install required Unity versions. Could you please follow the following instruction.

https://github.com/gree/unity-webview/blob/323d5d3611c92632f259d2d2cdadc9bbbb0e9014/README.md#how-to-build-webviewplugin-aartmpl

b-phygtl commented 1 month ago

You might not install required Unity versions. Could you please follow the following instruction.

https://github.com/gree/unity-webview/blob/323d5d3611c92632f259d2d2cdadc9bbbb0e9014/README.md#how-to-build-webviewplugin-aartmpl

Thanks for your response.

I have followed the instructions provided there. I have installed unity version 2022.3.8f1 and this 2019.4.40f1. As per instructions, I didn't find the Unity 5.6.1f1 here - https://unity.com/releases/editor/archive . It looks like Unity deprecated it ?

But it is looking like a CLASSPATH issue or some sort. Not sure how to proceed from here

KojiNakamaru commented 1 month ago

I see. I'll later adjust install.sh to require only 2019.4.40f1. Meanwhile, could you please download the package from https://unity.com/ja/releases/editor/whats-new/5.6.1 .

KojiNakamaru commented 1 month ago

I've adjusted install.sh in #1082 and updated binaries only with 2019.4.40f1.