title: Trouble with getting an instance of a room-Database
body: <p>I unfortunately have big issues with getting an instance of a Room-Database for my android project. I followed the instructions on <a href="https://developer.android.com/training/data-storage/room/index.html" rel="nofollow noreferrer">https://developer.android.com/training/data-storage/room/index.html</a>
  But the last step won't work for me:</p>
  
  <pre><code>AppDatabase db = Room.databaseBuilder(getApplicationContext(),
  AppDatabase.class, "database-name").build();
  </code></pre>
  
  <p>Their AppDatabase.java looks like this</p>
  
  <pre><code>@Database(entities = {User.class}, version = 1)
  public abstract class AppDatabase extends RoomDatabase {
  public abstract UserDao userDao();
  }
  </code></pre>
  
  <p>My Problem: At "<strong>AppDatabase db</strong>" I get the error 'cannot resolve symbol "<strong>AppDatabase</strong>" '. This is quite senseful, because AppDatabase is just an abstract class. But how is this supposed to work in the tutorial?
  I tried to get the instance in the onCreate method of my MainActivity. 
  Here are my gradlefiles:
      buildscript {</p>
  
  <pre><code>    repositories {
          google()
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.0.0'
         // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
      }
  }
  
  ext {
      buildToolsVersion = "25.0.2"
      supportLibVersion = "25.3.1"
      archRoomVersion = "1.0.0-alpha1"
  }
  
  allprojects {
      repositories {
          google()
          jcenter()
          maven { url 'https://maven.google.com' }
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  
  <p>and the second one:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
  compileSdkVersion 26
  defaultConfig {
      applicationId "com.example.fabian.kohlmannkonstruktionen"
      minSdkVersion 15
      targetSdkVersion 26
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner 
  "android.support.test.runner.AndroidJUnitRunner"
  }
  buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 
  'proguard-rules.pro'
      }
  }
  }
  
  dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.android.support:appcompat-v7:26.1.0'
  implementation 'com.android.support.constraint:constraint-layout:1.0.2'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.1'
  androidTestImplementation 'com.android.support.test.espresso:espresso-
  core:3.0.1'
  compile 'android.arch.persistence.room:runtime:' + 
  rootProject.archRoomVersion
  annotationProcessor 'android.arch.persistence.room:compiler:' + 
  rootProject.archRoomVersion
  
  }
  </code></pre>
  
  <p>MainActivity.java </p>
  
  <pre><code>package com.example.fabian.kohlmannkonstruktionen;
  
  import android.app.AlertDialog;
  import android.content.DialogInterface;
  
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.arch.persistence.db.SupportSQLiteDatabase;
  import android.arch.persistence.room.Database;
  import android.arch.persistence.room.Room;
  import android.arch.persistence.room.RoomDatabase;
  import android.arch.persistence.room.migration.Migration;
  import android.content.Context;
  
  
  public class MainActivity extends AppCompatActivity {
  
  AppDatabase db;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      db = AppDatabase.getInMemoryDatabase(getApplicationContext());
  }
  ...
  </code></pre>
  
  <p>AppDatabase.java</p>
  
  <pre><code>package com.example.fabian.kohlmannkonstruktionen;
  
  import android.app.AlertDialog;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.arch.persistence.db.SupportSQLiteDatabase;
  import android.arch.persistence.room.Database;
  import android.arch.persistence.room.Room;
  import android.arch.persistence.room.RoomDatabase;
  import android.arch.persistence.room.migration.Migration;
  import android.content.Context;
  
  
  public class MainActivity extends AppCompatActivity {
      AppDatabase db;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          db = AppDatabase.getInMemoryDatabase(getApplicationContext());
  }
  </code></pre>
  
  <p>Projekt.java</p>
  
  <pre><code>import android.arch.persistence.room.Entity;
  import android.arch.persistence.room.PrimaryKey;
  
  /**
   * Created by Fabian on 14.11.2017.
   */
  @Entity
  public class Projekt {
      @PrimaryKey(autoGenerate = true)
      Integer id;
  
      Integer projektnummer;
      Integer lohn,arbeitszeit;
      String projektname, firma;
      Boolean abgeschlossen;
      public Projekt(String projektname,String firma,Integer projektnummer){
          this.abgeschlossen=false;
          this.projektname=projektname;
          this.projektnummer=projektnummer;
          this.firma=firma;
      }
  ...getters and setters...
  </code></pre>
  
  <p>ProjektDao.java</p>
  
  <pre><code>import android.arch.persistence.room.Dao;
  import android.arch.persistence.room.Delete;
  import android.arch.persistence.room.Insert;
  import android.arch.persistence.room.Query;
  
  import java.util.List;
  
  /**
   * Created by Fabian on 15.11.2017.
   */
  @Dao
  public interface ProjektDao {
      @Query("SELECT * FROM Projekt")
      List&lt;Projekt&gt; getAll();
  
      @Query("SELECT * FROM Projekt where id LIKE  :id")
      Projekt findByID(String id);
  
      @Query("SELECT COUNT(*) from Projekt")
      int countUsers();
  
      @Insert
      void insertAll(Projekt... projekts);
  
      @Delete
      void delete(Projekt projekt);
  }
  </code></pre>
  
  <p>Termin and TerminDao looks the same</p>
  
  <p>This is the text from the gradle console:      </p>
  
  <pre><code>Executing tasks: [assemble]
  
  Configuration on demand is an incubating feature.
  Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
  :app:compileDebugJavaWithJavac
  C:\Users\Fabian\AndroidStudioProjects\KohlmannKonstruktionen\app\src\main\java\TerminDao.java:14: warning: The query returns some columns [pausenzeit, startzeit, endzeit, lohnproh, mitarbeiter, standort] which are not use by Projekt. You can use @ColumnInfo annotation on the fields to specify the mapping. Projekt has some fields [projektnummer, lohn, arbeitszeit, projektname, firma, abgeschlossen] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @Ignore annotation. You can suppress this warning by annotating the method with @SuppressWarnings(RoomWarnings.CURSOR_MISMATCH). Columns returned by the query: id, pausenzeit, startzeit, endzeit, lohnproh, mitarbeiter, standort. Fields in Projekt: id, projektnummer, lohn, arbeitszeit, projektname, firma, abgeschlossen.
      List&lt;Projekt&gt; getAll();
                    ^
  C:\Users\Fabian\AndroidStudioProjects\KohlmannKonstruktionen\app\src\main\java\AppDatabase.java:13: warning: Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide `room.schemaLocation` annotation processor argument OR set exportSchema to false.
  public abstract class AppDatabase extends RoomDatabase {
                  ^
  C:\Users\Fabian\AndroidStudioProjects\KohlmannKonstruktionen\app\src\main\java\com\example\fabian\kohlmannkonstruktionen\MainActivity.java:13: error: cannot find symbol
      AppDatabase db = AppDatabase.getInMemoryDatabase(getApplicationContext());
      ^
    symbol:   class AppDatabase
    location: class MainActivity
  1 error
  2 warnings
  
   FAILED
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:compileDebugJavaWithJavac'.
  &gt; Compilation failed; see the compiler error output for details.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 5s
  
  14 actionable tasks: 1 executed, 13 up-to-date
  </code></pre>