# Android Studio Room Database



## wladp (24. Jun 2022)

I'm working on an Android app with Java and SQLite. Instead of SQlite I want to switch to Room. Therefore I have a existing database which I want to include in my App.
But every time I try to do so I'm getting an error message: 


```
java.lang.IllegalStateException: Pre-packaged database has an invalid schema: MY_TABLE(com.example.myapp.Database.Entities.myEntity).
     Expected:
...

Found:
...
```

The problem is that the expected part and the found part are exactly the same. I even checked it with a string comparer. My database schema are also perfectly matching. 
Is this just a weird bug or does anybody have the same error?


----------



## osion (19. Dez 2022)

It sounds like you are trying to include a pre-existing database in your Android app, but you are getting an error message indicating that the database has an invalid schema. You have checked the schema and found that it matches the expected schema, but you are still getting this error.

One possible reason for this error could be that the database file itself is corrupt or damaged in some way. Another possibility is that there is a problem with the way you are trying to access or read the database file in your app. It might be worth trying to recreate the database file from scratch and see if that resolves the issue.

It could also be helpful to try debugging the problem by printing out the schema of the expected and found tables and comparing them side by side to see if there are any differences that you might have missed. If you are still unable to resolve the issue, it might be helpful to post more detailed information about your app and the steps you are taking to include the database, as well as any other relevant code or error messages. This could help others provide more specific suggestions for how to troubleshoot the problem.


----------

