Common Android build errors

Points to Remember

  • 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.

Common Errors

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 the build.gradle 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 gradle wrapper

A gradle wrapper consists of the following files/directories:

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

If you don’t, the following is how to generate a gradle wrapper, and you should commit this into your repository.

Generating a gradle wrapper
gradle wrapper --gradle-version 

2. If you are using gradle wrapper, make sure it matches your gradle plugin

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

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

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

Other Errors

Multiple dex files define

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.

results matching ""

    No results matching ""