Ethan
Ethan

Reputation: 1472

Android NDK app Library not found error

I tried to compile and run the app hello-jni from NDK examples in Motodev Studio, and when I run on the phone, it crashs and LogCat says "Library not found". Can anyone suggest how to correctly setup the project? BTW, is is possible to write an entire Android app using only C/C++ code?

Upvotes: 3

Views: 2950

Answers (2)

piyush Giradkar
piyush Giradkar

Reputation: 1

Library was not found if you not attach a library in your project special. In the android studio first attach a jni library from the project structure, then remove the "disable automatic ndk-build call" line from the build.gradle

Upvotes: 0

Labeeb Panampullan
Labeeb Panampullan

Reputation: 34823

Library not found :- Did you compiled the jni part successfully. If you jni module is made then there will be .so file in you libs folder.
Using NDK to Call C code from Android Apps

Refer this When to Develop in Native Code, there it given

Write a native activity, which allows you to implement the lifecycle callbacks in native code. The Android SDK provides the NativeActivity class, which is a convenience class that notifies your native code of any activity lifecycle callbacks (onCreate(), onPause(), onResume(), etc). You can implement the callbacks in your native code to handle these events when they occur. Applications that use native activities must be run on Android 2.3 (API Level 9) or later.
You cannot access features such as Services and Content Providers natively, so if you want to use them or any other framework API, you can still write JNI code to do so.

Upvotes: 4

Related Questions