简体   繁体   English

将android库项目转换为带有资源的jar文件(libs和build文件夹)

[英]Convert android library project to jar file with resources (libs and build folder)

I make an android library project. 我做了一个android库项目。 It has some jar files and .so files. 它具有一些jar文件和.so文件。

  1. I export this project as jar file 我将此项目导出为jar文件
    • File->export->jar file->check my project with all folders and files, 文件->导出-> jar文件->检查所有文件夹和文件的项目,
    • uncheck AndroidManifest.xml, 取消选中AndroidManifest.xml,
    • check Export all output folders for check project 检查导出所有输出文件夹以检查项目
    • check Export java source files and resources 检查导出Java源文件和资源
    • -> finish. ->完成。

But when I add to my another project(libs folder) and add this on javaBuildPath, after run in the log cat show "NoClassDefFound Error (one of the jar file)". 但是,当我添加到另一个项目(libs文件夹)并将其添加到javaBuildPath上时,在日志猫中运行后,显示“ NoClassDefFound错误(jar文件之一)”。 How can I fix this problem? 我该如何解决这个问题?

Edit: I'm using Eclipse IDE 编辑:我正在使用Eclipse IDE

Please follow the steps: 请按照以下步骤操作:

1- Right Click on Project –> Export —> Java –> JarFile 1-右键单击项目–>导出–> Java –> JarFile

2-Select only the src checkbox ie the (pacakages) in Top-Left Window. 2-仅选中src复选框,即“左上窗口”中的(功能)。 Don't Select anything in Top-Right Window if some thing is selected remove marks . 如果选择了某些内容,则不要在“右上窗口”中选择任何内容。

3-Select Only Export generates Class Files and Resources 3-仅选择导出生成类文件和资源

4-In Options Select only Compress the contents of the jar file (it's not important) 4-In选项仅选择压缩jar文件的内容(不重要)

To add your External Jar to Your File 将外部Jar添加到文件中

1-Right click on project –> Select Properties –> Java Build Path —> libraries –> Add External Jar Files –> Click OK 1-右键单击项目–>选择属性–> Java构建路径–>库–>添加外部Jar文件–>单击确定

2-CLEAN your Project 2-清理您的项目

Must clean and build. 必须清洁和建造。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM