skip to Main Content

I faced a situation in which the version from the built debug APK had inexplicable runtime errors which disappeared after the rebuild. No code changes – just fresh build. Today it happened at least a second time – it starts to worry me.

It’s a waste of time to determine that error couldn’t be repeated on my emulator and I just need to rebuild it. Here I can only build APKs one by one until I get two files equal to byte. Though I’ve never faced the same problem while installing directly through USB, it couldn’t be a solution as I don’t have physical access to it all the time.

Update. Today such a thing happened through USB installation.

The second reason is main here. Can I be sure the release build doesn’t have the same problem? Now I build AAB files that I can’t install on a device to check before update in Google Play.

Current Android Studio version:

Android Studio Arctic Fox | 2020.3.1 Patch 1 Build
#AI-203.7717.56.2031.7621141, built on August 7, 2021

Update. Repeated on Android Studio version:

Android Studio Arctic Fox | 2020.3.1 Patch 2 Build
#AI-203.7717.56.2031.7678000, built on August 27, 2021

Other build settings

buildToolsVersion '30.0.2'
gradle version 7.0.2

Why does it happen? Is there any workaround?

2

Answers


  1. Patch 2 is available, It seems there are some issue with gradle build.
    here is the link of the issue tracker. https://issuetracker.google.com/issues/195968520?pli=1

    As suggested in issue tracker can you please try with below configs.

    The kotlin metadata should be deterministic from version 3.0.69 and forward. You can try out that version by adding the following to your top-level build.gradle file:

    buildscript {
    repositories {
        maven {
            url 'https://storage.googleapis.com/r8-releases/raw'
        }
    }
    
    dependencies {
        classpath 'com.android.tools:r8:3.0.69'          // Must be before the Gradle Plugin for Android.
        classpath 'com.android.tools.build:gradle:X.Y.Z' // Your current AGP version.
     }
    }
    

    Here is the link of all resolved issues for patch 2.
    https://androidstudio.googleblog.com/2021/09/android-studio-arctic-fox-202031-patch.html

    Login or Signup to reply.
  2. It is going to be hard to say anything without seeing the error or at least logcat. With that said it could be either your configuration or a bug and the only generic advice to give is to make sure you update everything to the latest stable build or find any version for the build system that works.

    Sometimes things like this happen due to build artifact caching issues. In general, debug builds optimize for build speed and additional info for debugging. Build artifact caching one such build speed optimization thing that could be wrong and can cause issues. Another one is where an IDE may save files while you are building and this can mess up timestamps and maybe mess up the cache or mix different versions of code.

    Anyway without a specific error message or logcat it is almost impossible to say anything specific.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search