• 06_锅炉压力案例_progressbar实现


    相关的native方法可以用javah来生成一个头文件。拿着这个的MainActivity,用它来生成一个头文件。

    Signature是当前这个方法的方法签名。() V全空参数返回的是void.

    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class com_itheima_pressurediagram_MainActivity */
    
    #ifndef _Included_com_itheima_pressurediagram_MainActivity
    #define _Included_com_itheima_pressurediagram_MainActivity
    #ifdef __cplusplus
    extern "C" {
    #endif
    /*
     * Class:     com_itheima_pressurediagram_MainActivity
     * Method:    startMonitor
     * Signature: ()V
     */
    JNIEXPORT void JNICALL Java_com_itheima_pressurediagram_MainActivity_startMonitor
      (JNIEnv *, jobject);
    
    /*
     * Class:     com_itheima_pressurediagram_MainActivity
     * Method:    stopMonitor
     * Signature: ()V
     */
    JNIEXPORT void JNICALL Java_com_itheima_pressurediagram_MainActivity_stopMonitor
      (JNIEnv *, jobject);
    
    #ifdef __cplusplus
    }
    #endif
    #endif

    用插件指定一下我的include目录在什么位置上。

     

     

    [2017-07-16 14:31:20 - Unable to launch cygpath. Is Cygwin on the path?] java.io.IOException: Cannot run program "cygpath": CreateProcess error=2, ϵͳÕҲ»µ½ָ¶

    接下来clean一下就好了

    **** Clean-only build of configuration Default for project JNIDay03_02_锅炉压力 ****
    
    H:NDKandroid-ndk-r9d-windows-x86_64android-ndk-r9d
    dk-build.cmd clean 
    Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml    
    [armeabi] Clean          : pressure [armeabi]
    [armeabi] Clean          : stdc++ [armeabi]
    
    **** Build Finished **** 

    一些问题与解决方法:

    问题一:Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml    (这个是NDK工具的一个BUG,若build Target大于minSdkVersion,则会报这个错误,导致无法运行)
    解决方法:
    android-ndk-r8e/build/core/add-application.mk第128行把__ndk_warning改为__ndk_info;然后重新build一次项目即可消除错误。
    原文:
    this problem may be safely fixed by changing this line in add-application.mk from __ndk_warning to __ndk_info
    链接:

    https://code.google.com/p/android/issues/detail?id=39752

    APP_PLATFORM := android-8
    **** Build of configuration Default for project JNIDay03_02_锅炉压力 ****
    
    H:NDKandroid-ndk-r9d-windows-x86_64android-ndk-r9d
    dk-build.cmd all 
    [armeabi] Install        : libpressure.so => libs/armeabi/libpressure.so
    
    **** Build Finished ****

    **** Clean-only build of configuration Default for project JNIDay03_02_锅炉压力 ****
    
    H:NDKandroid-ndk-r9d-windows-x86_64android-ndk-r9d
    dk-build.cmd clean 
    [armeabi] Clean          : pressure [armeabi]
    [armeabi] Clean          : stdc++ [armeabi]
    
    **** Build Finished ****
  • 相关阅读:
    45
    布里斯班初体验
    走出你的舒适区
    Homebrew- MAC上的包管理利器
    Java经典类库-Guava中的函数式编程讲解
    使用WebDriver遇到的那些坑
    CheckStyle, 强制你遵循编码规范
    利用php的register_shutdown_function来记录php的输出日志
    PHP-redis中文文档
    php中set_time_limit()函数运用
  • 原文地址:https://www.cnblogs.com/ZHONGZHENHUA/p/7171549.html
Copyright © 2020-2023  润新知