Tag: IntelliJ

Dagger2错误:Kotlin:未解决的参考:DaggerSOMETHINGComponent

源代码 我正在构建一个半年前在macOS上运行良好的Kotlin和Dagger2的gradle项目: GitHub的:科特林-Tutorials13 你可以得到它 git clone https://github.com/enbandari/Kotlin-Tutorials.git cd Kotlin-Tutorials/code/Kt13 你可以在IntelliJ IDEA中打开它 建筑环境 我的建筑环境如下: IntelliJ IDEA 2017.1.3 JRE:1.8.0_112-release-736-b21 amd64 JVM:由JetBrains sro提供的OpenJDK 64位服务器虚拟机 Windows 10 10.0 建设成果 它调出一个错误: C:\Users\xiang\IdeaProjects\Kotlin-Tutorials-master\code\Kt13\src\main\kotlin\net\println\kt13\Service.kt Error:(3, 25) Kotlin: Unresolved reference: DaggerRESTFulComponent Error:(19, 9) Kotlin: Unresolved reference: DaggerRESTFulComponent 反编译 所以,我反编译RESTFulComponent.class 它的源文件是RESTFulComponent.kt package net.println.kt13 import dagger.Component import net.println.kt13.module.RetrofitModule import retrofit2.Retrofit import javax.inject.Singleton /** * Created […]

Kotlin inline关键字导致IntelliJ IDEA覆盖率报告0%

我创建了一个非常简单的测试函数如下 class SimpleClassTest { lateinit var simpleObject: SimpleClass @Mock lateinit var injectedObject: InjectedClass @Before fun setUp() { MockitoAnnotations.initMocks(this) } @Test fun testSimpleFunction() { simpleObject = lookupInstance() } inline fun lookupInstance() = SimpleClass(injectedObject) } 我用Coverage运行它…测试覆盖率是0%。 但是,如果我删除inline关键字,测试范围编号现在显示。 这是一个Kotlin问题或Android IntelliJ IDEA覆盖问题? (注意:JaCoco覆盖率很好)。 注意:我正在使用Android Studio 2.0和Kotlin 1.0.2

IntellJ IDEA Kotlin插件 – “没有可用的配置器”

我在使用IntelliJ IDEA中的Kotlin插件时遇到了问题。 首先,在打开kotlin项目时,弹出需要在此项目中配置Kotlin。 但是当我从“工具”菜单中这样做时,它会显示“没有可用的配置程序”

Kotlin链接收集功能的表现

我是Kotlin的新手,通过使用IDE提供的技巧解决IntelliJ中的简单难题,我正在学习语言。 我写了这段代码(查找最重复的数字): fun main(args: Array<String>) { val tracer = mutableMapOf<Int,Int>() var currentMaxCount = 0 val numbers = readLine()!!.split(' ').map(String :: toInt) for(number in numbers) { val currentCountOfNum = incrementAndGetCurrentCountOf(number, tracer) currentMaxCount = if(currentCountOfNum > currentMaxCount) currentCountOfNum else currentMaxCount } println(currentMaxCount) } fun incrementAndGetCurrentCountOf(num : Int, tracer: MutableMap<Int,Int>) = if(tracer[num] == null) { tracer.put(num, 1) 1 […]

与Kotlin一起使用JavaCV

我目前正在尝试在Kotlin中使用JavaCV开始一个项目。 我使用IntelliJ Idea作为我的IDE。 我正在使用JavaCV 1.3.2和OpenCV 3.20。 这是我为OpenCV模块的依赖设置: 和JavaCV: 我有opencv之前javacv依赖。 为了测试OpenCV的存在和有效性,我写了下面的测试。 因为我可以loadLibrary和版本号显示正确,我可以假设OpenCV实际上工作。 import org.opencv.core.Core import org.opencv.core.Mat import org.opencv.core.CvType import org.opencv.core.Scalar import org.bytedeco.javacv.OpenCVFrameGrabber fun main(args : Array<String>) { println("Test Built Successfully") System.loadLibrary(Core.NATIVE_LIBRARY_NAME) println("Running OpenCV Version ${Core.VERSION}") val grabber = OpenCVFrameGrabber(1) } 我们初始化grabber rasies的路线有以下例外: Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path Caused by: java.lang.UnsatisfiedLinkError: no opencv_imgproc320 […]

键入“对象”后Kotlin完成对话框弹出。

我开始使用Kotlin编写测试,来自Java我习惯于在输入“。”时完成对话框。 之后的一个对象。 喜欢这个: 用Kotlin做同样的事情是这样做的: 即使按Ctrl +空格不起作用: 当我开始输入我知道存在的函数的前几个字母时,我才开始得到建议。 例: 有谁知道如何让Kotlin自动完成像Java一样的工作? 我正在使用Oracle Java 8在Ubuntu Linux上使用以下版本的IntelliJ IDEA。

Kotlin REPL与Android类unStub!编辑

我喜欢Idea / Android-Studio中的Kotlin REPL,但作为一名Android开发者,我经常遇到Stub! 问题在这里。 在编写单元测试时,我正在使用unmock来解决这个问题。 有没有一种方法可以使用Kotlin REPL插件的相同方法? [

在java项目中运行kotlin代码

我想在一个Java项目中运行glm ,但我不断得到: Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics at main.vec._2.Vec2.<init>(Vec2.kt) at main.vec._2.Vec2.<init>(Vec2.kt:23) at test.Main.main(Main.java:19) Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 手动添加kotlin-reflect.jar和kotlin-runtime.jar解决了错误,但我更喜欢有一个单一的jar导入。 这是我如何构建神器: 这是内容: 我究竟做错了什么? Intellij 2016.3.1 Kotlin 1.1m03

Kotlin字节码 – 如何在IntelliJ IDEA中分析?

我是Kotlin的新手,我希望能够查看编译的字节码,以便了解更多关于它如何工作的信息。 我正在使用IntelliJ IDEA 15,但找不到查看字节码的好方法。 我错过了什么?

Android + Kotlin – 项目不再建设

您好kotlin用户和维护者, 由于我已经将Intellij IDEA更新到2016版的最新补丁,所以在尝试编译我的android项目时遇到了这个问题。 java.lang.IllegalStateException at org.jetbrains.kotlin.types.SubstitutionUtils.fillInDeepSubstitutor(SubstitutionUtils.java:80) at org.jetbrains.kotlin.types.SubstitutionUtils.fillInDeepSubstitutor(SubstitutionUtils.java:96) at org.jetbrains.kotlin.types.SubstitutionUtils.buildDeepSubstitutionMultimap(SubstitutionUtils.java:65) at org.jetbrains.kotlin.resolve.DeclarationsChecker.checkSupertypesForConsistency(DeclarationsChecker.kt:241) at org.jetbrains.kotlin.resolve.DeclarationsChecker.checkTypeParameterConstraints(DeclarationsChecker.kt:394) at org.jetbrains.kotlin.resolve.DeclarationsChecker.checkFunction(DeclarationsChecker.kt:660) at org.jetbrains.kotlin.resolve.DeclarationsChecker.process(DeclarationsChecker.kt:123) at org.jetbrains.kotlin.resolve.BodyResolver.resolveBodies(BodyResolver.java:233) at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations(LazyTopDownAnalyzer.kt:192) at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzerForTopLevel.analyzeDeclarations(LazyTopDownAnalyzerForTopLevel.java:74) at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzerForTopLevel.analyzeFiles(LazyTopDownAnalyzerForTopLevel.java:66) at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.java:145) at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegrationWithCustomContext(TopDownAnalyzerFacadeForJVM.java:78) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.analyze(KotlinToJVMBytecodeCompiler.kt:290) at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:129) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:283) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyzeAndGenerate(KotlinToJVMBytecodeCompiler.kt:269) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileBunchOfSources(KotlinToJVMBytecodeCompiler.kt:194) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:196) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:49) at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:181) at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.callCompiler(Tasks.kt:87) at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.compile(Tasks.kt:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) […]