Apps-android-commons: Can't build with Instant Run enabled

Created on 18 Oct 2018  路  7Comments  路  Source: commons-app/apps-android-commons

Summary:

Unable to run application on a real device or an emulator due to the following error:
Failed to find byte code for com/mapzen/android/lost/api/LostApiClient$ConnectionCallbacks

Steps to reproduce:

  1. Clone the repository
  2. Build project
  3. Run on a real device/emulator

Add System logs:
Android Studio version: 3.2

Device and Android version:

Google Pixel, Android 9.0
Nexus 5X Emulator, Android 7.1.1

Commons app version:

versionCode 92
versionName '2.8.5'
branch: master

bug build error

Most helpful comment

Okay, got a bit closer. If you disable proguards minifyEnabled option Instant Run seems to work fine.

I'm going to put this on pause for now so please do feel free to have a go solving.

All 7 comments

I couldn't reproduce the error.
Android Studio version: 3.2.1

Devices:
Nexus 5X Emulator, Android 8.0
Redmi Note 3, 6.0

There's at least one more person who has experienced this problem. This is the issue they filed on this repository:

https://github.com/commons-app/apps-android-commons/issues/1943

Try disabling instant run in your settings:
File > Settings > Build, Execution, Deployment > Instant Run

Think it would be better to actually have this as an issue we could work towards fixing rather than just disabling Instant Run.

Currently builds, but as soon as app opened crashes with the following errors:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: fr.free.nrw.commons.beta, PID: 17820
    java.lang.RuntimeException: Unable to instantiate service fr.free.nrw.commons.contributions.ContributionsSyncService: java.lang.ClassNotFoundException: Didn't find class "fr.free.nrw.commons.contributions.ContributionsSyncService" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/base.apk", zip file "/data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/split_lib_directories_apk.apk", zip file "/data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/split_lib_resources_apk.apk"],nativeLibraryDirectories=[/data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/lib/x86, /data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/base.apk!/lib/x86, /data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/split_lib_directories_apk.apk!/lib/x86, /data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/split_lib_resources_apk.apk!/lib/x86, /system/lib]]
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:3519)
        at android.app.ActivityThread.access$1300(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1666)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "fr.free.nrw.commons.contributions.ContributionsSyncService" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/base.apk", zip file "/data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/split_lib_directories_apk.apk", zip file "/data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/split_lib_resources_apk.apk"],nativeLibraryDirectories=[/data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/lib/x86, /data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/base.apk!/lib/x86, /data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/split_lib_directories_apk.apk!/lib/x86, /data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/split_lib_resources_apk.apk!/lib/x86, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:103)
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:3514)
        at android.app.ActivityThread.access$1300(ActivityThread.java:199)聽
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1666)聽
        at android.os.Handler.dispatchMessage(Handler.java:106)聽
        at android.os.Looper.loop(Looper.java:193)聽
        at android.app.ActivityThread.main(ActivityThread.java:6669)聽
        at java.lang.reflect.Method.invoke(Native Method)聽
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)聽
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)聽
        Suppressed: java.io.IOException: No original dex files found for dex location /data/app/fr.free.nrw.commons.beta-geEx0WTf2YLYoGFARCucfQ==/split_lib_resources_apk.apk
        at dalvik.system.DexFile.openDexFileNative(Native Method)
        at dalvik.system.DexFile.openDexFile(DexFile.java:354)
        at dalvik.system.DexFile.<init>(DexFile.java:101)
        at dalvik.system.DexFile.<init>(DexFile.java:75)
        at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
        at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
        at dalvik.system.DexPathList.<init>(DexPathList.java:164)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
        at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
        at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
        at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
        at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
        at android.app.LoadedApk.getResources(LoadedApk.java:1032)
        at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
                ... 6 more

Got a bit too excited and thought I had fixed this issue but haven't.

Here's another log of where we are:

2018-12-19 19:38:34.831 32549-32549/fr.free.nrw.commons E/AndroidRuntime: FATAL EXCEPTION: main
    Process: fr.free.nrw.commons, PID: 32549
    java.lang.RuntimeException: Unable to get provider android.arch.lifecycle.ProcessLifecycleOwnerInitializer: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.ProcessLifecycleOwnerInitializer" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/base.apk", zip file "/data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/split_lib_directories_apk.apk", zip file "/data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/split_lib_resources_apk.apk"],nativeLibraryDirectories=[/data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/lib/x86, /data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/base.apk!/lib/x86, /data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/split_lib_directories_apk.apk!/lib/x86, /data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/split_lib_resources_apk.apk!/lib/x86, /system/lib]]
        at android.app.ActivityThread.installProvider(ActivityThread.java:6396)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.ProcessLifecycleOwnerInitializer" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/base.apk", zip file "/data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/split_lib_directories_apk.apk", zip file "/data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/split_lib_resources_apk.apk"],nativeLibraryDirectories=[/data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/lib/x86, /data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/base.apk!/lib/x86, /data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/split_lib_directories_apk.apk!/lib/x86, /data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/split_lib_resources_apk.apk!/lib/x86, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:121)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6380)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)聽
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)聽
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)聽
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)聽
        at android.os.Handler.dispatchMessage(Handler.java:106)聽
        at android.os.Looper.loop(Looper.java:193)聽
        at android.app.ActivityThread.main(ActivityThread.java:6669)聽
        at java.lang.reflect.Method.invoke(Native Method)聽
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)聽
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)聽
        Suppressed: java.io.IOException: No original dex files found for dex location /data/app/fr.free.nrw.commons-ewQMi8BT0Pg3dYiotvbB3Q==/split_lib_resources_apk.apk
        at dalvik.system.DexFile.openDexFileNative(Native Method)
        at dalvik.system.DexFile.openDexFile(DexFile.java:354)
        at dalvik.system.DexFile.<init>(DexFile.java:101)
        at dalvik.system.DexFile.<init>(DexFile.java:75)
        at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
        at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
        at dalvik.system.DexPathList.<init>(DexPathList.java:164)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
        at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
        at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
        at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
2018-12-19 19:38:34.832 32549-32549/fr.free.nrw.commons E/AndroidRuntime:     at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
        at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
        at android.app.LoadedApk.getResources(LoadedApk.java:1032)
        at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
                ... 8 more
2018-12-19 19:38:34.995 2647-10818/com.google.android.apps.nexuslauncher E/s.nexuslaunche: No package ID ff found for ID 0xffffffff.
2018-12-19 19:38:35.013 2647-10818/com.google.android.apps.nexuslauncher E/IconLoader: Could not find icon drawable from resource
    android.content.res.Resources$NotFoundException: Resource ID #0xffffffff
        at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:225)
        at android.content.res.Resources.getDrawableForDensity(Resources.java:887)
        at android.content.res.Resources.getDrawable(Resources.java:827)
        at com.android.systemui.shared.recents.model.IconLoader.createNewIconForTask(SourceFile:118)
        at com.android.systemui.shared.recents.model.IconLoader.getAndInvalidateIfModified(SourceFile:94)
        at com.android.systemui.shared.recents.model.RecentsTaskLoader.getAndUpdateActivityIcon(SourceFile:325)
        at com.android.systemui.shared.recents.model.RecentsTaskLoadPlan.executePlan(SourceFile:188)
        at com.android.systemui.shared.recents.model.RecentsTaskLoader.loadTasks(SourceFile:173)
        at com.android.quickstep.RecentsModel.onTaskStackChangedBackground(SourceFile:214)
        at com.android.systemui.shared.system.TaskStackChangeListeners.onTaskStackChanged(SourceFile:80)
        at android.app.ITaskStackListener$Stub.onTransact(ITaskStackListener.java:50)
        at android.os.Binder.execTransact(Binder.java:731)

Okay, got a bit closer. If you disable proguards minifyEnabled option Instant Run seems to work fine.

I'm going to put this on pause for now so please do feel free to have a go solving.

Was this page helpful?
0 / 5 - 0 ratings