我正在使用的Web服務器來存儲用戶和數據的Android應用程序。 我已經爲每個使用PHP的用戶生成了一個Qr代碼。 我需要掃描該Qr代碼才能讓用戶登錄。 我已經試過實現Zxing。實現一個QR碼掃描儀,以我的應用程序
這是我用來調用斑馬線QR碼功能。
btnLogin.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent,0);
}
});
這是我的清單文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dahmani.javagose.cameratest" >
<uses-feature android:name="android.hardware.Camera" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".app.AppController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name=".LoginActivity"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan"
android:label="@string/app_name"
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=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
</activity>
<activity
android:name=".PhotoInfoActivity"
android:label="@string/title_activity_photo_info"
android:theme="@style/AppTheme.NoActionBar" >
</activity>
</application>
,這我build.gradle.app
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.dahmani.javagose.cameratest"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'me.dm7.barcodescanner:zxing:1.8.4'
}
然而,當我點擊登錄BTN,應用程序崩潰。
,這說明什麼的Android顯示器
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: FATAL EXCEPTION: main
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: Process: com.dahmani.javagose.cameratest, PID: 18916
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN (has extras) }
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1727)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1511)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:3424)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:3385)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at com.dahmani.javagose.cameratest.LoginActivity$1.onClick(LoginActivity.java:81)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at android.view.View.performClick(View.java:4499)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at android.view.View$PerformClick.run(View.java:18571)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:733)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:136)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5021)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
03-07 16:10:15.293 18916-18916/? E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
確定有啥崩潰 – tyczj
你能後的日誌? – xcesco
@xcesco我已經添加了日誌文件 –