As it turns out, from the class that extends from Application () I access the other classes of the project but I do not see their methods (unresolved reference).
This is the application class:
package com.fernando.lanatelar
import android.app.Application
class LanaTelarApp : Application() {
companion object Constants {
const val TAG = "ObjectBoxExample"
}
override fun onCreate() {
super.onCreate()
ObjectBox.construye(this)
}
}
And this is the ObjectBox class:
package com.fernando.lanatelar
import android.content.Context
import com.fernando.lanatelar.modelo.MyObjectBox
import io.objectbox.BoxStore
class ObjectBox {
lateinit var boxStore: BoxStore
private set
fun construye(context: Context) {
boxStore = MyObjectBox.builder().androidContext(context.applicationContext).build()
}
}
From LanaTelarApp I access the ObjectBox without problems, but its methods do not appear and when I put ObjectBox.build () it gives me an error of: Unresolved reference.
The manifest is like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fernando.lanatelar">
<application
android:name=".LanaTelarApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>