所以,我試圖在我的Android應用程序中實現一個QR掃描器,並且我正在使用Android Studio。用戶只需點擊(點擊)一個按鈕,即可將QR掃描儀調用到屏幕上。此時,用戶可以掃描嵌入式URL的QR碼並將其發送到該URL。很簡單。爲什麼我的應用程序保持崩潰沒有任何錯誤?
我正在使用[ZBar] [1]庫。 我用這個真棒[教程] [1]。
我幾乎跟着他的教程,正如他概述,複製和粘貼。我沒有編譯錯誤,應用程序沒有任何問題;但是,在運行它時,模擬器會向我發送以下消息:「不幸的是,我的應用程序已停止。」
如果您需要了解更多信息,請告訴我。
這裏是logcat的輸出崩潰後:
10-02 16:56:26.732 18271-18271/v1.com.example.ggpcoding.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: v1.com.example.ggpcoding.myapplication, PID: 18271
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/v1.com.example.ggpcoding.myapplication-2/base.apk"],nativeLibraryDirectories=[/data/app/v1.com.example.ggpcoding.myapplication-2/lib/x86, /vendor/lib, /system/lib]]] couldn't find "libzbarjni.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at net.sourceforge.zbar.ImageScanner.<clinit>(Unknown Source)
at v1.com.example.ggpcoding.myapplication.MainActivity.initControls(MainActivity.java:46)
at v1.com.example.ggpcoding.myapplication.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
這裏的onCreate功能:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initControls();
}
如果您的應用程序崩潰,則會出現logcat錯誤 - 請將其添加到問題中。 –
告訴我們關於創建請 –
那麼你肯定有一個錯誤,它通常與試圖加載使用JNI的庫有關。搜索「java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader」,你會在SO上找到處理這個錯誤的各種答案。 – NoChinDeluxe