Tag: gradle

Android,Gradle,Realm,Kotlin:错误:错误:找不到AndroidManifest.xml文件

Android Studio 2.3.3,Java 8,Kotlin 1.1.3-2 项目的build.gradle: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = ‘1.1.3-2’ repositories { jcenter() } dependencies { classpath ‘com.android.tools.build:gradle:2.3.3’ classpath ‘com.google.gms:google-services:2.0.0-alpha6’ classpath “io.realm:realm-gradle-plugin:3.5.0” classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version” // NOTE: Do not place your application dependencies here; they belong // in the individual module […]

Gradle同步失败:无法findorg.jetbrains.kotlin(无意使用Kotlin)

(在我看来, 这个问题不是重复的) Android Studio中的错误消息: Gradle同步失败:无法findorg.jetbrains.kotlin:kotlin-stdlib:1.1.3-2 我不明白为什么Gradle不会在没有这个库的情况下同步,为什么Kotlin是强制性的。 另外,我还没有尝试或打算安装或使用Kotlin插件。 注意:刚刚在开发者更新频道上升级到最新的Android Canary版本之后就发生了这种情况。 没有问题或任何Kotlin在稳定版本或我的代码本身相关。

如何使用Kotlin DSL配置AppEngine Gradle插件

正如https://cloud.google.com/appengine/docs/standard/java/tools/gradle-reference中所述,AppEngine Gradle插件提供的配置如下所示: appengine { // App Engine tasks configuration run { // local (dev_appserver) configuration (standard environments only) port = 8080 // default } deploy { // deploy configuration stopPreviousVersion = true // default – stop the current version promote = true // default – & make this the current version } } 如何使用build.gradlke.kts这样的配置看起来像? 我正在查看AppEngine任务,但不明白将此连接到适当的Kotlin […]

如何使用kotlin-frontend-plugin设置package.json配置

我想要自动生成的package.json被配置为指向Kotlin生成的JavaScript文件。 这是我目前的gradle配置: apply plugin: ‘kotlin-platform-js’ apply from: “$project.rootDir/gradle/deploy.gradle” dependencies { expectedBy project(“:”) // Compile/implementation dependencies implementation “org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version” } apply plugin: ‘org.jetbrains.kotlin.frontend’ compileKotlin2Js { kotlinOptions.metaInfo = true kotlinOptions.sourceMap = true kotlinOptions.moduleKind = ‘commonjs’ } kotlinFrontend { sourceMaps = true npm { dependency(“kotlin”) replaceVersion(“kotlin-js-library”, “1.1.0”) } define “PRODUCTION”, true webpackBundle { bundleName = “${project.name}” sourceMapEnabled = true […]

Android的 – 如何使用Kotlin在SortTableView中设置ColumnComparator

我正在使用Sortable TableView库创建具有排序function的表结构。 如何使用Kotlin语言设置ColumnComparator ? 我试过这个: tableScheduled.setColumnComparator(0,MyComparator()) 但是我得到这个错误: 错误:(44,36)Out-projectedtypes“SortableTableView !” 禁止使用’public open fun setColumnComparator(p0:Int,p1:Comparator!):在de.codecrafters.tableview.SortableTableView’

包含gradle脚本kotlin文件的IntelliJ自动完成

我试图使用gradle-script-kotlin来自动化一个复杂的构建过程,使用IntelliJ作为编辑器。 按照上一个问题中的建议,一个同事在build.gradle.kts文件中得到了正确的语法高亮显示,但是,由于它的复杂性,我试图使用应用程序将它分成许多小文件例: apply { for (script in otherKotlinScripts) from(“buildscripts/$script.kts”) } 唉,完成似乎实际上工作build.gradle.kts 。 在其他kotlin脚本文件,免费函数和任何我import工作很好,但特定于这个task封闭的事情: task(“foo”) { // intelliJ can’t seem to figure out what the receiver is here, // task itself gets highlighted in red, and its members fail // to complete. } 有没有办法让intellij检测包含文件为gradle脚本?

如何使用Ktor Kotlin / Java应用程序中的gradle构建有效的JAR文件

我一直在试图为我的Kotlin / Java Ktor项目创建一个可执行的JAR。 用我的gradle脚本创建实际的JAR很简单,但无论如何,我不能为我的生活弄清楚如何通过错误消息:“JAR文件:无法find主类路由。主键”。 我的Kotlin主函数位于包路由中名为Main.kt的文件中。 下面是我的gradle文件。 我究竟做错了什么? buildscript { ext.kotlin_version = ‘1.2.21’ ext.ktorVersion = ‘0.9.0’ repositories { mavenCentral() } dependencies { classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version” } } apply plugin: ‘java’ apply plugin: ‘kotlin’ sourceCompatibility = 1.8 compileKotlin { kotlinOptions.jvmTarget = “1.8” } compileTestKotlin { kotlinOptions.jvmTarget = “1.8” } kotlin { experimental { coroutines “enable” } } […]

IntelliJ Idea 2017.3无法启动Kotlin Spring Boot App – @Configuration类可能不是最终的

我能够从IntelliJ 2017.3推出一个春季启动Kotlin应用程序。 在最后一次IntelliJ修复更新后,我无法从IDE启动该应用程序,得到此exception: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: @Configuration class ‘AccessConfig’ may not be final 我可以像往常一样从终端启动它: java -jar xxxx.jar 这是没有任何意义的,因为我在我的Gradle配置中使用必要的Kotlin Spring插件: buildscript { ext { kotlinVersion = ‘1.2.21’ springBootVersion = ‘2.0.0.RC1’ } repositories { mavenCentral() maven { url “https://repo.spring.io/snapshot” } maven { url “https://repo.spring.io/milestone” } jcenter() maven { url “https://plugins.gradle.org/m2/” } } dependencies { classpath(“org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}”) classpath(“org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}”) classpath(“org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}”) […]

将源文件附加到kotlin库项目不会显示在AS中

我想把源代码附加到一个kotlin库项目,看起来我成功了,因为我现在有了源代码jar: https://jitpack.io/com/github/walleth/kethereum/bip44/0.21/ 之前的版本没有出口的来源 – 所以我认为这是成功的。 https://jitpack.io/com/github/walleth/kethereum/bip44/0.20/ 不幸的是,AS不显示来源。 我是这样产生的: allprojects { repositories { jcenter() maven { url ‘https://jitpack.io’ } } apply plugin: “kotlin” apply plugin: “jacoco” apply plugin: “maven” apply plugin: “com.github.ben-manes.versions” dependencies { compile “org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version” testCompile ‘org.assertj:assertj-core:3.8.0’ testCompile ‘junit:junit:4.12’ } task sourcesJar(type: Jar, dependsOn: classes) { classifier = ‘sources’ from sourceSets.main.allSource } task javadocJar(type: Jar, […]

如何在kotlin-android编译之前处理重复的类?

我做了一个图书馆。 它将通过apt在几个库中以不同的方法生成相同的类。 我写了一个gradle插件,通过将一个Transform添加到android build插件的扩展中来合并重复的类。 它在java项目中运行良好,但是在Kotlin项目中,在我的Transform工作之前出现了一个错误,这个错误是由重复的类覆盖导致的,所以生成类错过了许多方法。 我想在kotlin编译之前转换代码。 我怎样才能做到这一点。