任务': app: mergeDebugJavaResources'执行失败。
无法解析配置“:app:debugRuntimeClasspath”的所有文件。未能转换工件的kotlin android扩展。jar(org.jetbrains.kotlin:kotlin android extensions:1.3.71)来匹配属性{artifactType=android java res,org.gradle.libraryelements=jar,org.gradle.usage=java runtime}。执行JetifyTransform失败:C:\Users\user。gradle\caches\modules-2\files-2.1\org。喷气式飞机。kotlin\kotlin android extensions\1.3.71\ea43e0e563e1915ea845a482fd6f31a948386ab9\kotlin-android-extensions-1.3.71。罐子转换“C:\Users\user”失败。gradle\caches\modules-2\files-2.1\org。喷气式飞机。kotlin\kotlin android extensions\1.3.71\ea43e0e563e1915ea845a482fd6f31a948386ab9\kotlin-android-extensions-1.3.71。用果冻罐。原因:给定的工件包含一个带有包引用“android”的字符串文本。支持无法安全重写的v4。需要手动更新使用反射(如注释处理器)的库,以添加对androidx的支持。。
应用程序构建。格拉德尔
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.appname"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
//to avoid retrofit client error
compileOptions {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}
androidExtensions {
experimental = true
}
dependencies {
ext.kotlin_version = '1.3.71'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
implementation 'com.google.firebase:firebase-auth:19.1.0'
def lifecycle_version = '2.2.0'
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
// Optional : Kotlin extension (https://d.android.com/kotlin/ktx)
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation 'androidx.core:core-ktx:1.2.0'
def appcompat_version = "1.1.0"
implementation "androidx.appcompat:appcompat:$appcompat_version"
// For loading and tinting drawables on older versions of the platform
implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation 'com.google.android.gms:play-services-maps:17.0.0'
//GIF
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
ext {
retrofit_version = '2.8.1'
}
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation 'io.reactivex.rxjava2:rxjava:2.2.19'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation("io.reactivex.rxjava2:rxkotlin:2.4.0")
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
implementation 'com.github.bumptech.glide:glide:4.11.0'
// Skip this if you don't want to use integration libraries or configure Glide.
kapt 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
def room_version = "2.2.5"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version" // For Kotlin use kapt instead of annotationProcessor
// optional - Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:$room_version"
// optional - RxJava support for Room
implementation "androidx.room:room-rxjava2:$room_version"
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
格雷德尔。属性
org.gradle.jvmargs=-Xmx1536m
org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
kotlin.caching.enabled=false
项目gradle.build
buildscript {
ext.kotlin_version = '1.3.71'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
改变了gradle.properties
org.gradle.jvmargs=-Xmx1536m
org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=false
项目建设。格拉德尔
buildscript {
ext.kotlin_version = '1.3.71'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
还有《图片报》。格拉德尔
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.appname"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
//to avoid retrofit client error
compileOptions {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}
androidExtensions {
experimental = true
}
dependencies {
ext.kotlin_version = '1.3.71'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "androidx.annotation:annotation:1.1.0"
// To use the Java-compatible @Experimental API annotation
implementation "androidx.annotation:annotation-experimental:1.0.0"
def appcompat_version = "1.1.0"
implementation "androidx.appcompat:appcompat:$appcompat_version"
// For loading and tinting drawables on older versions of the platform
implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation 'com.google.android.gms:play-services-maps:17.0.0'
//GIF
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
ext {
retrofit_version = '2.8.1'
}
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation 'io.reactivex.rxjava2:rxjava:2.2.19'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation("io.reactivex.rxjava2:rxkotlin:2.4.0")
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
def room_version = "2.2.5"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
实际上,kotlin android extensions
是一个Gradle插件,而不是代码依赖项。
试着移除
implementation files('jetifier-processor-1.0.0-beta09')
implementation files('jetifier-core-1.0.0-beta09')
而是将这些行添加到文件gradle中。属性
:
android.useAndroidX=true
android.enableJetifier=true
并在尝试构建之前清空目录C:\用户\user.gradle\缓存
。
对我来说,去掉线
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
来自应用程序构建。格雷德尔解决了这个问题。“Kotlin Android Extension”功能似乎只通过在项目构建中添加classpath“org.jetbrains.Kotlin:Kotlin gradle插件:$Kotlin_version“
”来实现。gradle和应用插件:“kotlin android extensions”
。
以下是一个相关的问题(但还没有答案):
无法转换工件的kotlin-android-extensions.jar
如果你还记得,现在项目已经准备好去使用Kotlin Android Extensions。当我们创建这个项目,我们就已经在build.gradle中增加了这个依赖: buldscript{ repositories { jcenter() } dependencies { classpath "org.jetbrains.kotlin:kot
任何人都可以对此提供帮助: 我正在android Studio 3.5.2中编译一个android应用程序(sdk中的所有内容都是最新的)并获得以下链接到应用程序的错误:javaPreCompileDebug: 错误消息是 如果有人能破译,我在下面附加了一个完整的堆栈跟踪。使用Jetifier转换com.android.tools/common/26.4.2/71f8d5ea1ddb6bfe3fb
另一个Kotlin团队研发的可以让开发更简单的插件是Kotlin Android Extensions。当前仅仅包括了view的绑定。这个插件自动创建了很多的属性来让我们直接访问XML中的view。这种方式不需要你在开始使用之前明确地从布局中去找到这些views。 这些属性的名字就是来自对应view的id,所以我们取id的时候要十分小心,因为它们将会是我们类中非常重要的一部分。这些属性的类型也是来
所以,我试图建立一个报告。某些特定类型的用户的详细信息需要写在excel文件中。在到达endpoint时,它返回500,并使用以下StackTrace。 我希望将此模型用户配置文件的一些细节写入excel表中,并使其可供下载。你觉得我怎么解决这个问题。主要的错误来自这几行,特别是粗体字的那行
我知道Kotlin的Android扩展创建了合成属性+缓存功能,以取代调用: https://stackoverflow.com/a/46482618/1650674 https://www.raywenderlich.com/84-kotlin-android-extensions https://antonioleiva.com/kotlin-android-extensions/ 所有这些示
我是Java的新手,尤其是Java的面向对象编程,我一直收到这个让我发疯的错误。 以下是我的员工超类的一部分: 以及子类CommissionEmployee: 我得到的相同错误是: 这到底是什么意思,是什么原因导致的,我如何修复它?