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

“JCenter is at end of life” android lint warning, what is the replacement?

There’s a documentation section describing the problem: JCenter deprecation and end of service. You can find the link by expanding the inspection description (Ctrl+F1). The documentation states: JFrog, the company that maintains the JCenter artifact repository used by many Android projects, recently announced the deprecation and upcoming retirement of JCenter. According to the announcement, JCenter … Read more

com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml

Instead of this packagingOptions { exclude ‘META-INF/LICENSE’ exclude ‘META-INF/NOTICE’ } try this packagingOptions { exclude ‘META-INF/DEPENDENCIES.txt’ exclude ‘META-INF/LICENSE.txt’ exclude ‘META-INF/NOTICE.txt’ exclude ‘META-INF/NOTICE’ exclude ‘META-INF/LICENSE’ exclude ‘META-INF/DEPENDENCIES’ exclude ‘META-INF/notice.txt’ exclude ‘META-INF/license.txt’ exclude ‘META-INF/dependencies.txt’ exclude ‘META-INF/LGPL2.1’ } and more thing Remove this line apply plugin: ‘com.google.gms.google-services’ from Bottom and add to Top after this apply plugin: ‘com.android.application’. … Read more

OpenCv with Android studio 1.3+ using new gradle – undefined reference

After few weeks of pain, I succed. Here is my correct code for Android studio 1.3.1, OpenCv 2.4.11. First you should do this OpenCV in Android Studio (don’t use paths which contains white space, both for project and opencv extraction folder) then, for opencv to be native: gradle-wrapper.properties: distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip build.gradle(application): classpath ‘com.android.tools.build:gradle-experimental:0.2.0’ build.gradle(module): apply plugin: … Read more

Getting Error “Gradle DSL method not found: ‘compile()'” when Syncing Build.Gradle

In almost all cases, your dependencies should be put into the individual module’s build.gradle files rather than at the top most level build.gradle file. In your case, that means the dependency should be added to the app module’s build.gradle file: dependencies { compile fileTree(dir: ‘libs’, include: [‘*.jar’]) compile “com.android.support:support-v4:18.0.+” } And you should remove the … Read more