Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
246 views
in Technique[技术] by (71.8m points)

android - Zxing 2.2 import as a library project(not .jar) in eclipse

I have downloaded the zxing 2.2 code from the below link

https://code.google.com/p/zxing/downloads/list

My requirement is to import the "core" project into eclipse and add few code into it. then mark it to be library project.

I want to include this library project into barcode scanner sample app and use the barcode scanner app as library from my project.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Solved

prerequisties download latest zxing package.

Process 1

  1. create a java project in eclipse.and name it to something like ZxingCore.
  2. copy and paste complete src folder inside core folder.
  3. In case you need to edit any code, you can do it. otherwise skip this step.
  4. Java library is ready to be used.

[Note: Compile Java project using Java 1.6 to get rid of run time exceptions]

Process 2

  1. In eclipse select Create a android project from existing source.
  2. browse your zip file for android folder[this is a sample project bundeled with the library] your project should be imported with few errors
  3. The actual core library is missing, We should add the ZxingCore library from process 1
  4. right click project -> properties -> JavaBuildPath(from left pane) -> project tab -> add -> check ZxingCore - Ok.
  5. All the errors should have gone now. it time to make the barcode scanner app to be a library project
  6. right click project -> properties -> android(from left pane) -> check isLibrary -> apply -> OK.
  7. Now you will get errors in some switch case statements. Convert the problematic switch case statements to it..elseif
  8. Your library project is ready
  9. for those who want to run the barcode scanner as a stand alone app skip the steps 5,6,7,8

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...