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:
- I have set up a basic 3D animation
Go to build settings
- set texture compression: ETC2 > build system: Gradle > check: Export project
- Set package name
Click Export
- Select a folder for the library
Android Studio
- File -> New -> Import Module -> Select project that was exported from Unity
- Project opens -> "Gradle settings are not configured for this project yet, would you like to use the Gradle Wrapper" -> Select "Ok"
- In
build.gradle
- Remove
applicationID
(as instructed by android docs) - Change
apply plugin: 'com.android.application'
toapply plugin: 'com.android.library'
- Remove
- Sync gradle project
Where I found these steps:
- https://medium.com/@davidbeloosesky/embedded-unity-within-android-app-7061f4f473a and a couple of similar medium tutorials
- https://developer.android.com/studio/projects/android-library
Version Info
- Gradle version: 4.10.1
- Android plugin version: 3.3.0
- Gradle wrapper properties distributionURL:
https://services.gradle.org/distributions/gradle-4.10.1-all.zip
[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>
I ran into the same problem trying all things, commenting the bundle block fixed the problem for me
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.