android中生成和使用jar
2012-05-08 16:45
471 查看
参考资料1: http://blogold.chinaunix.net/u/9577/showart_1826330.html
Export Library
Prepare source code
Create an Android project
Create source code, and fix all bug
Remove res/*
Remove unused source files
Edit AndroidManifest.xml to remove the statements that referes to resource, such as android:icon="@drwable/icon", android:label="@string/app_name"
Export library
On Package Explorer Panel of Eclipse, right-click the project, and select Export
Select Jave -> JAR file, then press "Next". At this time a dialog pops up.
On the right panel of "Select the resources to export:" group, unselect all items (such as .classpath, .project, AndroidManifest.xlm, default.properties), then press "Next"
Press "Next"
Press "Finish"
Then the library is created.
(Reference: Eclipse export jar files http://hi.baidu.com/etrigger/blog/item/e1fed134468b2fb2d0a2d3ad.html)
xxx
Import Library
You can use a third party JAR in your application by adding it to your Eclipse project as follows:
In the Package Explorer panel, right-click on your project and select Properties.
Select Java Build Path, then the tab Libraries.
Press the Add External JARs... button and select the JAR file
Alternatively, if you want to include third party JARs with your package, create a new directory for them within your project and select Add Library... instead.
It is not necessary to put external JARs in the assets folder.
(Reference: http://code.google.com/intl/zh-CN/android/kb/commontasks.html) xxx
通过上面的方法能够生成jar,使用的时候compile也能成功,但是运行的时候会出错,原因是需要用到的jar没有打包到apk里面。要把jar打包到apk里面还需要下面的步骤。
参考资料2:http://topic.csdn.net/u/20091118/16/5a27d8e7-d8a2-43b3-92db-9d88ff8f7bec.html
1、在Android项目根目录下新建一个libs文件夹;
2、把你需要的导入的第三方Jar包复制进这个目录;
3、在libs目录上点右键,选Bulid path –> Use as source folder。
Export Library
Prepare source code
Create an Android project
Create source code, and fix all bug
Remove res/*
Remove unused source files
Edit AndroidManifest.xml to remove the statements that referes to resource, such as android:icon="@drwable/icon", android:label="@string/app_name"
Export library
On Package Explorer Panel of Eclipse, right-click the project, and select Export
Select Jave -> JAR file, then press "Next". At this time a dialog pops up.
On the right panel of "Select the resources to export:" group, unselect all items (such as .classpath, .project, AndroidManifest.xlm, default.properties), then press "Next"
Press "Next"
Press "Finish"
Then the library is created.
(Reference: Eclipse export jar files http://hi.baidu.com/etrigger/blog/item/e1fed134468b2fb2d0a2d3ad.html)
xxx
Import Library
You can use a third party JAR in your application by adding it to your Eclipse project as follows:
In the Package Explorer panel, right-click on your project and select Properties.
Select Java Build Path, then the tab Libraries.
Press the Add External JARs... button and select the JAR file
Alternatively, if you want to include third party JARs with your package, create a new directory for them within your project and select Add Library... instead.
It is not necessary to put external JARs in the assets folder.
(Reference: http://code.google.com/intl/zh-CN/android/kb/commontasks.html) xxx
通过上面的方法能够生成jar,使用的时候compile也能成功,但是运行的时候会出错,原因是需要用到的jar没有打包到apk里面。要把jar打包到apk里面还需要下面的步骤。
参考资料2:http://topic.csdn.net/u/20091118/16/5a27d8e7-d8a2-43b3-92db-9d88ff8f7bec.html
1、在Android项目根目录下新建一个libs文件夹;
2、把你需要的导入的第三方Jar包复制进这个目录;
3、在libs目录上点右键,选Bulid path –> Use as source folder。
相关文章推荐
- android中生成和使用jar
- Android Studio生成aar、jar包及其使用
- android的jar包生成及使用
- [转]android中生成和使用jar 分享
- android使用proguard混淆生成jar包
- android中生成和使用jar 分享
- android 使用ant打包或者生成jar
- Android - Gradle 使用干货 之 生成 jar 包 和 生成混淆的 jar 包 和 上传
- Android - Gradle 使用干货 之 生成 jar 包 和 生成混淆的 jar 包 和 上传 artifactory
- android学习——使用TableLayout动态生成表格,并为tablerow中的列添加点击监听
- 【Android】【小工具】使用Random生成一个指定长度的随机整数列
- Android增量更新(三)-差分文件(Linux)-生成jar和.so库
- android:shape的使用 (android用xml文件生成图像控件)
- Android 使用Zxing实现二维码的生成,扫描
- 03_Android NDK中C语言调用Java代码,javah的使用,javap的使用以及生成签名,Android.mk的编写,C代码的编写
- Android 使用zxing生成二维码的方法
- 如何把rtl8188EUS驱动编译生成ko模块并且下载到rk平台Android4.2.2上使用
- Android Jar包中使用图片资源
- 在脚本中, 使用sqlite3检查android程序生成的数据库是否OK