Tag: build.gradle

什么是Kotlin中的generateStubs配置?

什么是Kotlin的generateStubs ? 这是我在build.gradle配置。 我在这里的公共文档中找不到它: http : //kotlinlang.org/docs/reference/kapt.html kapt { generateStubs = true } 如果我在我的项目中使用Java和Kotlin(1.2) ,仍然需要添加?

Gradle Kotlin DSL:在独特的地方定义Kotlin版本

为了描述Gradle构建脚本,我们可以通过build.gradle.kts文件使用Kotlin。 全局定义要使用的 Kotlin版本是一个常见的问题,无论是在dependencies还是在构建plugin部分。 考虑下面的代码(Gradle 4.3.1): plugins { var pluginVersion = “1.2.0” kotlin(“jvm”).version(kotlinVersion) // more } var dependencyVersion = “1.2.0” dependencies { compile(kotlin(“stdlib”, kotlinVersion)) compile(kotlin(“reflect”, kotlinVersion)) testCompile(kotlin(“test”, kotlinVersion)) // more } 正如你所看到的,kotlin version (在这种情况下是1.2.0)被定义了两次 : dependencyVersion和pluginVersion ,通常不会有区别 。 由于DSL限制,无法从plugins块外部访问pluginVersion ,也无法从plugins块内访问dependencyVersion 。 如何将版本字符串”1.2.0″提取到一个地方?

无法解析:com.google.firebase:firebase-auth:11.0.2

我只是更新SDK,谷歌播放服务和谷歌存储库,但仍然发生这种错误。 请帮助,我想要使用电话号码进行身份验证。 SDK管理器 logcat的 Build.gradle模块:Project // Top-level build file where you can add configuration options common to all sub-projects/module return buildscript { ext.kotlin_version = '1.1.3-2' repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:3.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files […]

无法解析:用于电话号码身份验证的com.google.firebase:firebase-auth:11.0.2

我更新了我的SDK,谷歌播放服务和谷歌存储库,但仍然发生这种错误。 请帮忙,我想要使用在firebase-auth:11.0.0中引入的电话号码进行身份验证,当降级到firebase-auth:10.0.0时,一切正常。 应用程序级别:Build.Gradle // Top-level build file where you can add configuration options common to all sub-projects/module return buildscript { ext.kotlin_version = '1.1.3-2' repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:3.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } […]

'com.android.tools.build:gradle:3.0.0-alpha3'和'com.android.tools.build:gradle:3.0.0-alpha1'有什么区别?

我正在尝试更新最新的gradle android插件。 我最初尝试了“3.0.0-alpha1”,现在我正在使用“3.0.0-alpha3”。 用'3.0.0-alpha1'版本,我得到一个错误“未找到”,之后,我切换到“3.0.0-alpha3”,与我得到下面的错误。 错误: – 不再支持“getMainOutputFile”。 如果您需要确定输出的文件名,请使用getOutputFileName。 我也修正了这个错误。 但是,我只是想“3.0.0-alpha1”和“3.0.0-alpha3”之间的区别是什么,在此先感谢。

Gradle中的实现和编译有什么区别?

更新到android studio 3.0并创建一个新的项目后,我注意到,在build.gradle有一个新的方法来添加新的依赖关系,而不是compile有implementation 而不是testCompile有testImplementation 例如: implementation 'com.android.support:appcompat-v7:25.0.0' testImplementation 'junit:junit:4.12' 代替 compile 'com.android.support:appcompat-v7:25.0.0' testCompile 'junit:junit:4.12' 他们之间有什么区别,我应该使用什么。

在多项目设置中ConfigurationsContainer为空

我的Android项目中有一个多项目设置: – android – app – lib1 – util 在util我定义了一个配置: task createTestJar(type: Jar) { classifier = 'test' from "$projectDir/build/intermediates/classes/test/debug" } configurations { archives archives.transitive = true } artifacts { archives createTestJar } 我试图在lib1引用它: // doesn't work testCompile project(path: ':util', configuration: 'archives') 我得到这个错误的上述行: 错误:com.android.builder.dependency.level2.JavaDependency无法转换为com.android.builder.dependency.level2.AndroidDependency这个意外错误的可能原因包括: Gradle的依赖关系缓存可能已损坏(有时发生在网络连接超时之后)。重新下载依赖项并同步项目(需要网络) Gradle构建过程(守护进程)的状态可能已损坏。 停止所有的Gradle守护进程可能会解决这个问题。 停止Gradle构建过程(需要重新启动) – 您的项目可能使用与项目中的其他插件或项目请求的Gradle版本不兼容的第三方插件。 在损坏的Gradle进程的情况下,您也可以尝试关闭IDE,然后杀死所有的Java进程。 // says can't find 'archives' […]

转换字节码时出错 – DexException – Firebase身份验证

我刚刚尝试了Firebase身份验证用户界面。 但是在运行DexException项目的时候出来了。 我已阅读Firebase Github中提供的所有自述文件,但找不到解决方案。 我很困惑我是否错过了什么。 添加了渐变和错误日志。 我的应用程序gradle如下: apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 25 buildToolsVersion "26.0.0" defaultConfig { applicationId "com.writein.results" minSdkVersion 21 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } packagingOptions { exclude 'META-INF/LICENSE' exclude […]

Android Studio 3.0 beta2

当我建立我的项目时,我得到了以下错误: 错误:com.android.builder.merge.DuplicateRelativeFileException:发现多个文件与操作系统无关的路径“META-INF / app_debug.kotlin_module” 这里是我的build.gradle文件 buildscript { repositories { maven { url 'https://maven.fabric.io/public' } google() } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 buildToolsVersion "26.0.1" defaultConfig { applicationId "com.e9innovation.infrastructure" multiDexEnabled true minSdkVersion 19 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner […]

在Android Studio 3.0 Canary中,Gradle Sync失败

这是我的build.gradle(Project: MyProjectName)文件: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = "1.1.1" ext.supportLibVersion = "25.3.0" repositories { jcenter() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" classpath 'com.android.tools.build:gradle:3.0.0-alpha5' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } […]