http://blog.csdn.net/qq_30379689/article/details/52411489------源地址android
第一步 導入jar文件this
修改報錯.net
複製咱們libs中的zxing.jar包到項目中,記得右鍵AddAsLibraryblog
複製下載的it
res的layout文件、io
res的values的ids文件、class
raw文件、二維碼
res的drawable-xhdpi文件到咱們項目的對應位置權限
接着就進入紅線文件一個個導入,刪除原先的R包,換成本身項目的R包下載
第二步
1在manifests中聲明權限和Activity
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.FLASHLIGHT" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
<activity android:name=".zxing.activity.CaptureActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" /> <activity android:name=".zxing.activity.ResultActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" />
2在代碼中啓動咱們的二維碼掃描頁面
startActivity(new Intent(MainActivity.this, CaptureActivity.class));