我已經完成了Android應用程序中的QR掃描器的實施。它可以在6.0和其他os版本中工作,但是當我單擊QR掃描儀沒有獲得處理意圖時,它不起作用於棒棒糖5.1版本。zxing QR掃描器不工作只有棒棒糖5.1版本
代碼:
public void aadahrScan() {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
startActivityForResult(intent, 0);
}
@Override
public void onActivityResult(int requestCodeTools, int resultCodeTools, Intent intentTools) {
if (requestCodeTools == 0 && intentTools != null) {
requestCodeTools(resultCodeTools, intentTools);
}
}
Error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.boon.inthree, PID: 6034
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1799)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1508)
at android.app.Activity.startActivityForResult(Activity.java:3829)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
at android.support.v4.app.ActivityCompatJB.startActivityForResult(ActivityCompatJB.java:30)
at android.support.v4.app.ActivityCompat.startActivityForResult(ActivityCompat.java:146)
at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:937)
at android.support.v4.app.FragmentActivity$HostCallbacks.onStartActivityFromFragment(FragmentActivity.java:1047)
at android.support.v4.app.Fragment.startActivityForResult(Fragment.java:959)
at android.support.v4.app.Fragment.startActivityForResult(Fragment.java:948)
at com.boon.inthree.PersonalInformation.aadahrScan(PersonalInformation.java:263)
at com.boon.inthree.PersonalInformation$4.onClick(PersonalInformation.java:251)
at android.view.View.performClick(View.java:4788)
at android.view.View$PerformClick.run(View.java:19923)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5401)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:919)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:71
清單:
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".SplashClass"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Login"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ProductActivity"
android:icon="@drawable/icon"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:theme="@style/AppTheme" />
<activity
android:name=".ProductDeteils"
android:screenOrientation="portrait"
android:label="@string/app_name" />
<activity
android:name=".Checkout"
android:screenOrientation="portrait"
android:label="@string/app_name" />
<activity
android:name=".ProCheckout"
android:screenOrientation="portrait"
android:label="@string/app_name" />
<activity
android:name=".QuickActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".FilterActivity"
android:label="@string/app_name" />
<activity
android:name=".SyncActivity"
android:screenOrientation="portrait"
android:label="@string/app_name" />
<activity
android:name=".DashActivity"
android:screenOrientation="portrait"
android:label="@string/app_name" />
<activity
android:name=".DashOrderReview"
android:screenOrientation="portrait"
android:label="" />
<activity
android:name=".Thankyou"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat" />
<activity
android:name=".ConformCheckout"
android:label=""
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".RetailereKyc"
android:label=""
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize" >
</activity>
我添加了manifest文件還我給這需要訪問攝像機
請解決這個問題的人在此先感謝
也許,應用程序未安裝。 –
發佈您的清單文件 –
我添加了清單文件,請檢查它 – vasanth