Common Android build errors

Note

Buddybuild uses Linux machines for building Android code. That means that case sensitivity with regards to file paths/file names are fully enforced, and you might notice build failures that you are not able to reproduce locally because you’re either using a Mac or a Windows system.

A problem occurred evaluating project

There are a few possible causes for the issue:

build.gradle refers to a file that’s not in the repo

* What went wrong:
     A problem occurred evaluating project ':app'.
     > /Users/buddybuild/workspace/signing.properties (No such file or directory)

If you get an error like this, it means that the build.gradle file refers to a file that is not checked into the repo. To resolve this error, you can use an if condition to avoid the error by checking if the file exists or not:

if (file("signing.properties").exists()) {
  file('signing.properties').foo;
}

The file path is platform dependent

* What went wrong:
     A problem occurred evaluating project ':app'.
     > Cannot convert URL 'C:/Users/Win7/Desktop/keystore.jks' to a file.

If you get an error like this, it typically occurs when your development environment is Windows. All you need to do is to switch to a relative path:

signingConfigs {
  config {
    keyAlias 'myalias'
    keyPassword 'mykeypassword'
    storeFile file('../keystore.jks')
    storePassword 'mystorepassword'
  }
}

org.gradle.api.tasks.Sync.getInputs()Lorg/gradle/api/internal/TaskInputsInternal;

This error generally indicates that the Gradle wrapper is misconfigured, please follow the following steps:

  1. Make sure you are using a Gradle wrapper

    A Gradle wrapper consists of the following files/directories:

    ├── gradlew
    ├── gradle
    │   └── wrapper
    │       ├── gradle-wrapper.jar
    │       └── gradle-wrapper.properties

    If you don’t have a Gradle wrapper, use the following command to generate one. You should commit the Gradle wrapper into your repository.

    Generating a gradle wrapper
    gradle wrapper --gradle-version <gradle_version>
  2. If you are using a Gradle wrapper, make sure it matches your Gradle plugin

    For example, if your Gradle plugin version is 2.2.3, make sure that the Gradle wrapper version is 2.14.1+

  3. Make sure that the gradle-wrapper.jar file is checked in

    We see this fairly frequently, please make sure that the gradle-wrapper.jar file is checked in.

Multiple dex files define <x>

This is almost always due to dependencies dragging in different versions of a shared dependency (quite frequently noticed with com.google.android.gms). To resolve this the following is an example of how to force com.google.android.gms to a specific versionSet:

configurations.all {
    resolutionStrategy {
        eachDependency { DependencyResolveDetails details ->
            if (details.requested.group == 'com.google.android.gms' && details.requested.name.indexOf('play-services') > -1) {
                println details.requested.name
                details.useVersion('10.0.0')
            }
        }
    }
}

error: Annotation processor '__gen.AnnotationProcessorWrapper.*$AnnotationProcessor' not found

This is generally caused by some breaking changes introduced with Gradle 3.4+ whereby it requires certain changes when using annotation processors with Kotlin code.

More specifically, this is generally caused by a missing apply plugin: 'kotlin-kapt' at the top of your build.gradle file as indicated in the documentation below: https://kotlinlang.org/docs/reference/kapt.html

If you are unable to reproduce this, your issues might be a result of buddybuild upgrading your version of Gradle to a specific version based off your com.android.tools.build version.

fatal error: '*.h' file not found

If this is an NDK build, there can be two reasons behind that error.

  1. The NDK installed on our android boxes is not compatible with your build.

  2. The file path you are referencing in your include is not properly cased to the physical path on the back. You can get away with this on case-insensitive file systems, but you can’t get away with this on Linux boxes used by buddybuild.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class

This was a bug with Google Play Services version 11.0.0. Please upgrade to 11.0.1 or greater.

build/intermediates/res/merged/release/values-v26/values-v26.xml:15:21-54: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'

This occurs because buddybuild has updated its ACRA (Application Crash Reports for Android) dependencies.

To resolve this problem, edit your build.gradle file and make the following changes:

compileSdkVersion 26
buildToolsVersion '26.0.1'

defaultConfig {
    targetSdkVersion 26
}

Additional discussion about this issue can be found on StackOverflow.

results matching ""

    No results matching ""