Error while merging dex Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

It’s because you messed up the dependencies. You have to either fully migrate to AndroidX dependencies or stay on Support library ones. Thus, instead of implementation “android.arch.persistence.room:runtime:$room_lib” annotationProcessor “android.arch.persistence.room:compiler:$room_lib” use implementation “androidx.room:room-runtime:2.0.0-alpha1” annotationProcessor “androidx.room:room-compiler:2.0.0-alpha1” Also be sure to check your gradle.properties project file to contain android.useAndroidX=true android.enableJetifier=true Jetifier helps libraries, which depend on old Support … Read more

Generate JavaDocs with Android Gradle plugin

For Android gradle plugin 1.1.2+ (com.android.tools.build:gradle:1.1.2+) libraryVariants – does not work anymore use: task javadoc(type: Javadoc) { source = android.sourceSets.main.java.srcDirs classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) destinationDir = file(“../javadoc/”) failOnError false } destinationDir = file(“../javadoc/”) – locate javadocs at root of project directory (in this way jenkins javadoc plugin could find it and show in special Document panel) … Read more

Could not install Gradle distribution from ‘https://services.gradle.org/distributions/gradle-2.1-all.zip’

It could be that the gradle-2.1 distribution specified by the wrapper was not downloaded properly. This was the root cause of the same problem in my environment. Look into this directory: ls -l ~/.gradle/wrapper/dists/ In there you should find a gradle-2.1 folder. Delete it like so: rm -rf ~/.gradle/wrapper/dists/gradle-2.1-bin/ Restart IntelliJ, after that it will … Read more

Android Studio and Gradle build error

If you are using the Gradle Wrapper (the recommended option in Android Studio), you enable stacktrace by running gradlew compileDebug –stacktrace from the command line in the root folder of your project (where the gradlew file is). If you are not using the gradle wrapper, you use gradle compileDebug –stacktrace instead (presumably). You don’t really … Read more

Confused about testCompile and androidTestCompile in Android Gradle

Simply testCompile is the configuration for unit tests (those located in src/test) and androidTestCompile is used for the test api (that located in src/androidTest). Since you are intending to write unit tests, you should use testCompile. Update: The main distinction between the two is the test sourceset runs in a regular Java JVM, whereas the … Read more