android - Cannot invoke method hasAnnotation() on null object -


i'm trying upgrade realm database 0.86 2.1 version.

but facing error along android studio

error:execution failed task ':app:transformclasseswithrealmtransformerfordebug'. > cannot invoke method hasannotation() on null object 

update (3)

 clean assemble --stacktrace --info     starting build     creating configuration compile                                                    creating configuration apk     creating configuration provided     creating configuration wearapp     creating configuration annotationprocessor     creating configuration androidtestcompile     creating configuration androidtestapk     creating configuration androidtestprovided     creating configuration androidtestwearapp     creating configuration androidtestannotationprocessor     creating configuration testcompile     creating configuration testapk     creating configuration testprovided     creating configuration testwearapp     creating configuration testannotationprocessor     creating configuration debugcompile     creating configuration debugapk     creating configuration debugprovided     creating configuration debugwearapp     creating configuration debugannotationprocessor     creating configuration testdebugcompile     creating configuration testdebugapk     creating configuration testdebugprovided     creating configuration testdebugwearapp     creating configuration testdebugannotationprocessor     creating configuration releasecompile     creating configuration releaseapk     creating configuration releaseprovided     creating configuration releasewearapp     creating configuration releaseannotationprocessor     creating configuration testreleasecompile     creating configuration testreleaseapk     creating configuration testreleaseprovided     creating configuration testreleasewearapp     creating configuration testreleaseannotationprocessor     parsing sdk, no caching allowed     parsing d:\android\sdk\add-ons\addon-google_apis-google-23\package.xml     parsing d:\android\sdk\build-tools\23.0.2\package.xml     parsing d:\android\sdk\build-tools\23.0.3\package.xml     parsing d:\android\sdk\build-tools\24.0.0-preview\package.xml     parsing d:\android\sdk\build-tools\24.0.1\package.xml     parsing d:\android\sdk\build-tools\24.0.3\package.xml     parsing d:\android\sdk\build-tools\25.0.0\package.xml     parsing d:\android\sdk\extras\android\m2repository\package.xml     parsing d:\android\sdk\extras\android\support\package.xml     parsing d:\android\sdk\extras\google\google_play_services\package.xml     parsing d:\android\sdk\extras\google\m2repository\package.xml     parsing d:\android\sdk\extras\google\usb_driver\package.xml       * exception is:     org.gradle.api.tasks.taskexecutionexception: execution failed task ':app:transformclasseswithrealmtransformerfordebug'.             @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:69)             @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.execute(executeactionstaskexecuter.java:46)             @ org.gradle.api.internal.tasks.execution.postexecutionanalysistaskexecuter.execute(postexecutionanalysistaskexecuter.java:35)             @ org.gradle.api.internal.tasks.execution.skipuptodatetaskexecuter.execute(skipuptodatetaskexecuter.java:66)             @ org.gradle.api.internal.tasks.execution.validatingtaskexecuter.execute(validatingtaskexecuter.java:58)             @ org.gradle.api.internal.tasks.execution.skipemptysourcefilestaskexecuter.execute(skipemptysourcefilestaskexecuter.java:52)             @ org.gradle.api.internal.tasks.execution.skiptaskwithnoactionsexecuter.execute(skiptaskwithnoactionsexecuter.java:52)             @ org.gradle.api.internal.tasks.execution.skiponlyiftaskexecuter.execute(skiponlyiftaskexecuter.java:53)             @ org.gradle.api.internal.tasks.execution.executeatmostoncetaskexecuter.execute(executeatmostoncetaskexecuter.java:43)             @ org.gradle.execution.taskgraph.defaulttaskgraphexecuter$eventfiringtaskworker.execute(defaulttaskgraphexecuter.java:203)             @ org.gradle.execution.taskgraph.defaulttaskgraphexecuter$eventfiringtaskworker.execute(defaulttaskgraphexecuter.java:185)             @ org.gradle.execution.taskgraph.abstracttaskplanexecutor$taskexecutorworker.processtask(abstracttaskplanexecutor.java:66)             @ org.gradle.execution.taskgraph.abstracttaskplanexecutor$taskexecutorworker.run(abstracttaskplanexecutor.java:50)             @ org.gradle.execution.taskgraph.defaulttaskplanexecutor.process(defaulttaskplanexecutor.java:25)             @ org.gradle.execution.taskgraph.defaulttaskgraphexecuter.execute(defaulttaskgraphexecuter.java:110)             @ org.gradle.execution.selectedtaskexecutionaction.execute(selectedtaskexecutionaction.java:37)             @ org.gradle.execution.defaultbuildexecuter.execute(defaultbuildexecuter.java:37)             @ org.gradle.execution.defaultbuildexecuter.access$000(defaultbuildexecuter.java:23)             @ org.gradle.execution.defaultbuildexecuter$1.proceed(defaultbuildexecuter.java:43)             @ org.gradle.execution.dryrunbuildexecutionaction.execute(dryrunbuildexecutionaction.java:32)             @ org.gradle.execution.defaultbuildexecuter.execute(defaultbuildexecuter.java:37)             @ org.gradle.execution.defaultbuildexecuter.execute(defaultbuildexecuter.java:30)             @ org.gradle.initialization.defaultgradlelauncher$4.run(defaultgradlelauncher.java:153)             @ org.gradle.internal.factories$1.create(factories.java:22)             @ org.gradle.internal.progress.defaultbuildoperationexecutor.run(defaultbuildoperationexecutor.java:91)             @ org.gradle.internal.progress.defaultbuildoperationexecutor.run(defaultbuildoperationexecutor.java:53)             @ org.gradle.initialization.defaultgradlelauncher.dobuildstages(defaultgradlelauncher.java:150)             @ org.gradle.initialization.defaultgradlelauncher.access$200(defaultgradlelauncher.java:32)             @ org.gradle.initialization.defaultgradlelauncher$1.create(defaultgradlelauncher.java:98)             @ org.gradle.initialization.defaultgradlelauncher$1.create(defaultgradlelauncher.java:92)             @ org.gradle.internal.progress.defaultbuildoperationexecutor.run(defaultbuildoperationexecutor.java:91)             @ org.gradle.internal.progress.defaultbuildoperationexecutor.run(defaultbuildoperationexecutor.java:63)             @ org.gradle.initialization.defaultgradlelauncher.dobuild(defaultgradlelauncher.java:92)             @ org.gradle.initialization.defaultgradlelauncher.run(defaultgradlelauncher.java:83)             @ org.gradle.launcher.exec.inprocessbuildactionexecuter$defaultbuildcontroller.run(inprocessbuildactionexecuter.java:99)             @ org.gradle.tooling.internal.provider.executebuildactionrunner.run(executebuildactionrunner.java:28)             @ org.gradle.launcher.exec.chainingbuildactionrunner.run(chainingbuildactionrunner.java:35)             @ org.gradle.launcher.exec.inprocessbuildactionexecuter.execute(inprocessbuildactionexecuter.java:48)             @ org.gradle.launcher.exec.inprocessbuildactionexecuter.execute(inprocessbuildactionexecuter.java:30)             @ org.gradle.launcher.exec.continuousbuildactionexecuter.execute(continuousbuildactionexecuter.java:81)             @ org.gradle.launcher.exec.continuousbuildactionexecuter.execute(continuousbuildactionexecuter.java:46)             @ org.gradle.launcher.exec.daemonusagesuggestingbuildactionexecuter.execute(daemonusagesuggestingbuildactionexecuter.java:51)             @ org.gradle.launcher.exec.daemonusagesuggestingbuildactionexecuter.execute(daemonusagesuggestingbuildactionexecuter.java:28)             @ org.gradle.launcher.cli.runbuildaction.run(runbuildaction.java:43)             @ org.gradle.internal.actions$runnableactionadapter.execute(actions.java:173)             @ org.gradle.launcher.cli.commandlineactionfactory$parseandbuildaction.execute(commandlineactionfactory.java:239)             @ org.gradle.launcher.cli.commandlineactionfactory$parseandbuildaction.execute(commandlineactionfactory.java:212)             @ org.gradle.launcher.cli.javaruntimevalidationaction.execute(javaruntimevalidationaction.java:35)             @ org.gradle.launcher.cli.javaruntimevalidationaction.execute(javaruntimevalidationaction.java:24)             @ org.gradle.launcher.cli.exceptionreportingaction.execute(exceptionreportingaction.java:33)             @ org.gradle.launcher.cli.exceptionreportingaction.execute(exceptionreportingaction.java:22)             @ org.gradle.launcher.cli.commandlineactionfactory$withlogging.execute(commandlineactionfactory.java:205)             @ org.gradle.launcher.cli.commandlineactionfactory$withlogging.execute(commandlineactionfactory.java:169)             @ org.gradle.launcher.main.doaction(main.java:33)             @ org.gradle.launcher.bootstrap.entrypoint.run(entrypoint.java:45)             @ org.gradle.launcher.bootstrap.processbootstrap.runnoexit(processbootstrap.java:55)             @ org.gradle.launcher.bootstrap.processbootstrap.run(processbootstrap.java:36)             @ org.gradle.launcher.gradlemain.main(gradlemain.java:23)             @ org.gradle.wrapper.bootstrapmainstarter.start(bootstrapmainstarter.java:33)             @ org.gradle.wrapper.wrapperexecutor.execute(wrapperexecutor.java:130)             @ org.gradle.wrapper.gradlewrappermain.main(gradlewrappermain.java:48)     caused by: java.lang.nullpointerexception: cannot invoke method hasannotation() on null object             @ io.realm.transformer.realmtransformer$_transform_closure7.docall(realmtransformer.groovy:115)             @ io.realm.transformer.realmtransformer.transform(realmtransformer.groovy:112)             @ com.android.build.api.transform.transform.transform(transform.java:290)             @ com.android.build.gradle.internal.pipeline.transformtask$2.call(transformtask.java:178)             @ com.android.build.gradle.internal.pipeline.transformtask$2.call(transformtask.java:174)             @ com.android.builder.profile.threadrecorder.record(threadrecorder.java:156)             @ com.android.build.gradle.internal.pipeline.transformtask.transform(transformtask.java:173)             @ org.gradle.internal.reflect.javamethod.invoke(javamethod.java:75)             @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$incrementaltaskaction.doexecute(annotationprocessingtaskfactory.java:245)             @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$standardtaskaction.execute(annotationprocessingtaskfactory.java:221)             @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$incrementaltaskaction.execute(annotationprocessingtaskfactory.java:232)             @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$standardtaskaction.execute(annotationprocessingtaskfactory.java:210)             @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeaction(executeactionstaskexecuter.java:80)             @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:61)             ... 60 more       build failed      total time: 20.365 secs     stopped 0 compiler daemon(s). 

without reason stopped app running.

any solution ?

so according stack trace, this line fails in realm-transformer:

def allmodelclasses = allclassnames

.findall { it.endswith('realmproxy') }

.collect { classpool.getctclass(it).superclass }

.findall { it.hasannotation(realmclass.class) || it.superclass.hasannotation(realmclass.class) }

so says "if have class ends realmproxy" do per question literally have class named realmproxy, tries superclass (which ought realmobject or realmmodel) doesn't have because it's not part of realm schema, returns null , transformer crashes.

solution 1: rename realmproxy class like, realmfacade or something

or

solution 2: extend random class realmproxy doesn't have @realmclass annotation.

public abstract class realmproxybase { }  public class realmproxy extends realmproxybase implements closeable {     // ... 

(in meantime, filed issue here)


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -