Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Erro - SQLITE

Cara,

No seu sql de criação da tabela está com uma virgula após no "nota real", ela não deveria estar ali.
Tira ela e testa novamente ae.


2014-05-27 20:21 GMT-03:00 Thiago <thiagonascimento.rj@hotmail.com>:
Pessoal,

   Podem me ajudar com um erro que está acontecendo ao criar uma aplicação com o SQLITE no Android Studio?
   Por acaso, é até um exercício antigo que tinha pego de um curso que havia feito.
   Segue o LOG:

    05-27 19:19:54.339    1938-1938/com.example.fragment_exemplo.app D/dalvikvm﹕ GC_FOR_ALLOC freed 42K, 4% free 2826K/2932K, paused 30ms, total 30ms
05-27 19:19:54.339    1938-1938/com.example.fragment_exemplo.app I/dalvikvm-heap﹕ Grow heap (frag case) to 3.426MB for 635808-byte allocation
05-27 19:19:54.359    1938-1945/com.example.fragment_exemplo.app D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 4% free 3447K/3556K, paused 12ms, total 12ms
05-27 19:19:54.419    1938-1938/com.example.fragment_exemplo.app E/SQLiteLog﹕ (1) near ")": syntax error
05-27 19:19:54.419    1938-1938/com.example.fragment_exemplo.app D/AndroidRuntime﹕ Shutting down VM
05-27 19:19:54.419    1938-1938/com.example.fragment_exemplo.app W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2cafb20)
05-27 19:19:54.459    1938-1938/com.example.fragment_exemplo.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.fragment_exemplo.app, PID: 1938
    java.lang.RuntimeException: Unable to resume activity {com.example.fragment_exemplo.app/com.example.fragment_exemplo.app.ListaAlunos}: android.database.sqlite.SQLiteException: near ")": syntax error (code 1): , while compiling: CREATE TABLE CadastroCaelum ( id INTEGER PRIMARY KEY,  nome TEXT UNIQUE NOT NULL,  telefone TEXT,  endereco TEXT,  site TEXT,  nota REAL,  );
            at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2788)
            at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2817)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.database.sqlite.SQLiteException: near ")": syntax error (code 1): , while compiling: CREATE TABLE CadastroCaelum ( id INTEGER PRIMARY KEY,  nome TEXT UNIQUE NOT NULL,  telefone TEXT,  endereco TEXT,  site TEXT,  nota REAL,  );
            at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
            at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
            at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
            at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
            at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
            at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
            at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1672)
            at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1603)
            at com.example.fragment_exemplo.app.AlunoDAO.onCreate(AlunoDAO.java:37)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at com.example.fragment_exemplo.app.AlunoDAO.recuperaLista(AlunoDAO.java:49)
            at com.example.fragment_exemplo.app.ListaAlunos.carregaLista(ListaAlunos.java:121)
            at com.example.fragment_exemplo.app.ListaAlunos.onResume(ListaAlunos.java:67)
            at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1192)
            at android.app.Activity.performResume(Activity.java:5310)
            at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2778)
            at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2817)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)

--
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-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Luiz Gustavo S. Mafra
Bacharel em Ciência da Computação - UESC - Universidade Estadual de Santa Cruz
Desenvolvedor de Software - Stefanini Consultoria e Assessoria em Informática
Desenvolvedor PHP, Android, .Net, Python, JEE

+55 15 98821 8798
+55 73 9147 0547

twitter: @lgmafra
skype: lgmafra

--
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-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário