2

I have a problem in my graduation project, I add Unity as a library to Android Studio it works fine with my mobile, but when I try on the other Android mobile I got some weird error (unable to load libmain.so), I search a lot but I didn't find the answer.

Note: there is no compile or build error, only when I click on the button(on android project) to go to Unity project.

3 Answers 3

2

I had the same problem, in my case I solved by editing the project's gradle file which should be located in your_project/Assets/Plugins/Android/mainTemplate.gradle

For an unknown reason my gradle file had this lines that prevented to pack libmain.so inside the apk therefore giving the unable to load libmain.so error

// Android Resolver Exclusions Start
android {
  packagingoptions {
      exclude ('/lib/arm64-v8a/*' + '*')
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }
}
// Android Resolver Exclusions End

If you find this in your gradle file, try to comment // or remove the block.

2
1

You can follow this link, I think it will help

dependencies {
    compile project(":your_aar_file_name")
    compile fileTree(dir: 'libs', include: ['*.jar'])
    ...
}
2
0

Please add following line into your string.xml

<string name="game_view_content_description">Game view</string>

After that add below snippet into your app level's gradle file

defaultConfig {
        ndk {
            abiFilters 'armeabi-v7a', 'x86'
        }
    }

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.