繁体   English   中英

无法使用导入的库。 Android Studio。 Google云端点罐

[英]Can't use imported library. Android Studio. Google cloud endpoints jar

背景

我已经创建了带有端点注释的基本python应用程序引擎应用程序。 我使用python控制台工具导出了Java客户端库(jar)文件( 基于此示例 )。 我使用了“添加为库”并验证了gradle文件 gradle这个

问题

我没有尝试将jar文件导入Android Studio 0.5.2。 我按照示例中的说明进行操作,但似乎无法访问jar文件中的模型。 基于示例的这一部分,我应该能够导入我的库并像其他任何类一样使用模型。

导入屏幕截图

当我添加“;”时 Android Studio删除我的导入行并设置错误: 错误信息

仅允许从事件分发线程进行访问。 详细信息:当前线程:线程[JobScheduler FJ池3 / 4,6,main] 570719363我们的调度线程:Thread [AWT-EventQueue-0 0.5.2#AI-135.1078000,eap:true,6,main] 12400241 SystemEventQueueThread:线程[AWT-EventQueue-0 0.5.2#AI-135.1078000,eap:true,6,main] 12400241 java.lang.Throwable在com.intellij.openapi.diagnostic.Logger.error(Logger.java:124)在com。 com.intellij.openapi.application.impl.ApplicationImpl.assertIsDispatchThread(ApplicationImpl.java:1073)上的intellij.openapi.application.impl.ApplicationImpl.assertIsDispatchThread(ApplicationImpl.java:1085)com.intellij.openapi.wm.impl。 com.intellij.openapi.wm.impl.FocusManagerImpl.getFocusOwner(FocusManagerImpl.java:888)上的com.intellij.openapi.wm.impl.IdeFocusManagerImpl.getFocusOwner(FocusManagerImpl.assertDispatchThread(FocusManagerImpl.java:1159) 119)在com.intellij.openapi.fileEditor.impl.FileEditorMana上的com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl $ 2.run(FileEditorManagerImpl.java:202) com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.getSplitters(FileEditorManagerImpl.java:1180)上的gerImpl.getActiveSplitters(FileEditorManagerImpl.java:230)在com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.getCurrentEditor。 1258)com.intellij.codeInsight上的com.intellij.codeInsight.daemon.impl.DaemonListeners.canUndo(DaemonListeners.java:390)上的com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.getEditors(FileEditorManagerImpl.java:1230) com.intellij.codeInsight.intention.impl.config.QuickFixFactoryImpl.timeToOptimizeImports(QuickFixFactoryImpl.java:741)上的.daemon.impl.DaemonListeners.canChangeFileSilently(DaemonListeners.java:386)(com.intellij.codeInsight.intention.impl.config上的.com.intellij.codeInsight.intention.impl.config.QuickFixFactoryImpl.access $ 000(QuickFixFactoryImpl.java:70).com.intellij.codeInsight.daemon.impl.ShowIntentions处的QuickFixFactoryImpl $ 1.isAvailable(QuickFixFactoryImpl.java:621) com.intellij.codeInsight.daemon.impl.ShowIntentionsPass $ 1.process(ShowIntentionsPass.Pass.addAvailableActionsForGroups(ShowIntentionsPass.java:129)在com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.access $ 000(ShowIntentionsPass.java:69) com.intellij.codeInsight.daemon.impl.ShowIntentionsPass $ 1.process(java:88)在com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl $ 6.process(DaemonCodeAnalyzerImpl.java:545)处com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl $ 6.process(DaemonCodeAnalyzerImpl.java:545) .intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl $ 6.process(DaemonCodeAnalyzerImpl.java:539)位于com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx $ 1.process(DaemonCodeAnalyzerEx.java:59)位于com.intellij.codeInsightdaemon .com.intellij.openapi.editor.impl.IntervalTreeImpl $ IntervalNode.processAliveKeys(IntervalTreeImpl.java:97)处的com.intellij.openapi.editor.impl.IntervalTreeImpl.impl.DaemonCodeAnalyzerEx $ 1.process(DaemonCodeAnalyzerEx.java:53) com.intellij.ope上的processOverlappingWith(IntervalTreeImpl.java:468) com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:476)上的napi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:463)在com.intellij.openapi.editor.impl.IntervalTreeImpl。 com.intellij.openapi.editor.impl.intervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:463)处com.intellij.openapi.editor.impl.IntervalTreeImpl.java的processOverlappingWith(IntervalTreeImpl.java:463)在com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:463)在com.intellij.openapi.editor.impl.IntervalTreeImpl.processOverlappingWith(IntervalTreeImpl.java:440)在com.intellij.openapi.editor com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx.processHighlights(DaemonCodeAnalyzerEx.java:53)上的.impl.MarkupModelImpl.processRangeHighlightersOverlappingWith(MarkupModelImpl.java:264) ighlightsNearOffset(DaemonCodeAnalyzerImpl.java:539)位于com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getAvailableActions(ShowIntentionsPass.java:85)位于com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getActionsToShow(:Intent) com.intellij.codeHighlightingText上com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doCollectInformation(ShowIntentionsPass.java:186)上com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getIntentionActionsToShow(ShowIntentionsPass.java:212)处。 com.intellij.codeInsight.daemon.impl.PassExecutorService $ ScheduledPass $ 1 $ 1.run(PassExecutorService.java:380)处的com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl)的.collectInformation(TextEditorHighlightingPass.java:61) .java:1153)com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgre上的com.intellij.codeInsight.daemon.impl.PassExecutorService $ ScheduledPass $ 1.run(PassExecutorService.java:371) com.intellij.codeInsight.daemon.impl.PassExecutorService $ ScheduledPass.doRun(PassExecutorService $ ScheduledPass.doRun(PassExecutorService.java :)上的ss(ProgressManager.java:java)在com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212) 368)com.intellij.concurrency.JobLauncherImpl $ VoidForkJoinTask.exec(JobLauncherImpl.java:193)上com.intellij.codeInsight.daemon.impl.PassExecutorService $ ScheduledPass.run(PassExecutorService.java:344) (ForkJoinTask.java:260)在jsr166e.ForkJoinPool $ WorkQueue.runTask(ForkJoinPool.java:858)在jsr166e.ForkJoinPool.scan(ForkJoinPool.java:1687)在jsr166e.ForkJoinPool.runWorker(ForkJoinPool)在Java: .ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:109)

错误消息包含看起来与上面非常相似的4个部分。

我到处搜索过,似乎茫然不知所措。 使用此库对于我的项目至关重要,我已经花了十多个小时来尝试自己解决此问题。 非常感谢任何提示或指导。

UPDATE

@Scott的反馈已解决了消失的导入问题,但我似乎仍然无法访问jar中的对象。 在此处输入图片说明

有人知道这是否与jar,gradle或Android Studio有关?

唯一的例外是Android Studio中的错误,实际上是一条红色鲱鱼。 这不是问题的原因。 您已启用首选项 > 编辑器 > 自动导入 >快速优化导入 当您键入该import并按 ,它可以优化导入,因为您尚未使用它。 要么禁用首选项,要么不手动键入import语句-在代码中使用对该类的引用,然后让编辑器帮助为您添加import

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM