Tag: gradle

How to do Integration Testing on Android with the new Gradle Build System?

Our Android app needs automated testing, and our group is using Robotium to handle that for us. This is no problem for unit tests, but we’re also writing a set of end-to-end integration tests to exercise not only the client by the back-end servers as well. I’ve got some tests that do this, but if […]

Code Path per Flavor in Android Gradle

I have 2 buildTypes (debug, release) and 2 productFlavors (product1, product2). I want to define a buildConfigField for each buildType and productFlavors. The buildConfigField is the url the app to download data from the server, and it changes for each productFlavor and buildTypes. Now, I have: buildTypes { debug { debuggable true } release { […]

Cause of “This app contains code that attempts to bypass android's security protections”

I have been working on a very benign Android application for a couple months now and all of a sudden I started getting this message on my device when I try to re-install it from IntelliJ. My question is, what sort of things would cause Android OS to display this message? If I were to […]

Android Studio 2.2 update: aligned APK (zipAlign) not generated using the new Gradle Plugin 2.2.0

After updating Android Studio to version 2.2 I also got an update for the Gradle Plugin (it was 2.1.3): … classpath ‘com.android.tools.build:gradle:2.2.0’ … I see the unaligned variant APK file but other variants are not generated anymore. I tryed to enable the zip align: buildTypes { release { minifyEnabled false zipAlignEnabled true proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’ […]

Error When building a large Codename One Application During the Dex Phase

I got an error in the build server when sending an Android build during the dex phase. Googling a bit I learned that there is a hard limit of 64K functions (including all libs, the heaviest is google play services), or you can use the multiple dex mechanism. How do I activate this for Codename […]

How do I set an environment variable in Android Studio before it runs my gradle build

My Gradle build looks at an environment variable called BUILD_NUMBER to determine the version to allocate to my android application as follows: def buildNumber = System.getenv(“BUILD_NUMBER”) ?: “local” So as long as that environment variable is set, the build number is used in defaultConfig as follows: versionName “1.4.0.”+buildNumber Usually, Jenkins will call this Gradle build […]

Gradle Android plugin generate R files for different product flavors?

I am trying to merge my free app and paid app. The productFlavors of Android’s new build system seem to be a perfect fit for my problem. I have the freeApp flavor working great, however when I build the paidApp flavor the R file that is being generated is in a package structure that is […]

Can't run ndk-build on Android studio from gradle on osx yosemite

I am trying to run ndk-build from my build.gradle in an Android Studio 1.0 project on MAC OSX Yosemite. task ndkBuild(type: Exec) { commandLine ‘ndk-build’, ‘-C’, file(‘src/main’).absolutePath } I have specified the ndk-dir in the local.properties file but I am getting this error A problem occurred starting process ‘command ‘ndk-build’ If I run the gradle […]

Duplicate files copied in APK META-INF/maven/com.squareup/otto/pom.xml

I’m getting below mentioned error when I’m trying to run my application. Error:Execution failed for task ‘:app:transformResourcesWithMergeJavaResForAmazonCheezCoverage’. com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup/otto/pom.xml File1: /Users/afourtest/.gradle/caches/modules-2/files-2.1/com.crashlytics.android/crashlytics/1.1.13/e821eafa1bf489a26bdb71f95078c26785b37a1/crashlytics-1.1.13.jar File2: /Users/afourtest/.gradle/caches/modules-2/files-2.1/com.squareup/otto/1.3.7/69d90fd7fb70e54746e26c10454c220e40a775ce/otto-1.3.7.jar My app build.gradle is here

Getting error “Gradle version 1.10 is required. Current version is 1.12.” when executing “gradle wrapper”?

I’m trying to execute gradle wrapper for an Android project, and this error is raised: A problem occurred evaluating root project ‘myapp’. > Gradle version 1.10 is required. Current version is 1.12. If using the gradle wrapper, try editing the distributionUrl in /Users/dude/myapp/gradle/wrapper/gradle-wrapper.properties to gradle-1.10-all.zip My wrapper task in build.gradle looks like this: task wrapper(type: […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.