在Kotlin lang上的android.arch.lifecycle上的Android FATAL EXCEPTION

时间:2017-08-19 13:30:35

标签: java android kotlin lifecycle

我只是尝试将我在Java中的旧android项目转换为Kotlin,并将google Android Architecture Components添加到我的项目中:

// LifeCycle Google Lib
compile "android.arch.lifecycle:runtime:1.0.0-alpha5"
compile "android.arch.lifecycle:extensions:1.0.0-alpha5"
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha5"
// Room Google Lib
compile "android.arch.persistence.room:runtime:1.0.0-alpha9"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha9"
testCompile "android.arch.persistence.room:testing:1.0.0-alpha9"

然后当我运行app遇到这个错误时:

E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_dependencies_apk.apk@classes.dex: Permission denied
08-19 17:26:11.043 26169-26169/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_slice_0_apk.apk@classes.dex: Permission denied
08-19 17:26:11.122 26174-26174/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_slice_1_apk.apk@classes.dex: Permission denied
08-19 17:26:11.200 26180-26180/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_slice_2_apk.apk@classes.dex: Permission denied
08-19 17:26:11.284 26187-26187/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_slice_3_apk.apk@classes.dex: Permission denied
08-19 17:26:11.366 26193-26193/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_slice_4_apk.apk@classes.dex: Permission denied
08-19 17:26:11.450 26197-26197/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_slice_5_apk.apk@classes.dex: Permission denied
08-19 17:26:11.530 26206-26206/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_slice_6_apk.apk@classes.dex: Permission denied
08-19 17:26:11.605 26210-26210/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_slice_7_apk.apk@classes.dex: Permission denied
08-19 17:26:11.696 26214-26214/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_slice_8_apk.apk@classes.dex: Permission denied
08-19 17:26:11.775 26221-26221/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@app@ir.adrapanadevs.aya-2@split_lib_slice_9_apk.apk@classes.dex: Permission denied

和此:

E/AndroidRuntime: FATAL EXCEPTION: main
                                                                 Process: ir.adrapanadevs.aya, PID: 26090
                                                                 java.lang.NoSuchMethodError: No virtual method iterator()Landroid/arch/core/internal/SafeIterableMap$ListIterator; in class Landroid/arch/core/internal/SafeIterableMap; or its super classes (declaration of 'android.arch.core.internal.SafeIterableMap' appears in /data/app/ir.adrapanadevs.aya-2/split_lib_dependencies_apk.apk)
                                                                     at android.arch.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:101)
                                                                     at android.arch.lifecycle.ProcessLifecycleOwner.attach(ProcessLifecycleOwner.java:154)
                                                                     at android.arch.lifecycle.ProcessLifecycleOwner.init(ProcessLifecycleOwner.java:100)
                                                                     at android.arch.lifecycle.LifecycleRuntimeTrojanProvider.onCreate(LifecycleRuntimeTrojanProvider.java:36)
                                                                     at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
                                                                     at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
                                                                     at android.app.ActivityThread.installProvider(ActivityThread.java:5217)
                                                                     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4812)
                                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4752)
                                                                     at android.app.ActivityThread.-wrap1(ActivityThread.java)
                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424)
                                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                     at android.os.Looper.loop(Looper.java:148)
                                                                     at android.app.ActivityThread.main(ActivityThread.java:5485)
                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

如何解决这个问题? 的感谢

1 个答案:

答案 0 :(得分:1)

通过将LifeCycle Libs更新为Alpha 9问题解决了。