Troubleshooting for Flutter apps

This document outlines some troubleshooting tips and best practices to help you resolve any issues while using Apptics for applications built using Flutter.

In-app Update

Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

  • You can add Theme.AppCompat theme in Manifest.

**What went wrong:**

Execution failed for task ':app:checkDebugAarMetadata'.

> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

> Could not find com.zoho.apptics:apptics-analytics.

  • To resolve this issue, add a repository in the `allprojects` extension of the project's build.gradle file. 
  • Add the below code to the build.gradle file.
Copiedallprojects {
    repositories {
        maven {
            url "https://maven.zohodl.com/"
        }
    }
}

What went wrong:

Execution failed for task ':app:mergeExtDexDebug'.

> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate

   > There was a failure while executing work items

      > A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction

         > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: The number of method references in a .dex file cannot exceed 64K.

  • To enable MultiDex in the app-level Gradle file (app/build.gradle), set multiDexEnabled to true.
CopieddefaultConfig {

        applicationId "com.example.demo"
       
        minSdkVersion 19
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
  multiDexEnabled = true
    }