line/line-sdk-unity

Issues with unity 2018.2.0f2

LeeGeonho opened this issue · 3 comments

Is it a security issue?

If you believe you have discovered a vulnerability or have an issue related to security, please DO NOT open a public issue. Instead, send us a mail to dl_oss_dev@linecorp.com.

What did you do?

If you build from unity 2018.2.0f2 version, gradle version does not match and error occurs

* What went wrong:
A problem occurred evaluating root project 'gradleOut'.
> Failed to apply plugin [id 'com.android.application']
   > Minimum supported Gradle version is 4.6. Current version is 4.2.1. If using the gradle wrapper, try editing the distributionUrl in /Users/even/Desktop/Works/09.temp/Unity/LineSample/Temp/gradleOut/gradle/wrapper/gradle-wrapper.properties to gradle-4.6-all.zip

What did you expect?

build done.

What happened actually?

Because Unity has a low version of the built-in gradle, causing errors.

In the mainTemplate.gradle, the bottom part and the Gradle version are associated.

classpath 'com.android.tools.build:gradle:3.2.0'

Therefore, when I lowered the version to 3.0.1 and built it, the following error occurred.

* What went wrong:
A problem occurred evaluating root project 'gradleOut'.
> Could not find method bundle() for arguments [build_xk52861as5j4z8iqm3807vyd$_run_closure3$_closure12@6e2d1c43] on object of type com.android.build.gradle.AppExtension.

I removed the bottom part of mainTemplate.gradle and rebuilt it.

bundle {
    language {
        enableSplit = false
    }
    density {
        enableSplit = false
    }
    abi {
        enableSplit = true
    }
}

This time, the following error occurred.

stderr [
Exception in thread "main" java.lang.IllegalStateException: Expected a load for Landroid / view / View $ OnClickListener; to set up parameter 1 for com / linecorp / linesdk / widget / LoginButton $$ Lambda $ 3 but got -1
at com.google.common.base.Preconditions.checkState (Preconditions.java:756)
at com.google.devtools.build.android.desugar.LambdaDesugaring $ InvokedynamicRewriter.attemptAllocationBeforeArgumentLoads (LambdaDesugaring.java:535)
at com.google.devtools.build.android.desugar.LambdaDesugaring $ InvokedynamicRewriter.visitInvokeDynamicInsn (LambdaDesugaring.java:420)
at org.objectweb.asm.MethodVisitor.visitInvokeDynamicInsn (Unknown Source)
at org.objectweb.asm.MethodVisitor.visitInvokeDynamicInsn (Unknown Source)
at org.objectweb.asm.ClassReader.a (Unknown Source)
at org.objectweb.asm.ClassReader.b (Unknown Source)
at org.objectweb.asm.ClassReader.accept (Unknown Source)
at org.objectweb.asm.ClassReader.accept (Unknown Source)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput (Desugar.java:401)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput (Desugar.java:326)
at com.google.devtools.build.android.desugar.Desugar.desugar (Desugar.java:280)
at com.google.devtools.build.android.desugar.Desugar.main (Desugar.java:584)

The above error is found in the android repository(LINK), but I do not know how to fix it in Unity.

What exactly is the correct minimum version to support?
Is not Gradle version 4.6 or lower?
(I may be forced to update the version of Gradle built into Unity to 4.6, but I do not want to do that because it is not generally recommended.)

Your environment?

macOS(Mojave) 10.14.4
unity 2018.2.0f2

Sample project

It would be appreciated if you can provide a link to or update a sample project that we can download and reproduce the issue.

@plateaukao I am not familiar with Gradle, any idea? Is it a must to use a recent version of Gradle to build Android version?

Hi, @LeeGeonho The gradle version we used is not compatible with Unity 2018.1 and 2018.2, as you observed. For Unity developers with these two versions, suggest exporting the unity android project, and build it separately so that it won't be affected. by the gradle vesion provided by Unity itself

@LeeGeonho @plateaukao actually you can replace your gradle in /Applications/Unity/Hub/Editor/2019.1.8f1/PlaybackEngines/AndroidPlayer/Tools/gradle (on macOS) and replace lib in gradle folder to newer version. but it is just a workaround anyway.