简体   繁体   中英

Android creating library project without source code

我正在开发android库项目。我不想共享我的源代码。我想创建jar文件之类的东西。但是我无法创建jar文件,因为它包含xml布局。源代码?

I can give you an example of such library. Open Android SDK manager and download Google play services library.

This library contains 'libs' folder with google-play-services.jar which contains all the source code . Also there is 'res' folder and android manifest file to be able to add this library to every android project.

  1. First thing is to have the full library-project ( example : FullProject).
  2. Then I import the full library project (FullProject) in a new workspace and check “Copy Projects into workspace”. This new project must have the same name ( FullProject)
  3. in the copy, i removed the source code.
  4. in the app-project i added the source-less-library-project as android library
  5. in the app-project i added the .jar file with all the binary classes from the full library-project ( right clic on directory “source” of the full library-project, export as jar and check « Add directory entry » ).
  6. in the build path of the app project, in "order and export", check the .jar exported
  7. update the manifest file of the app project with all views of the library project .
  8. clean the app project
  9. It's all !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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