Erro na Integração com ZXinglib

174 views
Skip to first unread message

Vinny Valente

unread,
Jun 20, 2013, 4:02:51 PM6/20/13
to androidb...@googlegroups.com
Boa Tarde galera,

Estou tentando implementar a integração com a ZXinglib, aquela mais limpa que a ZXing original.

Estou com um erro e se puderem me ajudar agradeceria muito.
Lembrando que estou iniciando em Android agora.

Segue Log

06-20 16:46:37.225: E/AndroidRuntime(19899): FATAL EXCEPTION: main
06-20 16:46:37.225: E/AndroidRuntime(19899): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.leitorqr/com.example.leitorqr.capture}: java.lang.ClassNotFoundException: com.example.leitorqr.capture
06-20 16:46:37.225: E/AndroidRuntime(19899): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
06-20 16:46:37.225: E/AndroidRuntime(19899): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
06-20 16:46:37.225: E/AndroidRuntime(19899): at android.app.ActivityThread.access$600(ActivityThread.java:140)
06-20 16:46:37.225: E/AndroidRuntime(19899): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
06-20 16:46:37.225: E/AndroidRuntime(19899): at android.os.Handler.dispatchMessage(Handler.java:99)
06-20 16:46:37.225: E/AndroidRuntime(19899): at android.os.Looper.loop(Looper.java:137)
06-20 16:46:37.225: E/AndroidRuntime(19899): at android.app.ActivityThread.main(ActivityThread.java:4898)
06-20 16:46:37.225: E/AndroidRuntime(19899): at java.lang.reflect.Method.invokeNative(Native Method)
06-20 16:46:37.225: E/AndroidRuntime(19899): at java.lang.reflect.Method.invoke(Method.java:511)
06-20 16:46:37.225: E/AndroidRuntime(19899): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
06-20 16:46:37.225: E/AndroidRuntime(19899): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
06-20 16:46:37.225: E/AndroidRuntime(19899): at dalvik.system.NativeStart.main(Native Method)
06-20 16:46:37.225: E/AndroidRuntime(19899): Caused by: java.lang.ClassNotFoundException: com.example.leitorqr.capture
06-20 16:46:37.225: E/AndroidRuntime(19899): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-20 16:46:37.225: E/AndroidRuntime(19899): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-20 16:46:37.225: E/AndroidRuntime(19899): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-20 16:46:37.225: E/AndroidRuntime(19899): at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
06-20 16:46:37.225: E/AndroidRuntime(19899): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
06-20 16:46:37.225: E/AndroidRuntime(19899): ... 11 more
06-20 16:46:48.010: I/Process(19899): Sending signal. PID: 19899 SIG: 9

Segue classe
package com.example.leitorqr;

import jim.h.common.android.zxinglib.integrator.IntentIntegrator;
import jim.h.common.android.zxinglib.integrator.IntentResult;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.TextView;


public class ZXingJarDemoActivity extends Activity {
    private Handler  handler = new Handler();
    private TextView txtScanResult;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.telainicio);
    }

        //txtScanResult = (TextView) findViewById(R.id.scan_result);
        //View btnScan = findViewById(R.id.scan_button);

        // Scan button
        //btnScan.setOnClickListener(new OnClickListener() {
     public void leituraQr (View view) {
    IntentIntegrator.initiateScan(ZXingJarDemoActivity.this, R.layout.telaqr,
                 R.id.viewfinder_view, R.id.preview_view, true);
     
     } 
       /*     @Override
            public void onClick(View v) {
                // set the last parameter to true to open front light if available
                IntentIntegrator.initiateScan(ZXingJarDemoActivity.this, R.layout.capture,
                        R.id.viewfinder_view, R.id.preview_view, true);
            }
        });
    }*/

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
            case IntentIntegrator.REQUEST_CODE:
                IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode,
                        resultCode, data);
                if (scanResult == null) {
                    return;
                }
                final String result = scanResult.getContents();
                if (result != null) {
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            txtScanResult.setText(result);
                        }
                    });
                }
                break;
            default:
        }
    }
}


Agradeço desde já.

J. Jhonys C. Camacho

unread,
Jun 21, 2013, 6:59:14 AM6/21/13
to androidb...@googlegroups.com
Meu camarada,

você já importou o core.jar no seu projeto?

Sem esse jar não vai funcionar.

Abraços,
Jhonys


2013/6/20 Vinny Valente <irmaoca...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Maicon Strey

unread,
Jun 21, 2013, 8:25:59 AM6/21/13
to androidb...@googlegroups.com
Cara,
eu escrevi um post sobre isso algum tempo atrás. Escrei pra Android 2.3 mas já te da uma boa base de como implementar:



Maicon Strey
Novo Hamburgo - RS - Brasil
------------------
------------------
Linux user: #525086

Vinny Valente

unread,
Jun 21, 2013, 10:14:14 AM6/21/13
to androidb...@googlegroups.com
Importei sim, o Core.jar e o zxingjar-1.1.jar

Vinny Valente

unread,
Jun 21, 2013, 10:26:06 AM6/21/13
to androidb...@googlegroups.com
Maicon,

Eu fiz justamente com esse post, porem não esta rolando... Estou usando o novo SDK, mas não sei se isso faz diferença!
Interessante q eu achei seu blog na net e hj to conhecendo o autor ahuehuea

Marcinho Gonçalves

unread,
Sep 26, 2013, 3:52:10 PM9/26/13
to androidb...@googlegroups.com
Vinny boa tarde onde conseguiu os .jar não encontro.

Vinicius Valente

unread,
Oct 4, 2013, 10:16:41 AM10/4/13
to androidb...@googlegroups.com


2013/9/26 Marcinho Gonçalves <marc...@gmail.com>

--
You received this message because you are subscribed to a topic in the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/androidbrasil-dev/NFVP-A6mM74/unsubscribe.
To unsubscribe from this group and all its topics, send an email to androidbrasil-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages