当前位置: 首页 > news >正文

网站建设 管理规范php网站开发实例教程传智

网站建设 管理规范,php网站开发实例教程传智,做电力 公司网站,学做淘宝网站是骗子吗#xff11;#xff12;年的时候写过#xff2a;#xff2e;#xff29;但是又忘记得差不多了#xff0c;现在重新写了一次#xff0c;发现碰到了几个问题#xff0c;写下来记录一下 第一步 应用程序java代码 package com.example.helloworld;import java.util.Calend…年的时候写过但是又忘记得差不多了现在重新写了一次发现碰到了几个问题写下来记录一下 第一步 应用程序java代码 package com.example.helloworld;import java.util.Calendar;import android.os.Bundle; import android.app.Activity; import android.app.AlarmManager; import android.util.Log;public class AlarmTest extends Activity {AlarmManager aManager;Calendar currentTime Calendar.getInstance();public static final int POWER_OFF_WAKE_UP 8;//用来设置关机启动的参数 平台这边已经设置好了Overridepublic void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);Log.e(weiqifa, test());}public native String test();static {try{Log.i(JNI, Trying to load libhelloworld.so);System.loadLibrary(helloWorld);}catch(UnsatisfiedLinkError ule){Log.e(JNI, Warning : could not load the libhelloworld.so);}} }编译一下可以是eclipse编译也可以是java命令编译 编译后有下面的代码结构和目录 weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/bin$ ls AndroidManifest.xml  classes  classes.dex  dexedLibs  helloWorld.apk  res  resources.ap_ weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/bin$ 第二步 生成共享头文件 这一步是最关键的关系到成功和失败 weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/bin$ javah -d header -classpath classes -jni com.example.helloworld.AlarmTest weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/bin$ 这个命令比较关键 javah -d header 指的是在当前目录下面生成这个头文件-classpath是指定classes的目录就是第一步里面生成的 -jni指的是生成jni头文件 com.example.helloworld这个是包名 AlarmTest是类名 这些都不能有错 生成后如下 weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/bin$ ls AndroidManifest.xml  classes  classes.dex  dexedLibs  header  helloWorld.apk  res  resources.ap_ weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/bin$ ls header/ com_example_helloworld_AlarmTest.h weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/bin$ weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/bin$ cat header/com_example_helloworld_AlarmTest.h /* DO NOT EDIT THIS FILE - it is machine generated */ #include jni.h /* Header for class com_example_helloworld_AlarmTest */#ifndef _Included_com_example_helloworld_AlarmTest #define _Included_com_example_helloworld_AlarmTest #ifdef __cplusplus extern C { #endif #undef com_example_helloworld_AlarmTest_POWER_OFF_WAKE_UP #define com_example_helloworld_AlarmTest_POWER_OFF_WAKE_UP 8L /** Class: com_example_helloworld_AlarmTest* Method: test* Signature: ()Ljava/lang/String;*/ JNIEXPORT jstring JNICALL Java_com_example_helloworld_AlarmTest_test(JNIEnv *, jobject);#ifdef __cplusplus } #endif #endif刚开始不知道运行经常出错如下weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/bin$ javah -jni com.example.helloworld error: cannot access com.example.helloworld class file for com.example.helloworld not found javadoc: error - Class com.example.helloworld not found. Error: No classes were specified on the command line.  Try -help. weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/bin$ 可以看到自动生成对应的函数Java_com_example_helloworld_AlarmTest_test Java_ 包名com_example_helloworld 类名(AlarmTest) 接口名(test)必须要按此JNI规范来操作 第三步 通过.h来制作.c 看看我们的.c 我们只是需要.h里面那个函数名字.h没有被引用也没有参与编译和预编译 helloworld.c如下 #include string.h #include jni.hJNIEXPORT jstring JNICALL Java_com_example_helloworld_AlarmTest_test(JNIEnv *env, jobject thiz) {return (*env)-NewStringUTF(env,weiqifa hello for JNI); }第四步 生成so文件 看一下我们的mk文件 LOCAL_PATH : $(call my-dir) include $(CLEAR_VARS)LOCAL_MODULE : helloWorld LOCAL_SRC_FILES : helloWorld.cinclude $(BUILD_SHARED_LIBRARY)会生成如下的so文件 weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/libs/armeabi$ ls libhelloWorld.so weiqifaweiqifa-Inspiron-3847:~/workspace/helloWorld/libs/armeabi$ 第五步 执行验证 直接用eclipse安装 或者用 adb push 进去 用adb的话要手动安装so 文件并且改一下权限 10-20 03:06:45.241: E/weiqifa(12194): weiqifa hello for JNI 10-20 03:06:45.241: V/ActivityThread(12194): activityCreated rActivityRecord{41e7a890 tokenandroid.os.BinderProxy41e7a060 {com.example.helloworld/com.example.helloworld.AlarmTest}} 问题 刚开始的时候我在Android.mk里面写的LOCAL_MODULE生成的模块名称是大写WhelloWorld LOCAL_MODULE : helloWorld但是在android源码里面我写的 System.loadLibrary(helloWorld);里面的helloworld是小写w然后运行一直加载不成功后面有个朋友帮我看了一下找到原因粗心大意啊。
http://www.zqtcl.cn/news/340488/

相关文章:

  • 服装店网站建设规划书山西网站的公司
  • 龙岩做网站改版一般多久wordpress后台登入
  • 网站建设税收编码怎么联系企业的网站建设
  • 色块布局网站首页模板各种网站解决方案
  • 电商建站工具手机编辑网页的软件有哪些
  • 网站腾讯备案吗wordpress英文主题怎么用
  • 网站内容建设的建议wordpress主题enfold
  • 哪里做网站优化石家庄学校网站建设
  • 诸暨北京有哪些网站制作公司wordpress菜单外链
  • 免费建网站的步骤wordpress分享可见内容
  • 成都网站建设公司服务商自己做网站还有出路吗
  • 汉南城乡建设局网站网站建设新手教程
  • 网站用途及栏目说明软件外包公司开发流程
  • 公司做网站做淘宝好还是自建网站好
  • 成功网站案例有哪些淮安市交通建设局网站
  • 购买虚拟机建网站网站开发合同变更
  • 备案的网站做跳转不影响备案把购彩网站建设
  • 2w网站建设模式百度应用市场
  • vps主机访问网站湖南建站网站
  • 滨州正规网站建设公司用r语言 做网站点击热力图
  • php网站模板wordpress自定义头像上传
  • 江油市规划和建设局网站一个app网站
  • 郑州网站建设up188WordPress响应式幻灯片
  • 幸运28网站代理怎么做网站后期维护工作包括哪些
  • 西安网站建设seo网络营销的职能
  • 大型网站建设哪家服务好dll网站服务
  • 怎样建设网赌网站江苏外贸网站建设
  • 做外贸有哪些网站怎么在360自己做网站
  • 企业网站建立费用 作什么科目深圳服装外贸公司
  • 淘宝网站建设代码视频开放api