当我尝试将 Twitter 套件集成到我的项目中时,无法使用最新版本的 android studio 3.2 canary 运行该项目。
下面是 Gradle 构建文件。
build.gradle(模块:应用程序)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.rrr.xxx"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
/**
* Twitter dependencies
*/
implementation('com.twitter.sdk.android:twitter:+@aar') {
transitive = true
}
}
错误:
gradle 控制台中出现错误消息。
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /home/user/.gradle/caches/transforms-1/files-1.1/tweet-composer-3.2.0.aar/fa1e13c6247ce33b4da03df71a7b3606/jars/classes.jar
从构建控制台记录:
以下是构建控制台消息。
build failed 4s 335ms
Run build 4s 267ms
Load build 2ms
Configure build 116ms
Calculate task graph 21ms
Run tasks 4s 123ms
null
com.android.builder.dexing.DexArchiveBuilderException: Failed to process /home/user/.gradle/caches/transforms-1/files-1.1/tweet-composer-3.2.0.aar/fa1e13c6247ce33b4da03df71a7b3606/jars/classes.jar
com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
com.android.tools.r8.CompilationFailedException: Compilation failed to complete
com.android.tools.r8.utils.AbortException
null
Invoke-customs are only supported starting with Android O (--min-api 26)
最佳答案
该库似乎已迁移到 Java 8,请尝试在 build.gradle 中启用 Java 8 语言。
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
关于android - 无法使用 Android Studio 3.1/3.2 Canary 将 twitter-kit-android 集成到我的应用程序中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49626100/