2012-08-08 93 views
0

我正在尝试写第一款原生Android应用程序,并得到遵循错误 enter image description here 有配套解决方案资源管理器中的照片和源代码的每个改变的文件的: enter image description here enter image description here 包ua.org。 groupab;世界,你好采用了android NDK

import android.app.Activity;

import android.app.AlertDialog;

import android.os.Bundle;

公共类ProjActivity延伸活动{

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(); 
} 

}

有什么错我的代码? 请帮忙!

回答

1

在函数声明ndkfoo.c,这将是有效的,如果在功能包的名称必须与你的包名

变化ndkfoo.c声明匹配到

jstring Java_ua_org_groupab_ProjActivity_invokeNativeFunction() 
{ 
} 
+0

我改变它,但它仍然不起作用。我犯了同样的错误?你能把这个更详细的描述出来吗?我应该在ndkfoo.c文件中更改后使用cygwin吗? – abilash 2012-08-08 07:03:46