Math

Couldn't load c++_shared from loader

Hello,


When I add followings in build.gradle I get  errors as below.

I wonder how I can handle this problem.

Thanks!

 // in build.gradle

 splits{ 

        abi{

            enable true

            reset()

            include 'armeabi'

        }

    }


// error logs

java.lang.UnsatisfiedLinkError: Couldn't load c++_shared from loader dalvik.system.PathClassLoader[dexPath=/data/app/com......-57.apk,libraryPath=/data/app-lib/com.......-57]: findLibrary returned null

01-25 10:00:33.732 5786-5786/? W/System.err: at java.lang.Runtime.loadLibrary(Runtime.java:358)

01-25 10:00:33.732 5786-5786/? W/System.err: at java.lang.System.loadLibrary(System.java:526)

01-25 10:00:33.732 5786-5786/? W/System.err: at com.myscript.atk.core.ATKCoreJNI.clinit(ATKCoreJNI.java:24)

01-25 10:00:33.732 5786-5786/? W/System.err: at com.myscript.atk.core.ATKCoreJNI.<clinit>(ATKCoreJNI.java:44)


 Dear HK Kim,


thank you for your question.


In your build.gradle file, you should ensure to add the following dependencies:

dependencies {
  compile 'com.android.support:appcompat-v7:23.+'
  compile project(':myscript-certificate')

  compile(name: 'MyScript_ATK-Core-android-component', ext: 'aar')
  compile(name: 'MyScript_ATK-Math-android-component', ext: 'aar')
  compile(name: 'MyScript_ATK-MathWidget-android-widget', ext: 'aar')
}


Best regards,


Olivier

Dear Olivier,

Thank you for your advice.

I think I added the required dependencies in build.gradle as you recommended and it works without the conditions as below.

splits{ 

        abi{

            enable true

            reset()

            include 'armeabi'

        }

    }

But when I add them to use other API, it does not work.

Would you think about it once more ? 

Dear  HK Kim,


can you please try to replace "armeabi" with "armeabi-v7a"?


It indeed worked fine on my side with the below configuration.


Best regards,


Olivier



splits {
abi {
enable true
reset()
include 'armeabi-v7a'
universalApk false
}
}

Dear Olivier,

Thanks again for your advice.

When I try to replace it with your configuration, the other SDK crash with the log - java.lang.UnsatisfiedLinkError.

So I hope to run my application with the configuration as below.

splits{

 abi{

 enable true

 reset()

 include 'armeabi'

 }

 }

If you have any idea, please let me know.

Best regards,

Kim


Dear HK KIm,


did you add the "libs" in your build.gradle? Indeed, at the root of the ATK, the build.gradle refers to these:


allprojects {
  repositories {
  jcenter()
  flatDir {
  dirs '../../libs'
  }
  }


Can you give a try setting the directory properly?


Best regards,


Olivier

Dear Olivier,

Thanks again for your advice.

I tried to move the libraries to the libs folder, but the result is same.

I think it is still related with splits{}.

Thanks.

Best regards,

Kim


Dear HK Kim,


Can you please provide us with the exact log you have?


Indeed, it looks like the libs are not added to your project? Ideally, can you please provide us with your project, so that we can investigate further?


Best regards,


Olivier

Dear Olivier,

Would you send me a email for me to send you my sample project?


Best regards,

Kim


Dear HK KIm,


You just need to reply to the email you should have received (when I posted the update to this topic).


Link will not be posted in this forum.


Best regards,


Olivier

Dear Olivier,

As I have a little problem in sending project for now, would you check following logs first ?


01-27 11:05:46.187 794-794/? W/System.err: java.lang.UnsatisfiedLinkError: Couldn't load c++_shared from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.apk,libraryPath=/data/app-lib/com]: findLibrary returned null 

01-27 11:05:46.192 794-794/? W/System.err: at com.myscript.atk.core.ATKCoreJNI.clinit(ATKCoreJNI.java:24)

01-27 11:05:46.192 794-794/? W/System.err: at com.myscript.atk.core.ATKCoreJNI.<clinit>(ATKCoreJNI.java:44)

01-27 11:05:46.192 794-794/? W/System.err: at com.myscript.atk.core.Extent.<init>(Extent.java:39)

01-27 11:05:46.192 794-794/? W/System.err: at com.myscript.atk.math.widget.utils.RenderingRunnable.<init>(RenderingRunnable.java:62)

01-27 11:05:46.192 794-794/? W/System.err: at com.myscript.atk.math.widget.views.InkView.<init>(InkView.java:75)

01-27 11:05:46.192 794-794/? W/System.err: at com.myscript.atk.math.widget.views.InkView.<init>(InkView.java:57)

01-27 11:05:46.192 794-794/? W/System.err: at com.myscript.atk.math.widget.views.MathView.<init>(MathView.java:50)

01-27 11:05:46.192 794-794/? W/System.err: at com.myscript.atk.math.widget.views.MathView.<init>(MathView.java:38)

01-27 11:05:46.192 794-794/? W/System.err: at com.myscript.atk.math.widget.MathWidget.<init>(MathWidget.java:83)

01-27 11:05:46.192 794-794/? W/System.err: at com.myscript.atk.math.widget.MathWidget.<init>(MathWidget.java:75)

01-27 11:05:46.192 794-794/? W/System.err: at java.lang.reflect.Constructor.constructNative(Native Method)

01-27 11:05:46.192 794-794/? W/System.err: at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

01-27 11:05:46.192 794-794/? W/System.err: at android.view.LayoutInflater.createView(LayoutInflater.java:600)

01-27 11:05:46.192 794-794/? W/System.err: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)

01-27 11:05:46.192 794-794/? W/System.err: at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:366)

01-27 11:05:46.192 794-794/? W/System.err: at android.app.Activity.setContentView(Activity.java:2031)


Thanks.

Best regards,

Kim


Dear HK Kim,


libc++_shared.so is normally located into the MyScript_ATK-Core-android-component.aar file. Did you add it into your project?


Best regards,


Olivier

Dear Olivier,

Yes, I added MyScript_ATK-Core-android-component.aar in libs folder.

It works well if I remove the configuration mentioned before.

splits{

 abi{

 enable true

 reset()

 include 'armeabi'

 }

 }


Thanks.

Best regards,

Kim


Dear HK Kim,

If setting armeabi-v7a instead of armeabi, is it working fine?

Best regards,

Olivier

Dear Olivier,

When I use include 'armeabi-v7a' in splits {}, my app also crashes as the case without splits {}.

Such settings seem to cause problem in other SDK.

For your reference, my device is Samsung SM-P600 (10.1" tablet).

Best regards,

Kim


Login or Signup to post a comment