Skip to content

Android does not find any classes #42

@Hatzen

Description

@Hatzen

TL;DR;
It seems this project is not able to run on android.

At first thanks for this library. But i m struggeling a lot at getting it working with android.

currently my problem is that the lib is initalized properly but as soon as i want to call
jsonDBTemplate.createCollection(DeviceData1::class.java)
it throws

io.jsondb.InvalidJsonDbApiUsageException: No class found with @document Annotation ` 2020-08-31 21:26:20.854 15038-15038/de.hartz.software.parannoying E/AndroidRuntime: FATAL EXCEPTION: main Process: de.hartz.software.parannoying, PID: 15038 java.lang.RuntimeException: Unable to instantiate application de.hartz.software.parannoying.App: io.jsondb.InvalidJsonDbApiUsageException: No class found with @document Annotation and attribute collectionName as: root at android.app.LoadedApk.makeApplication(LoadedApk.java:989) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5733) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1660) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6521) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: io.jsondb.InvalidJsonDbApiUsageException: No class found with @document Annotation and attribute collectionName as: root at io.jsondb.JsonDBTemplate.createCollection(JsonDBTemplate.java:285) at io.jsondb.JsonDBTemplate.createCollection(JsonDBTemplate.java:275) at de.hartz.software.parannoying.model.Storage.init(Storage.kt:94) at de.hartz.software.parannoying.App.initStorage(App.kt:58) at de.hartz.software.parannoying.App.initApp(App.kt:26) at de.hartz.software.parannoying.App.initApp$default(App.kt:21) at de.hartz.software.parannoying.App.attachBaseContext(App.kt:50) at android.app.Application.attach(Application.java:189) at android.app.Instrumentation.newApplication(Instrumentation.java:1104) at android.app.Instrumentation.newApplication(Instrumentation.java:1088) at android.app.LoadedApk.makeApplication(LoadedApk.java:983) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5733)  at android.app.ActivityThread.-wrap1(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1660)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6521)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)  `

So it is not finding the entityclasses also the base package is properly set and the anntitation is set like mentioned in the usage section. On the other hand determineCollectionName is working without any problems..

when calling reflections.getAllTypes() in CollectionMetaData.builder(JsonDBConfig dbConfig) from the debugger it throws:
Couldn't find subtypes of Object. Make sure SubTypesScanner initialized to include Object class - new SubTypesScanner(false)

I disabled obfusication via gradle.build file:
...
minifyEnabled false
useProguard false
...
I m using Java 8 and also the Java 8 Lib ('io.jsondb:jsondb-core:1.0.115-j8'). In special i use Kotlin in the whole application, but also when i m creating java files for the Entities these are not found.


I dont have any further ideas on how to debugg this problem. Is this problem maybe already known or are there any work arounds?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions