Tag: android-gradle

Dagger 2, Gradle Plugins and Jack – Guidance Required

I’m using Dagger 2 (first time user of the DI library) with Android Studio (AS 2.1.2 – SDK 24), and obviously my first thought is “What dependencies do I need in order to use it?” Having looked at examples I can see that you need in the top level build.gradle file you need a annotation […]

External AndroidManifest.xml doesn't appear under project view pane

I have been developing an Android project using Android Studio and Gradle. My project’s AndroidManifest.xml is located under an external folder. I’m pointing to it using the following code in the build.gradle file: sourceSets { main { manifest.srcFile ‘..\\..\\..\\sources\\AndroidManifest.xml’ } } Everything works great, the project compiles and runs, except I can’t locate the AndroidManifest.xml […]

java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile

Below is the error I am getting while migrating yo Java 8 with API Level 24 Looks like it’s from lombok pre-processor. Any help appreciated Error:/MyApp.native.android/AndroidApp/src/main/java/com/cba/MyApp/android/view/fragment/ProfileDetails/tabs/Profile.java:21: The import lombok cannot be resolved FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:AndroidApp:compileMyAppDebugJavaWithJack’. > java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile * Try: […]

Android APK built from android studio and console have different SHA fingerprints

While building signed release APK I’ve come across the following: if I build signed apk from android studio (via Build -> Generate Signed APK…) with build.gradle file like this (only relevant parts): signingConfigs { release { storeFile file(‘/keystore/location/mykeystore.keystore’) storePassword ‘storepassword’ keyAlias ‘key’ keyPassword ‘keypassword’ } } buildTypes { release { signingConfig signingConfigs.release } } The […]

Define buildConfigField for androidTest

I’m defining a particular field in the BuildConfig for getting the URL during runtime. So, for each build type, I use a different string: prod { buildConfigField “String”, “BASE_URL”, “\”abc.com\”” } debug { buildConfigField “String”, “BASE_URL”, “\”efg.com\”” } Is it possible to define a different URL while running the android tests? I tried putting this […]

Android – set all lint warnings as errors except for certain ones

I am trying to make my continuous integration fail the build when new lint warnings that aren’t in the lint-baseline.xml file are introduced. I want to have all lint warnings treated as errors (so the build is aborted), but I’d like a way to specify certain lint checks to be treated as informational or warning […]

Run Android app in debugging mode

My Android Studio version is 2.3.3 In my Android app gradle build, I have explictly defined different server_url string values for debug type and release type: buildTypes { debug { resValue “string”, “server_url”, “https://myserver.debug.com/” } release { resValue “string”, “server_url”, “https://myserver.com/” … } } In my code, I get the string value by: String url […]

How to run unit test on a android module?

I have a android project that has multiple library modules and I am trying to test a specific package that contains all modules. I tried this command: ./gradlew -Dtest.single=com.moduleone* testProductionDebug And it does not work: it doesn’t execute the tests inside this module, but instead executes all the unit tests in the main project package […]

Gradle Could not find method compile() for arguments

i have a hello world full screen android studio 1.5.1 app that i added a gradle/eclipse-mars subproject to. no other files were modified except for adding include ‘:javalib’ to settings.gradle. adding a project lib dependency: project(‘:app’) { dependencies { compile project(‘:javalib’) // line 23 } } to the root build build file and running gradle […]

Android gradle uploadArchives when building

I have my uploadArhives to Maven repository .aar publishing. But I have to run gradlew uploadArhives from the console all the time, how to code to make it invoke with every build or with release build? uploadArchives { repositories { mavenDeployer { def credentials = [ userName: NEXUS_USERNAME, password: NEXUS_PASSWORD ] repository(url: MAVEN_REPO_URL, authentication: credentials) […]

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