我有一个由多个模块组成的应用程序,我刚刚从 rxjava1 更新到 rxjava2。现在无法在 android 10 设备或模拟器上安装它。在编译时,没有错误,但从 android studio 或命令行安装失败。这是我的一些设置:
compileSdkVersion = 25
buildToolsVersion = "25.0.1"
minSdkVersion = 10
targetSdkVersion = 21
跑步 ./gradlew app:dependencies
compile - Classpath for compiling the main sources.
+--- com.android.support:appcompat-v7:25.3.1
| +--- com.android.support:support-annotations:25.3.1
| +--- com.android.support:support-v4:25.3.1
| | +--- com.android.support:support-compat:25.3.1
| | | \--- com.android.support:support-annotations:25.3.1
| | +--- com.android.support:support-media-compat:25.3.1
| | | +--- com.android.support:support-annotations:25.3.1
| | | \--- com.android.support:support-compat:25.3.1 (*)
| | +--- com.android.support:support-core-utils:25.3.1
| | | +--- com.android.support:support-annotations:25.3.1
| | | \--- com.android.support:support-compat:25.3.1 (*)
| | +--- com.android.support:support-core-ui:25.3.1
| | | +--- com.android.support:support-annotations:25.3.1
| | | \--- com.android.support:support-compat:25.3.1 (*)
| | \--- com.android.support:support-fragment:25.3.1
| | +--- com.android.support:support-compat:25.3.1 (*)
| | +--- com.android.support:support-media-compat:25.3.1 (*)
| | +--- com.android.support:support-core-ui:25.3.1 (*)
| | \--- com.android.support:support-core-utils:25.3.1 (*)
| +--- com.android.support:support-vector-drawable:25.3.1
| | +--- com.android.support:support-annotations:25.3.1
| | \--- com.android.support:support-compat:25.3.1 (*)
| \--- com.android.support:animated-vector-drawable:25.3.1
| \--- com.android.support:support-vector-drawable:25.3.1 (*)
+--- com.android.support:recyclerview-v7:25.3.1
| +--- com.android.support:support-annotations:25.3.1
| +--- com.android.support:support-compat:25.3.1 (*)
| \--- com.android.support:support-core-ui:25.3.1 (*)
+--- com.android.support:design:25.3.1
| +--- com.android.support:support-v4:25.3.1 (*)
| +--- com.android.support:appcompat-v7:25.3.1 (*)
| +--- com.android.support:recyclerview-v7:25.3.1 (*)
| \--- com.android.support:transition:25.3.1
| +--- com.android.support:support-annotations:25.3.1
| \--- com.android.support:support-v4:25.3.1 (*)
+--- com.google.android.gms:play-services-maps:7.5.0
| \--- com.google.android.gms:play-services-base:7.5.0
| \--- com.android.support:support-v4:22.0.0 -> 25.3.1 (*)
+--- com.google.android.gms:play-services-gcm:7.5.0
| \--- com.google.android.gms:play-services-base:7.5.0 (*)
+--- org.ocpsoft.prettytime:prettytime:3.2.4.Final
+--- com.google.maps.android:android-maps-utils:0.4
+--- com.fasterxml.jackson.core:jackson-databind:2.4.4
| +--- com.fasterxml.jackson.core:jackson-annotations:2.4.0
| \--- com.fasterxml.jackson.core:jackson-core:2.4.4 -> 2.8.7
+--- com.google.code.gson:gson:2.7
+--- com.jakewharton.timber:timber:4.3.1
+--- com.google.dagger:dagger:2.8
| \--- javax.inject:javax.inject:1
+--- com.jakewharton:butterknife:8.5.1
| +--- com.jakewharton:butterknife-annotations:8.5.1
| | \--- com.android.support:support-annotations:25.1.0 -> 25.3.1
| +--- com.android.support:support-annotations:25.1.0 -> 25.3.1
| \--- com.android.support:support-compat:25.1.0 -> 25.3.1 (*)
+--- com.getsentry.raven:raven-android:8.0.2
| \--- com.getsentry.raven:raven:8.0.2
| +--- org.slf4j:slf4j-api:1.7.24
| \--- com.fasterxml.jackson.core:jackson-core:2.8.7
+--- com.github.bumptech.glide:glide:3.8.0
+--- com.squareup.sqlbrite2:sqlbrite:2.0.0
| +--- io.reactivex.rxjava2:rxjava:2.1.0
| | \--- org.reactivestreams:reactive-streams:1.0.0
| \--- com.android.support:support-annotations:25.3.1
+--- io.reactivex.rxjava2:rxandroid:2.0.1
| \--- io.reactivex.rxjava2:rxjava:2.0.1 -> 2.1.0 (*)
+--- io.reactivex.rxjava2:rxjava:2.1.0 (*)
+--- project :domain
| +--- com.google.dagger:dagger:2.8 (*)
| +--- io.reactivex.rxjava2:rxandroid:2.0.1 (*)
| \--- io.reactivex.rxjava2:rxjava:2.1.0 (*)
+--- project :data
| +--- project :domain (*)
| +--- project :database
| | +--- com.jakewharton.timber:timber:4.3.1
| | +--- com.squareup.sqlbrite2:sqlbrite:2.0.0 (*)
| | +--- io.reactivex.rxjava2:rxandroid:2.0.1 (*)
| | \--- io.reactivex.rxjava2:rxjava:2.1.0 (*)
| +--- com.google.dagger:dagger:2.8 (*)
| +--- com.squareup.retrofit2:converter-gson:2.3.0
| | +--- com.squareup.retrofit2:retrofit:2.3.0
| | | \--- com.squareup.okhttp3:okhttp:3.8.0
| | | \--- com.squareup.okio:okio:1.13.0
| | \--- com.google.code.gson:gson:2.7
| +--- com.squareup.okhttp3:logging-interceptor:3.6.0
| | \--- com.squareup.okhttp3:okhttp:3.6.0 -> 3.8.0 (*)
| +--- com.squareup.retrofit2:adapter-rxjava2:2.3.0
| | +--- com.squareup.retrofit2:retrofit:2.3.0 (*)
| | \--- io.reactivex.rxjava2:rxjava:2.0.0 -> 2.1.0 (*)
| +--- com.jakewharton.timber:timber:4.3.1
| +--- com.squareup.sqlbrite2:sqlbrite:2.0.0 (*)
| +--- io.reactivex.rxjava2:rxandroid:2.0.1 (*)
| \--- io.reactivex.rxjava2:rxjava:2.1.0 (*)
\--- project :database (*)
我做了任何其他类似线程所说的一切,清理项目,删除构建文件夹,我什至在另一台计算机上开始了新的构建,所以以前安装的应用程序不可能在那里构建。
如果我删除 rxjava2 和 rxandroid2 依赖项并注释掉所有使用它们的代码,则应用程序安装正常。一旦我重新启用它们,我就会再次收到错误。在 studion 上,错误是:
Installation failed since the device possibly has stale dexed jars
that don't match the current version (dexopt error).
In order to proceed, you have to uninstall the existing application.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
当然,即使我知道该应用程序未安装并且它当然会失败,我也会说是。
我已经尝试过使用此工具的方法计数 https://github.com/KeepSafe/dexcount-gradle-plugin 方法仍然低于 64000 但即使我添加了 multidex,如下所述:https ://developer.android.com/studio/ build/multidex.html 但它仍然不起作用!我尝试过使用目标 SDK,增加到 25,甚至 buildtools 到 26,使用比以前更新的 gradle 包装器(目前我在 3.5),但没有,仍然是同样的问题。除了恢复到 rxjava1 之外,我不知道还能尝试什么,但我首先更新的原因是因为我有太多项目并且在 android 10 上获得了 OOME,所以在阅读了这篇https://github.com/ReactiveX /RxJava/wiki/什么's-different-in-2.0#which-type-to-use 我决定升级。它没有说 rxjava2 与 android 10 不兼容。应用程序在 android 19++ 上安装良好(在 10 和 19 之间没有尝试过)我已经尝试了来自https://github.com/square/sqlbrite的示例,我将其更改为与 api 10 一起使用,并且可以在 android 10 上正常安装。还有什么我可以尝试的想法吗?
更新:这些是来自模拟器的日志:
56.584 1186-1207/system_process E/PackageManager: Package com.mypackage.myapp has mismatched uid: 10070 on disk, 10040 in settings
08-18 11:47:56.784 1853-1853/? E/dalvikvm: LinearAlloc exceeded capacity (5242880), last=220
08-18 11:47:56.784 1853-1853/? E/dalvikvm: VM aborting
08-18 11:47:56.804 1132-1132/? E/installd: dexopt failed on '/data/dalvik-cache/data@app@com.mypackage.myapp-1.apk@classes.dex' res = 11
更新 2:我添加了 proguard,即使在尝试安装发布版本(使用 proguard)时仍然出现相同的错误