[cyan@localhost jni]$ gcc -fPIC -shared -o libjni.so com_cyan_jni_JniTest.c
In file included from com_cyan_jni_JniTest.c:4:
com_cyan_jni_JniTest.h:2:17: error: jni.h: No such file or directory
In file included from com_cyan_jni_JniTest.c:4:
com_cyan_jni_JniTest.h:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jstring’
com_cyan_jni_JniTest.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jstring’
[cyan@localhost jni]$
求高手指点下

解决方案 »

  1.   

    com_cyan_jni_JniTest.h:2:17: error: jni.h: No such file or directory 不存在文件
    com_cyan_jni_JniTest.h:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jstring’
    com_cyan_jni_JniTest.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jstring’
    看是否应用string类型参数了
      

  2.   

    楼主用的是那个NDK的版本了,可能是解压没有成功,所以才会出现这样的错误。
      

  3.   

    .h文件
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class com_cyan_jni_JniTest */#ifndef _Included_com_cyan_jni_JniTest
    #define _Included_com_cyan_jni_JniTest
    #ifdef __cplusplus
    extern "C" {
    #endif
    /*
     * Class:     com_cyan_jni_JniTest
     * Method:    getString
     * Signature: ()Ljava/lang/String;
     */
    JNIEXPORT jstring JNICALL Java_com_cyan_jni_JniTest_getString
      (JNIEnv *, jobject);#ifdef __cplusplus
    }
    #endif
    #endif.c文件
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include "com_cyan_jni_JniTest.h"
    JNIEXPORT jstring JNICALL Java_com_cyan_jni_JniTest_getString
    (JNIEnv * env, jobject thiz)
    {
    return (*env)->NewStringUTF(env,"JniTest C");
    }Android.mk文件
    LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE    := jni
    LOCAL_SRC_FILES := com_cyan_jni_JniTest.cinclude $(BUILD_SHARED_LIBRARY)

    就是生成不了.so文件呀?????求助。