Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by $$anonymous$$ · Mar 29, 2017 at 09:00 PM · androidvrnative plugin

Include .so native file in an Android .aar file

I have a situation where I am building an android .aar file with android studio, and the java files reference some external native methods in the .so. However any effort I make to include the .so file in the aar file, whenever I do and try to use classes that reference the .so functions, my app crashes on load without error or any way for me to track what the issue is.

This is my gradle build file..

 apply plugin: 'com.android.library'

 def NATIVE_LIB_DIR = 'jniLibs/armeabi-v7a/'

 android {
 compileSdkVersion 25
 buildToolsVersion "25.0.2"

 sourceSets {
     main {
         jniLibs.srcDirs = ["jniLibs"]
     }
 }

 defaultConfig {
     minSdkVersion 23
     targetSdkVersion 25
     versionCode 1
     versionName "1.0"

     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

 }
 buildTypes {
     release {
         minifyEnabled false
         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
     }
 }
 productFlavors {
     arm {
         ndk {
             abiFilters "armeabi-v7a", "armeabi"
         }
     }
 }
 }

 dependencies {
 provided fileTree(include: ['*.jar'], dir: 'libs')
 compile 'com.android.support:appcompat-v7:25.3.0'
 }

 android.libraryVariants.all { variant ->

 // Task names.
 String variantName = "${variant.name.capitalize()}"; // Like 'Debug'
 String deployTaskGroup = "plugin";
 String deployTaskName = "deploy${variantName}PluginArchive"; // Like 'deployDebugPluginArchive'
 String dependencyTaskName = "assemble${variantName}"; // Like 'assembleDebug'

 // Source.
 String sourceAARFolder = "${buildDir.getPath()}/outputs/aar/";
 String sourceAARName = "${project.name}-${variant.name}.aar";

 // Target.
 String targetAssetFolder = "Assets/Plugins/Android";
 String targetAARFolder = "${rootDir.getPath()}/../${targetAssetFolder}"; // Navigate into 'Assets'
 String targetAARName = "SrvrRemote.aar"; // The form you ship your plugin

 // Create task.
 task(deployTaskName, dependsOn: dependencyTaskName, type: Copy) {
     logger.lifecycle("${variant.name.capitalize()} AAR Folder: ${sourceAARFolder}")
     logger.lifecycle("${variant.name.capitalize()} Target AAR Folder: ${targetAARFolder}")
     logger.lifecycle("${variant.name.capitalize()} Target AAR name: ${targetAARName}")

     from(sourceAARFolder)
     into(targetAARFolder)
     include(sourceAARName)
     rename(sourceAARName, targetAARName)
 }.group = deployTaskGroup;

}

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image liortal · Mar 31, 2017 at 10:06 PM 0
Share

you should include the runtime code (how you're attempting to load the native library and call it), as well as the actual crash message.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

138 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can handheld.PlayfullScreenMovie() work with Vr view to play 360 degree video using google vr sdk? 0 Answers

Sending information from android game to android app via Bluetooth/Wifi-Direct 0 Answers

How to suppress system bars on Android? 2 Answers

Many problems using the new Cardboard unity3D integration 0 Answers

[BUG] Can't use postprocessing with single-pass stereo rendering enabled (5.6, GearVR) 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges