How to generate buildConfigField with String type

In my Android Studio project there are two build configuration with some buildConfigField: buildTypes { def SERVER_URL = “SERVER_URL” def APP_VERSION = “APP_VERSION” debug { buildConfigField “String”, SERVER_URL, “http://dev.myserver.com” buildConfigField “String”, APP_VERSION, “0.0.1” } release { buildConfigField “String”, SERVER_URL, “https://myserver.com” buildConfigField “String”, APP_VERSION, “0.0.1” minifyEnabled false proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’ } } I am getting and … Read more

ionic 2 – Error Could not find an installed version of Gradle either in Android Studio

I create ionic 2 project and add diagnostic cordova plugin like this : ionic plugin add cordova.plugins.diagnostic npm install –save @ionic-native/diagnostic and add android platform like this : ionic platform add android@latest but when build with ionic build android console give me this error : Error: Could not find an installed version of Gradle either … Read more

Why are build types distinct from product flavors?

Preface: this is not a question about how to use build types and product flavors in an Android app. I understand the basic concepts involved. This question is more about trying to understand which configuration should be specified in a build type, which configuration should be specified in a product flavor, and whether any distinction … Read more

Android- Error:Execution failed for task ‘:app:transformClassesWithDexForRelease’

The Problem is that i am able to run my app when i change to debug mode but it fails when i switch to release mode. Exception: **FAILURE: Build failed with an exception.** > Execution failed for task ‘:app:transformClassesWithDexForRelease’. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java” finished with non-zero exit value 1 When … Read more

WARNING: API ‘variant.getJavaCompile()’ is obsolete and has been replaced with ‘variant.getJavaCompileProvider()’

Suddenly when Syncing Gradle, I get this error: WARNING: API ‘variant.getJavaCompile()’ is obsolete and has been replaced with ‘variant.getJavaCompileProvider()’. It will be removed at the end of 2019. For more information, see https://d.android.com/r/tools/task-configuration-avoidance Affected Modules: app I’ve got this build.gradle for the app module: apply plugin: ‘com.android.application’ apply plugin: ‘kotlin-android’ apply plugin: ‘kotlin-android-extensions’ apply plugin: … Read more

What is the syntax for writing comments in build.gradle file?

Looking down this build.gradle file apply plugin: ‘com.android.application’ android { compileSdkVersion 21 buildToolsVersion “21.1.2” defaultConfig { applicationId “package.myapp” minSdkVersion 19 targetSdkVersion 21 versionCode 1 versionName “1.0” } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’ } } } dependencies { compile fileTree(dir: ‘libs’, include: [‘*.jar’]) compile ‘com.nineoldandroids:library:2.4.0’ } What if I would like to … Read more

Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK – Android

I know there are lots of questions similiar to this one, but i couldn’t find a solution for my problem in any of those. Besides, I’ll provide details for my specific case. I coded an Ionic project in Ubuntu 16.04 LTS, and now I have to build it for release. So I run the command: … Read more

Error “File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it” [duplicate]

This question already has answers here: File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it (5 answers) Closed 1 year ago. I updated my project to the latest Play services classpath ‘com.google.gms:google-services:1.5.0-beta2’. I am also using the latest version of playservices in my app.gradle file as: compile ‘com.google.android.gms:play-services-location:8.3.0’ … Read more

Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat

If I run gradle assembleDebug from the command line, I am suddenly getting this error: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.util.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:592) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:550) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:531) at com.android.dx.merge.DexMerger.mergeDexBuffers(DexMerger.java:168) at com.android.dx.merge.DexMerger.merge(DexMerger.java:186) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:300) at com.android.dx.command.dexer.Main.run(Main.java:232) at com.android.dx.command.dexer.Main.main(Main.java:174) at com.android.dx.command.Main.main(Main.java:91) If I grep for v4 I see two files inside my build folder. … Read more