Tag: gradle

编译Groovy和Kotlin?

我正在使用Groovy和Kotlin开发一个小型项目,我的Kotlin代码依赖于我的Groovy代码,而不是相反。 但是,Kotlin首先编译我的代码,而不是Groovy,结果,我得到像Unresolved reference: SiteRepository一样的错误Unresolved reference: SiteRepository 任何建议,我可以通过更改构建序列,或Kotlin明确取决于Groovy,或任何其他建议来解决这个问题?

将插件升级到3.0.0时出现Gradle构建错误(manifestOutputFile)

将Gradle插件版本升级到3.0.0( classpath “com.android.tools.build:gradle:3.0.0” )后,如果我尝试清理或生成项目,则会出现以下错误: A problem occurred configuring project ‘:app’. > Manifest Tasks does not support the manifestOutputFile property any more, please use the manifestOutputDirectory instead. For more information, please check https://developer.android.com/studio/build/gradle-plugin-3-0-0- migration.html * Try: Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. […]

无法为org.gradle.api.Projecttypes的项目’core’设置未知属性’transitive’

我正在使用一个旧的gradle版本(1.12)的Java项目。 现在我将gradle升级到更新的版本(4.4),以便能够使用Kotlin。 我已经解决了依赖关系的问题,除了一个名为transitive的属性,在版本1.12上似乎是有效的,一切似乎都没有问题。 这是给我麻烦的一段代码: dependencies { compile project(‘:core’) { transitive = false //Here } // bunch of dependencies below } 任何想法如何得到相同的结果在一个较新版本的Gradle?

Kotlin JS项目的基本Gradle脚本Kotlin文件是什么样的?

我正在尝试使用Kotlin-DSL在Kotlin中编写一个Gradle构建脚本。 到目前为止,我已经看到了关于如何为Java项目完成的例子。 然而,因为我正在Kotlin开发一个React Native应用程序,所以没有任何教程可以用来制作Kotlin / JavaScript项目。 那么为了这个目的,一个基本的 Gradle脚本Kotlin文件是什么样的?

如何在Android Studio 3.1 Canary 3中添加Gradle的Kotlin插件

如何在Android Studio(3.1版Canary 3)中集成Gragle的Kotlin插件? 我已经搜索了网络和这个文档,但没有明确的答案。 我不确定是否必须依靠这个网站和其他网站上的现有答案,因为在Android Studio 3.1 Canary 3中Kotlin集成已经有很多变化。

Kotlin Gradle问题

我创建了一个用Kotlin语言编写的项目的Jar。 Jar包含以下文件夹: com jet kotlin meta-inf okio org 然后我创建了一个android项目,并添加Kotlin和Jar作为依赖项。 当我尝试执行hello world app时,会引发以下exception。 com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/usr/lib/jvm/java-7-openjdk-amd64/bin/java” finished with non-zero exit value 1 我的应用程序构建gradle文件是 apply plugin: ‘com.android.application’ apply plugin: ‘kotlin-android’ android { compileSdkVersion 22 buildToolsVersion “22.0.1” defaultConfig { applicationId “abc.xyz.kotlin” minSdkVersion 15 targetSdkVersion 22 versionCode 1 versionName “1.0” } buildTypes { release { minifyEnabled false […]

Gradle构建中未解决的Kotlin扩展函数的引用

我有用Kotlin编写的所有代码构建多个项目Gradle。 有两个项目:普通和客户端。 子项目在中间文件夹,说“演示”。 所以文件夹结构是: project demo client build.gradle common build.gradle build.gradle gradle.properties settings.gradle settings.gradle: rootProject.name = ‘demo’ include ‘demo/client’ include ‘demo/common’ 客户端依赖于通用项目compile project(“:demo/common”) 。 共同项目中有一个扩展function: fun List<Future>.getAll(): Long { var count = 0L this.forEach { it.get() count++ } return count } 如果我尝试在客户端项目中使用它,我会在编译时得到Unresolved reference: getAllexception。 用法: … import org.sandbox.imdg.hazelcast.common.utils.getAll class CassLoader { fun loadCalcData(): Long { […]

Android,领域,Gradle:错误:注释处理器:找不到RealmProcessor

Android Studio 2.3.3 我的项目bulid.gradle: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = ‘1.1.3’ 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 build.gradle files […]

我怎样才能把一个groovy任务gradle转换成Gradle Kotlin DSL来生成一个pom.xml?

下面的Gradle脚本的build.gradle.kts版本是什么? apply plugin: ‘maven’ apply plugin: ‘java’ sourceCompatibility = 7 targetCompatibility = 7 dependencies { compile ‘com.google.guava:guava:13.0.1’ compile ‘joda-time:joda-time:2.1’ testCompile ‘junit:junit:4.11’ testCompile ‘org.mockito:mockito-core:1.9.5’ } task writeNewPom << { pom { project { groupId 'org.example' artifactId 'test' version '1.0.0' inceptionYear '2008' licenses { license { name 'The Apache Software License, Version 2.0' url 'http://www.apache.org/licenses/LICENSE-2.0.txt' distribution 'repo' […]

由于NoClassDefFoundError而导致的工具测试失败

我从今天开始在调试模式下对我的kotlin应用程序进行多重分解,因为库迫使我这样做。 我的问题是,我的用户界面测试不工作了。 我也正在缩小我的apk。 我收到以下错误: FATAL EXCEPTION: MockWebServer Process: [package], PID: 19446 java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/collections/CollectionsKt; at [package].activity.MockedServerTestsBase$dispatcher$1.dispatch(Unknown Source) at okhttp3.mockwebserver.MockWebServer$3.processOneRequest(Unknown Source) at okhttp3.mockwebserver.MockWebServer$3.processConnection(Unknown Source) at okhttp3.mockwebserver.MockWebServer$3.execute(Unknown Source) at okhttp3.internal.NamedRunnable.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761) Caused by: java.lang.ClassNotFoundException: Didn’t find class “kotlin.collections.CollectionsKt” on path: DexPathList[[zip file “/system/framework/android.test.runner.jar”, zip file “/data/app/[package].test-2/base.apk”, zip file “/data/app/[package]-1/base.apk”],nativeLibraryDirectories=[/data/app/[package].test-2/lib/x86, […]