androidunity-game-engineandroid-gradle-pluginbuild.gradle

How to resolve "Could not find method bundle() for arguments [build_6plat21h.....] on object of type com.android.build.gradle.LibraryExtension"?


Alright I submit, I am trying to get a Unity 3D project working in a View on Android and it seems easy enough thanks to some tutorials online. However, I am stuck at the part where I need to convert the unity project to a module/AAR file. When following steps on these online tutorials, I get to the stage where I need to sync the gradle project and I receive:

ERROR: Could not find method bundle() for arguments [build_6plat2lh5rmq66u2k9bfvj0j1$_run_closure3$_closure12@655df9f] on object of type com.android.build.gradle.LibraryExtension.

The steps I used to produce the issue:

On Unity:

Android Studio

Where I found these steps:

Version Info

[EDIT] I forgot to mention that I removed [below] from the manifest

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>

Solution

  • I ran into the same problem trying all things, commenting the bundle block fixed the problem for me

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

    I am not sure if this is the right approach but after building the project and generating the apk I got my .aar file which I guess is what you are trying to get.