This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ndk-build | |
Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /home/cobalt/AndroidStudioProjects/HelloNDK/app/src/main/jniLibs/jni/Android.mk | |
/home/cobalt/Android/adt-bundle-linux-x86-20131030/android-ndk-r10b/build/core/add-application.mk:209: *** Android NDK: Aborting... . Stop. | |
/** | |
SOLUTION: | |
Modify NDK_PROJECT_PATH variable | |
export NDK_PROJECT_PATH=/home/cobalt/AndroidStudioProjects/HelloNDK/app/src/main/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* DO NOT EDIT THIS FILE - it is machine generated */ | |
#include <jni.h> | |
/* Header for class com_cabatuan_hellondk_Main */ | |
#ifndef _Included_com_cabatuan_hellondk_Main | |
#define _Included_com_cabatuan_hellondk_Main | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
#undef com_cabatuan_hellondk_Main_MODE_PRIVATE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/Android/adt-bundle-linux-x86-20131030/android-ndk-r10b/samples/hello-jni$ ndk-build | |
[armeabi-v7a] Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi-v7a/gdbserver | |
[armeabi-v7a] Gdbsetup : libs/armeabi-v7a/gdb.setup | |
[armeabi] Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver | |
[armeabi] Gdbsetup : libs/armeabi/gdb.setup | |
[x86] Gdbserver : [x86-4.6] libs/x86/gdbserver | |
[x86] Gdbsetup : libs/x86/gdb.setup | |
[mips] Gdbserver : [mipsel-linux-android-4.6] libs/mips/gdbserver | |
[mips] Gdbsetup : libs/mips/gdb.setup | |
[armeabi-v7a] Compile thumb : hello-jni <= hello-jni.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10-06 09:36:50.648 12476-12476/com.cabatuan.hellojni E/AndroidRuntime﹕ FATAL EXCEPTION: main | |
java.lang.UnsatisfiedLinkError: stringFromJNI | |
at com.cabatuan.hellojni.Main.stringFromJNI(Native Method) | |
at com.cabatuan.hellojni.Main.onCreate(Main.java:20) | |
at android.app.Activity.performCreate(Activity.java:4465) | |
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) | |
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931) | |
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992) | |
at android.app.ActivityThread.access$600(ActivityThread.java:127) | |
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10-06 11:47:16.659 14345-14345/com.cabatuan.hellojni D/dalvikvm﹕ Trying to load lib /data/data/com.cabatuan.hellojni/lib/libhello-jni.so 0x2bddfd40 | |
10-06 11:47:16.659 14345-14345/com.cabatuan.hellojni D/dalvikvm﹕ Added shared lib /data/data/com.cabatuan.hellojni/lib/libhello-jni.so 0x2bddfd40 | |
10-06 11:47:16.659 14345-14345/com.cabatuan.hellojni D/dalvikvm﹕ No JNI_OnLoad found in /data/data/com.cabatuan.hellojni/lib/libhello-jni.so 0x2bddfd40, skipping init | |
10-06 11:47:16.719 14345-14345/com.cabatuan.hellojni D/TextLayoutCache﹕ Using debug level: 0 - Debug Enabled: 0 | |
10-06 11:47:16.759 14345-14345/com.cabatuan.hellojni D/libEGL﹕ loaded /system/lib/egl/libGLES_android.so | |
10-06 11:47:16.769 14345-14345/com.cabatuan.hellojni D/libEGL﹕ loaded /system/lib/egl/libEGL_adreno200.so | |
10-06 11:47:16.769 14345-14345/com.cabatuan.hellojni D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_adreno200.so | |
10-06 11:47:16.769 14345-14345/com.cabatuan.hellojni D/libEGL﹕ loaded /system/lib/egl/libGLESv2_adreno200.so | |
10-06 11:47 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 20 | |
buildToolsVersion "19.1.0" | |
defaultConfig { | |
applicationId "com.cabatuan.hellojni" | |
minSdkVersion 14 | |
targetSdkVersion 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2009 The Android Open Source Project | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ndk-build | |
Android NDK: WARNING:jni/Android.mk:ImageProcessing: non-system libraries in linker flags: -lgnustl_static | |
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES | |
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the | |
Android NDK: current module | |
[armeabi-v7a] Compile++ thumb: ImageProcessing <= jni_part.cpp | |
[armeabi-v7a] SharedLibrary : libImageProcessing.so | |
/home/cobalt/Android/adt-bundle-linux-x86-20131030/android-ndk-r9b/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lgnustl_static | |
/home/cobalt/Android/adt-bundle-linux-x86-20131030/android-ndk-r9b/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/cobalt/Android/OpenCV-2.4.9-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(persistence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10-06 15:49:30.348 15675-15675/com.cabatuan.opencvnative W/dalvikvm﹕ Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/cabatuan/opencvnative/AsynCamPreview; | |
10-06 15:49:30.358 15675-15675/com.cabatuan.opencvnative D/AndroidRuntime﹕ Shutting down VM | |
10-06 15:49:30.358 15675-15675/com.cabatuan.opencvnative W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x2b542210) | |
10-06 15:49:30.358 15675-15675/com.cabatuan.opencvnative E/AndroidRuntime﹕ FATAL EXCEPTION: main | |
java.lang.ExceptionInInitializerError | |
at com.cabatuan.opencvnative.Main.onCreate(Main.java:36) | |
at android.app.Activity.performCreate(Activity.java:4465) | |
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) | |
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931) | |
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class DISMATHLinearSearch { | |
public int find(final int[] data, final int key) { | |
int location = -1; | |
for (int i = 0; i < data.length; ++i) { | |
if (data[i] == key){ | |
location = i; | |
} |