- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在编译 APK(调试或发布)时遇到问题。
Android Studio 3.0 测试版 5
这是我的build.gradle(应用)
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.my.package"
minSdkVersion 15
targetSdkVersion 26
final MAJOR_RELEASE = 0
final MINOR_RELEASE = 29
versionCode getVersionCodeNumber(MAJOR_RELEASE, MINOR_RELEASE)
versionName getVersionCodeName(MAJOR_RELEASE, MINOR_RELEASE)
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles fileTree(dir: 'proguard', include: ['*.pro']).asList().toArray()
}
signingConfigs {
omitted
}
buildTypes {
release {
debuggable false
minifyEnabled false
shrinkResources false
signingConfig signingConfigs.releaseConfig
}
debug {
debuggable true
minifyEnabled false
shrinkResources false
versionNameSuffix '-DEBUG'
signingConfig signingConfigs.debugConfig
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
javaMaxHeapSize "4g"
}
}
afterEvaluate {
assembleRelease.dependsOn testReleaseUnitTest
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//Testing
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support:support-annotations:26.0.2'
implementation 'com.dadino.quickstart:core:0.3.11'
//Support
implementation 'com.android.support:support-v4:26.0.2'
implementation 'com.android.support:design:26.0.2'
implementation 'com.android.support:recyclerview-v7:26.0.2'
implementation 'com.android.support:palette-v7:26.0.2'
implementation 'com.android.support:cardview-v7:26.0.2'
implementation 'com.android.support:support-v13:26.0.2'
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:customtabs:26.0.2'
//Square
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
//Google
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-vision:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
//Firebase
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-config:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
//Requery
implementation 'io.requery:requery:1.0.1'
implementation 'io.requery:requery-android:1.0.1'
annotationProcessor 'io.requery:requery-processor:1.0.1'
//RxJava
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.0'
implementation 'io.reactivex:rxjava-math:1.0.0'
implementation 'com.artemzin.rxjava:proguard-rules:1.3.0.0'
implementation 'com.jakewharton.rxbinding:rxbinding:1.0.1'
implementation 'com.jakewharton.rxrelay:rxrelay:1.2.0'
implementation 'pl.charmas.android:android-reactive-location:0.10@aar'
//UI
implementation 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
implementation 'com.wdullaer:materialdatetimepicker:3.0.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
transitive = true
}
}
def getVersionCodeName(int major, int minor) {
def versionCodeName = major * 100 + minor
return "${versionCodeName}"
}
def getVersionCodeNumber(int major, int minor) {
def versionCodeName = major * 100 + minor
return versionCodeName
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.2'
}
}
if (requested.group == 'com.google.firebase' || requested.group == 'com.google.android.gms') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '11.2.2'
}
}
}
resolutionStrategy {
force 'com.google.code.gson:gson:2.8.1'
}
}
apply plugin: 'com.google.gms.google-services'
这是我的build.gradle(项目)
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta5'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
maven {
url "http://dl.bintray.com/dadino/quickstart"
}
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我在编译时遇到的错误
Information:Gradle tasks [:app:assembleDebug]
Error:java.lang.ClassNotFoundException: Class io.reactivex.Observable not found
Error:Execution failed for task ':app:transformClassesWithDesugarForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException:
Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar with arguments
{--input /Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/classes/debug --output
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/desugar/debug/0 --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/classes/debug --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/0.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/1.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/2.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/3.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/4.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/5.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/6.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/7.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/8.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/9.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/10.jar --classpath_entry
*all the same to 58.jar*
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/59.jar --bootclasspath_entry
/Users/davidcorsalini/Library/Android/sdk/platforms/android-26/android.jar --bootclasspath_entry
/Users/davidcorsalini/Library/Android/sdk/platforms/android-26/optional/org.apache.http.legacy.jar --bootclasspath_entry
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/resources.jar --bootclasspath_entry
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/rt.jar --bootclasspath_entry
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jsse.jar --bootclasspath_entry
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jce.jar --bootclasspath_entry
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/charsets.jar --min_sdk_version 15 --desugar_try_with_resources_if_needed --desugar_try_with_resources_omit_runtime_classes}
Information:BUILD FAILED in 2s
Information:2 errors
Information:0 warnings
Information:See complete output in console
我已经搜索并阅读了所有关于 desugar
错误的页面,但我找不到我的项目有什么问题。我也不明白为什么他在寻找 io.reactivex.Observable
有时是 io.reactivex.Flowable
,而我正在使用 RxJava1
,而不是 RxJava2
。
最佳答案
在 gradle.properties 文件中添加 android.enableD8.desugaring = true
。
关于android - transformClassesWithDesugarForDebug 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46201268/
我在编译 APK(调试或发布)时遇到问题。 Android Studio 3.0 测试版 5 这是我的build.gradle(应用) buildscript { repositories {
自从升级到 Android Studio 3.0,现在升级到 3.0.1,transformClassesWithDexForDebug 现在变成了 transformClassesWithDesug
我正在尝试将自定义库导入新创建的项目,但是当我尝试构建它时出现下一个错误: Exception in thread "main" java.lang.TypeNotPresentException:
我正在为我的移动应用程序使用 ionic。当我使用 ionic cordova build android 出现以下错误: * What went wrong: Execution failed fo
Gradle 构建因以下应用程序的 build.gradle 配置而失败: android{ compileSdkVersion 26 buildToolsVersion "26.0.2"
我刚刚将cordova android更新至7.1.0以支持android 27 sdk,以解决插件无法与sdk 26一起使用的问题。 我尝试更改GradleBuilder.js文件中的gradle分
我的应用程序需要实现 Excel 创建和下载。我使用 Apache POI 的 HSSFWorkbook 来实现该功能。应用程序成功创建了所需的 Excel (xls) 输出。 但是,如果我在 gra
我无法在 android studio 3.0.1(稳定版)中运行该应用程序。之前在 android 2.3.2 版本中它很好,但在这个版本的 android studio 中遇到了这个问题。 正如我
我已将我的项目从 Android Studio 2.3.3 迁移到 Android Studio 3.0 Beta 2,现在我的项目将无法运行。 我在控制台中收到以下消息: 错误:任务“:app:tr
将项目迁移到 'com.android.tools.build:gradle:3.0.1'。从那以后我就一直从 gradle 得到这个错误 Exception in thread "main" jav
我是一名优秀的程序员,十分优秀!