VMAX
 
 
 
 
Show Sidebar

Multidex issue

Maaf, entri ini hanya tersedia dalam bahasa English. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

When your application and the libraries it references reach a certain size (65k or more), you encounter build errors that indicate your app has reached a limit of the Android app build architecture. Find more information on this error here. Here are some steps that you can follow to overcome this:

  1. Check for unwanted jars in your project and remove that to reduce method count. (Strongly recommended)
  2. Export your unity project to google android project. (If step 1 does not work)

Steps to export a project to Android Studio

  1. Open Build Settings.
    image17
  2. Select the Google Android Project checkbox.
  3. Click Export to export the unity project into Android.
  4. Unity will build the project, export it to android, and store the android project on your specified path.
    image11Here, VMAX_Unty_Ad_Sample is unity project name, other folders are library projects folders used on unity side.
  5. Open Android Studio and select New >> Import Project.
    image16
  6. Set the file path to exported android project.
    image03
  7. Once it’s imported, you will see that all the library projects will also get imported to Android Studio and the final studio project structure will look like this.
    image10
  8. Open the file build.gradle in your project.
    image09
  9. Add this part to the android section:
  10. Also add this line to the defaultConfig section:
  11. Add this line under the dependencies section:
  12. Finally, clean the project. The final build.gradle file will look similar to this:
    image15
  13. Open AndroidManifest.xml file and in <application> tag write this line.
  14. Copy the library (.jar) files to your application’s libs folder and add this line in the dependencies tag of build.gradle:
  15. If the library folder has assets (like resource/drawable/asset), then you have to add that library as module in Android Studio.
    image07Select the module you want to add to project.
  16. You also need to add the module to your project dependency.
    1. Right click on your app and select Open Module Setting option.
      image14
    2. Select your app and add the module as shown below:
      image04
    3. Select the module name from the Choose Modules dialog box that you wish to add:
      image18