abilash
abilash

Reputation: 897

Hello world using android ndk

i'm try to write first native android application and get follow Error enter image description here There are solution package explorer photo and source code for each of changed file: enter image description here enter image description here package ua.org.groupab;

import android.app.Activity;

import android.app.AlertDialog;

import android.os.Bundle;

public class ProjActivity extends Activity {

static {

    System.loadLibrary("ndkfoo");

  }
private native String invokeNativeFunction();
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    String hello = invokeNativeFunction();
    new AlertDialog.Builder(this).setMessage(hello).show();
}

}

What's wrong in me code? Help please!

Upvotes: 0

Views: 411

Answers (1)

Jackson Chengalai
Jackson Chengalai

Reputation: 3937

in ndkfoo.c in the function declaration, it will be valid if the package name in the function must match with your package name

change the declaration in ndkfoo.c into

jstring Java_ua_org_groupab_ProjActivity_invokeNativeFunction()
 {
 }

Upvotes: 1

Related Questions