Android: Sugar ORM No Such Table Exception

后端 未结 21 922
一生所求
一生所求 2020-12-05 06:42

I am getting the No Such table exception when i am Using Sugar ORM with GPU image Android Library. I am using Gradle and Android Studio. Once i remove GPU image

相关标签:
21条回答
  • 2020-12-05 07:18

    I was facing the same issue. Disabling "Instant run" didn't solve the problem. I didn't enable proguard too. Later I removed all meta data of sugarORM from android manifest (except query log) and that solved the problem. So remove the following 3 lines from android manifest:

        <meta-data android:name="DATABASE" android:value="edikodik.db" />
        <meta-data android:name="VERSION" android:value="2" />
        <meta-data android:name="QUERY_LOG" android:value="true" /> 
    

    EDIT: As per comment of jrhamza, if above solution doesn't work, try disabling Instant Run.

    0 讨论(0)
  • 2020-12-05 07:20

    As mentioned by others, Android Studio instant run might be the problem (known SugarORM issue), try to turn it off.

    However, I've had the same problem, and that wasn't sufficient for me, the problem persisted. I fixed this by changing allowBackup="true" in my manifest to false, running the app, and remove > re-install the app afterwards.

    Why I guess that's the problem: I found out my preferences were kept saved even after re-installation. If this also happens to the corrupt SQL table (due to instant run), then even re-installation wouldn't fix it. My problem was immediately fixed after changing allowBackup to false and re-installing. I'm not yet able to reproduce the error, so cannot reproduce the fix either.

    Hope this addition might help anyone from headaches like me!

    0 讨论(0)
  • 2020-12-05 07:23

    In my case it's problem of library Sugar. It has bad method to getting domain Classes (com.orm.util.ReflectionUtil#getDomainClasses). The method always returns no classes. So Sugar may not initialize database tables. I has downgraded to gradle 1.3.0 (that method works correctly) and problem is gone.

    0 讨论(0)
提交回复
热议问题