我刚从Canary频道安装了AS 3.0,通过从gradle中删除lambda插件并添加了flavorDimensions来添加
Java 8迁移,这就发生了! :
Error:java.lang.ClassNotFoundException: Class rx.Observable not foundError:Execution failed for task ‘:app:transformClassesWithDesugarForMockDebug’.
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 C:\Users\aloua\StudioProjects\Android-app\app\build\intermediates\classes\mock\debug –output C:\Users\aloua\StudioProjects\Android-app\app\build\intermediates\transforms\desugar\mock\debug\66 –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\realm-android-library-3.1.3.aar\3a04a9460f65e9c7adc9fec0b293596b\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\io.realm\realm-annotations\3.1.3\b4ecd87169faeee5abfb6c4793713cc1a14b1c25\realm-annotations-3.1.3.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\relinker-1.2.2.aar\c529baaf39a0040a46d0144283003ac7\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\cardview-v7-25.3.1.aar\608b30c5911dfbe767d466ea52dbc4cf\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\materialsearchview-1.4.0.aar\772ec339f058d58490b3f76f26e1a063\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\org.parceler\parceler-api\1.1.6\2a06b6b1ecf5dadee8a874dfb51ad018fde3e6c5\parceler-api-1.1.6.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\fresco-1.3.0.aar\107689f0e7d0c930711e69c11d5380fb\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\drawee-1.3.0.aar\7e4b5d94b102451de14154fa2b6cbb63\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\imagepipeline-1.3.0.aar\acb7e3fa37de5d2805c481dff1f2a767\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\imagepipeline-base-1.3.0.aar\cb00a7f90c4bb43ca29421300396dbed\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.parse.bolts\bolts-tasks\1.4.0\d85884acf6810a3bbbecb587f239005cbc846dc4\bolts-tasks-1.4.0.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\fbcore-1.3.0.aar\a169237b2b603f40b5cc7559b7a31bc3\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\com.amulyakhare.textdrawable-1.0.1.aar\96e46415620ff0fa2bfb3c78fd979563\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\ShimmerRecyclerView-v1.0.aar\4d8b45ee77f1b1f45cc5fade7d6c8544\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\play-services-auth-10.2.1.aar\d0689f87cee19fac261f377f0e7a1c62\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\play-services-auth-base-10.2.1.aar\9ca0ac3d8ab7534bffa1d6bc25165359\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\play-services-base-10.2.1.aar\23b5fcb4d98aa5e5499b36a97ce12d5b\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\timber-4.5.1.aar\1dfd702c738fe97f2f60269b59529732\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\butterknife-8.5.1.aar\8a0abdfe1e73e4c945e1893831a0099e\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.jakewharton\butterknife-annotations\8.5.1\bb67dad90bab7cd77a8f7f1b8442b47e3a2326bc\butterknife-annotations-8.5.1.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\bottom-bar-2.3.1.aar\27503b845f262ddc7a8390675c172429\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\design-25.3.1.aar\d9003afb246775ad7f3227f26dbd2c50\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\fa8444aaec30851036772ada99ae587b\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\transition-25.3.1.aar\a1caf2c053ce72f2c1cc2a38b446a266\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\constraint-layout-1.0.2.aar\53b9e5576ca52201ba6284537b7411fe\jars\classes.jar –classpath_entry C:\Users\aloua\AppData\Local\Android\Sdk\extras\m2repository\com\android\support\constraint\constraint-layout-solver\1.0.2\constraint-layout-solver-1.0.2.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.google.dagger\dagger\2.10\72b1eae80561b66f0a24b300ab0dfafde959eb58\dagger-2.10.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\javax.inject\javax.inject\1\6975da39a7040257bd51d21a231b76c915872d38\javax.inject-1.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\stetho_realm-2.0.0.aar\b984f2308cf31bf2a0edd04ba052d20a\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.squareup.okhttp3\okhttp\3.7.0\6edbebdd8868708db718d15c09c4b28037fd487e\okhttp-3.7.0.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\fab-1.6.4.aar\4e0107f50e09eecac59a6d385fc8d9fd\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\core-0.9.4.4.aar\b724059b42a075af0ae365f10467793c\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\support-v13-25.3.1.aar\d832960f24588717e20cf14002ce81ae\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\recyclerview-v7-25.3.1.aar\20c34e2f84f5277f609ec66bdebca6f4\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\library-1.4.0.aar\4d27304516edb2425e1bb624ef8fcfcb\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\animated-vector-drawable-25.3.1.aar\21fb8dba0ac7495d6c2422ee86d3b683\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\support-vector-drawable-25.3.1.aar\b97d09f91d992d9796009835d49ad0b8\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\switch-button-0.0.3.aar\fc661d74aaaaf6a213c7486e17034203\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\BaseRecyclerViewAdapterHelper-2.9.14.aar\7a37e0cceef2c2917ee6ca492125b32a\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.squareup.okhttp3\logging-interceptor\3.6.0\81887458b69ddc32722df7e4c35235fd74e6a8ba\logging-interceptor-3.6.0.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.squareup.okhttp3\okhttp-urlconnection\3.4.1\63994437f62bc861bc20c605d12962f7246116d1\okhttp-urlconnection-3.4.1.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.squareup.retrofit2\retrofit\2.2.0\41e67dba73c3347e4503761642c39d0e06ca1f2\retrofit-2.2.0.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.squareup.retrofit2\converter-gson\2.2.0\a09926806199499a20b2f5168779499abfa33342\converter-gson-2.2.0.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.google.code.gson\gson\2.7\751f548c85fa49f330cecbb1875893f971b33c4e\gson-2.7.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.squareup.retrofit2\adapter-rxjava2\2.2.0\3ee0e527143abbe130ddba4c1fa6c4be5d66ed5c\adapter-rxjava2-2.2.0.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.squareup.okio\okio\1.12.0\3742beff8024d0a0073d284b7c5e4cbf73d99b25\okio-1.12.0.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\io.reactivex.rxjava2\rxjava\2.1.0\2fdf84dedcaaeabb9d70cde9dbb8aad4eccb80a1\rxjava-2.1.0.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\rxandroid-2.0.1.aar\7346ca39f4859f61fe88ce103bf22c71\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\org.reactivestreams\reactive-streams\1.0.0\14b8c877d98005ba3941c9257cfe09f6ed0e0d74\reactive-streams-1.0.0.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\firebase-core-10.2.1.aar\8f411a56c2b0443545d20916019187da\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\firebase-analytics-10.2.1.aar\96e2cbac4d4d4997dc9d9d69b0b3a3bb\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\firebase-analytics-impl-10.2.1.aar\37f464c76ea7fd568ad310975744ccb8\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\firebase-iid-10.2.1.aar\1d69f273f02df02573752d82758b8bf5\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\firebase-common-10.2.1.aar\d0fa340f22819dd7cab540a77ab999c6\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\play-services-tasks-10.2.1.aar\5055e34ab40570155aa284f9d9f36ae4\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\play-services-basement-10.2.1.aar\ca2ff208a30aa024376a6d8d0a9752fa\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\support-v4-25.3.1.aar\f313fd53777e842a7357a2b71a172088\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\support-fragment-25.3.1.aar\1d0873f399e417d0d1e226d4165b0fac\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\support-media-compat-25.3.1.aar\d805adb7eeb8801409f04c3860693be3\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\support-core-ui-25.3.1.aar\cb5255ae27edc1c3ead0357980c8de67\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\support-core-utils-25.3.1.aar\dc3f5197938f4fe1916d4d4264da9dbb\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\support-compat-25.3.1.aar\a52ea2edbf7430962147eae85e0ef919\jars\classes.jar –classpath_entry C:\Users\aloua\AppData\Local\Android\Sdk\extras\android\m2repository\com\android\support\support-annotations\25.3.1\support-annotations-25.3.1.jar –classpath_entry C:\Users\aloua.gradle\caches\transforms-1\files-1.1\stetho-1.5.0.aar\5c385a73f16724a342ad1f92d6fcc01e\jars\classes.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\commons-cli\commons-cli\1.2\2bf96b7aa8b611c177d329452af1dc933e14501c\commons-cli-1.2.jar –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\2.0.1\516c03b21d50a644d538de0f0369c620989cd8f0\jsr305-2.0.1.jar –classpath_entry C:\Users\aloua\StudioProjects\Android-app\app\build\intermediates\classes\mock\debug –classpath_entry C:\Users\aloua.gradle\caches\modules-2\files-2.1\javax.annotation\jsr250-api\1.0\5025422767732a1ab45d93abfea846513d742dcf\jsr250-api-1.0.jar –classpath_entry C:\Users\aloua\AppData\Local\Android\Sdk\platforms\android-25\android.jar –classpath_entry C:\Users\aloua\AppData\Local\Android\Sdk\platforms\android-25\optional\org.apache.http.legacy.jar –bootclasspath_entry C:\Users\aloua\android-studio\jre\jre\lib\resources.jar –bootclasspath_entry C:\Users\aloua\android-studio\jre\jre\lib\rt.jar –bootclasspath_entry C:\Users\aloua\android-studio\jre\jre\lib\jsse.jar –bootclasspath_entry C:\Users\aloua\android-studio\jre\jre\lib\jce.jar –bootclasspath_entry C:\Users\aloua\android-studio\jre\jre\lib\charsets.jar –min_sdk_version 15 –desugar_try_with_resources_if_needed –desugar_try_with_resources_omit_runtime_classes}
我的gradle文件:
flavorDimensions "environment"
productFlavors {
mock {
dimension "environment"
applicationIdSuffix = ".mock"
}
prod {
dimension "environment"
applicationIdSuffix = ".prod"
}
}
// Remove mockRelease
android.variantFilter { variant ->
if (variant.buildType.name == 'release' && variant.getFlavors().get(0).name == 'mock') {
variant.setIgnore(true);
}
}
// Always show the result of every unit test, even if it passes.
testOptions.unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
packagingOptions {
// Remove unneeded Realm native libs
exclude 'lib/mips/librealm-jni.so'
exclude 'lib/x86_64/librealm-jni.so'
}
}
最佳答案 虽然我使用的是RxJava 2,但为了解决这个问题,我不得不这样做:
创建一个如下所示的空虚拟文件:
package rx;
public class Observable {
}