안드로이드 개발 질문/답변
(글 수 45,052)
지금 저는 ndk-r6b로 해서 Android와 cpp를 연동중에 있습니다.
그 동안은
TempActivity.java와 nativeJava.java 파일을 따로 두어서 Cygwin에서 javah com.jbink.Temp.nativeJava 이런식으로 하니 .h (헤더파일) 이 bin 폴더내에 잘 생성 되었습니다.
그러다 다음과 같이 onCreate 파일내에서 loadLibrary 파일을 불렀습니다.
- public class NDKExam extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
int x = 10;
int y = 11;
System.loadLibrary("ndk-exam");
int z = add(x, y);
tv.setText("The sum of " + x + "and " + y + "is " + z);
setContentView(tv);
}
public native int add(int x, int y);
}
\그리고 Cygwin에서 실행하자
cannot access android.app.Activity
class file for android.app.Activity not found
라는 메세지가 출력되었습니다.
이런식의 호출은 r6b 버젼에서는 불가능 한건지 알고 싶어서요ㅠ
그리고 ndk-r7과 ndk-r6b 의 cygwin에서 헤더파일 만드는 방법도 차이가 있는지 아시는분 계신가요
r6b의 경우는 bin 폴더밑에서 javah 패키지명.클래스명 으로 해주면 헤더파일이 잘 만들어지는데
r7에서 같은 방법으로 했을 경우에는 class not found 라는 문구가 출력되네요ㅠㅠ
도와주실분 계신가요??




해결은 아니지만 돌아가는 방법을 찾았습니다. 블로그에 정리해 두었습니다..
http://blog.naver.com/jbin_k/130127014438 참고하세요