I've created a basic python app engine application with endpoint annotations. I used the python console tool to export a java client library (jar) file (Based on this example). I've used the "add as library" and verified that the gradle file up
I'm not attempting to import the jar file into Android Studio 0.5.2. I followed the directions in the example but can't seem to get access to the models in my jar file. Based on this part of the example I should be able to import my library and use the models like any other class.
When I add the ";" Android Studio deletes my import line and sets an error:
Access is allowed from event dispatch thread only. Details: Current thread: Thread[JobScheduler FJ pool 3/4,6,main] 570719363 Our dispatch thread:Thread[AWT-EventQueue-0 0.5.2#AI-135.1078000, eap:true,6,main] 12400241 SystemEventQueueThread: Thread[AWT-EventQueue-0 0.5.2#AI-135.1078000, eap:true,6,main] 12400241 java.lang.Throwable at com.intellij.openapi.diagnostic.Logger.error(Logger.java:124) at com.intellij.openapi.application.impl.ApplicationImpl.assertIsDispatchThread(ApplicationImpl.java:1085) at com.intellij.openapi.application.impl.ApplicationImpl.assertIsDispatchThread(ApplicationImpl.java:1073) at com.intellij.openapi.wm.impl.FocusManagerImpl.assertDispatchThread(FocusManagerImpl.java:1159) at com.intellij.openapi.wm.impl.FocusManagerImpl.getFocusOwner(FocusManagerImpl.java:888) at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.getFocusOwner(IdeFocusManagerImpl.java:119) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl$2.run(FileEditorManagerImpl.java:202) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.getActiveSplitters(FileEditorManagerImpl.java:230) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.getSplitters(FileEditorManagerImpl.java:1180) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.getCurrentEditorWithProviderComposite(FileEditorManagerImpl.java:1258) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.getEditors(FileEditorManagerImpl.java:1230) at com.intellij.codeInsight.daemon.impl.DaemonListeners.canUndo(DaemonListeners.java:390) at com.intellij.codeInsight.daemon.impl.DaemonListeners.canChangeFileSilently(DaemonListeners.java:386) at com.intellij.codeInsight.intention.impl.config.QuickFixFactoryImpl.timeToOptimizeImports(QuickFixFactoryImpl.java:741) at com.intellij.codeInsight.intention.impl.config.QuickFixFactoryImpl.access$000(QuickFixFactoryImpl.java:70) at com.intellij.codeInsight.intention.impl.config.QuickFixFactoryImpl$1.isAvailable(QuickFixFactoryImpl.java:621) at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.addAvailableActionsForGroups(ShowIntentionsPass.java:129) at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.access$000(ShowIntentionsPass.java:69) at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass$1.process(ShowIntentionsPass.java:88) at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass$1.process(ShowIntentionsPass.java:85) at com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl$6.process(DaemonCodeAnalyzerImpl.java:545) at com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl$6.process(DaemonCodeAnalyzerImpl.java:539) at com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx$1.process(DaemonCodeAnalyzerEx.java:59) at com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx$1.process(DaemonCodeAnalyzerEx.java:53) at com.intellij.openapi.editor.impl.IntervalTreeImpl$IntervalNode.processAliveKeys(IntervalTreeImpl.java:97) at com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:468) at com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:463) at com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:476) at com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:476) at com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:463) at com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:463) at com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:463) at com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:440) at com.intellij.openapi.editor.impl.MarkupModelImpl.processRangeHighlightersOverlappingWith(MarkupModelImpl.java:264) at com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx.processHighlights(DaemonCodeAnalyzerEx.java:53) at com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl.processHighlightsNearOffset(DaemonCodeAnalyzerImpl.java:539) at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getAvailableActions(ShowIntentionsPass.java:85) at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getActionsToShow(ShowIntentionsPass.java:260) at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getIntentionActionsToShow(ShowIntentionsPass.java:212) at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doCollectInformation(ShowIntentionsPass.java:186) at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:61) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1$1.run(PassExecutorService.java:380) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1153) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1.run(PassExecutorService.java:371) at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:368) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:344) at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask.exec(JobLauncherImpl.java:193) at jsr166e.ForkJoinTask.doExec(ForkJoinTask.java:260) at jsr166e.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:858) at jsr166e.ForkJoinPool.scan(ForkJoinPool.java:1687) at jsr166e.ForkJoinPool.runWorker(ForkJoinPool.java:1642) at jsr166e.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:109)
The error message contains 4 sections that look very similar to the above.
I've searched searched everywhere and seem to be at a loss. Using this library is crucial to my project and I've already spent 10+ hours trying to resolve this issue on my own. Any tips or guidance is very much appreciated.
The exception is a bug in Android Studio and is actually a red herring; it's not the cause of your problem. You have Preferences > Editor > Auto import > Optimize imports on the fly enabled. When you type that import
and press ;, it optimizes the import away because you're not using it yet. Either disable the preference, or don't type import
statements manually -- use a reference to the class in your code, and let the editor assistance add the import
for you.
Feedback from @Scott has resolved the disappearing import issue but I still can't seem to access the objects in the jar.
Anyone know if this looks to be an issue with the jar, gradle or Android studio?