Creating a native activity in android:
- via
vim&Makefileonly - no use of
gradle, ant, maven, android.mkand all that other stuff
- I already created a (java-native) android apk via makefile that works well on my Samsung S7.
- When I try to run the app, it crashes.
- My gut feeling says I haven't compiled/linked the
android_native_app_glue.c --> libandroid_native_app_glue.awithmain.cpp --> libnative-activity.soproperly. - It works fine with Google's pre-compiled armeabi-v7a
libnative-activity.so
I create the static app-glue first as:
aarch64-linux-android-gcc -march=armv8-a -c android_native_app_glue.c -o native_app_glue.o
aarch64-linux-android-ar rcs libandroid_native_app_glue.a native_app_glue.o
Then I compile and link main.cpp with:
aarch64-linux-android-c++ -march=armv8-a -std=c++11 -fPIC -c main.cpp -o main.o
aarch64-linux-android-c++ -shared -llog -landroid -lEGL -lGLESv1_CM -lnative_app_glue main.o -o libnative-activity.a
08-28 14:41:19.019 30897 30897 E AndroidRuntime: Process: com.example.native_activity, PID: 30897
08-28 14:41:19.019 30897 30897 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.native_activity/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app/com.example.native_activity-1/lib/arm64/libnative-activity.so
