BuildConfig not getting created correctly (Gradle Android)

Please, be sure that you are building “dev” or “prod” variant. There is no BuildConfig definition in default “debug” and “release” variant. In Android Studio, you can select current variant in bottom left corner: To simplify your build.gradle file, you can define: buildTypes { debug { buildConfigField “String”, “URL_SEARCH”, “\”https://dev-search.example.com\”” // etc. } release { … Read more

Android Studio: Plugin with id ‘android-library’ not found

Instruct Gradle to download Android plugin from Maven Central repository. You do it by pasting the following code at the beginning of the Gradle build file: buildscript { repositories { mavenCentral() } dependencies { classpath ‘com.android.tools.build:gradle:1.1.1’ } } Replace version string 1.0.+ with the latest version. Released versions of Gradle plugin can be found in … Read more

Is it possible to declare git repository as dependency in android gradle?

For me the best way is: https://jitpack.io Step 1. Add the JitPack repository to build.gradle at the end of repositories: repositories { // … maven { url “https://jitpack.io” } } Step 2. Add the dependency in the form dependencies { implementation ‘com.github.User:Repo:Tag’ } It is possible to build the latest commit on the master branch, … Read more

How to define different dependencies for different product flavors

To define a flavor specific dependency you can use proCompile instead of compile in your dependency section. When you run gradle properties you get an overview of automatic created configurations. The correct build file looks like this: buildscript { repositories { mavenCentral() } dependencies { classpath ‘com.android.tools.build:gradle:1.2.3’ } } apply plugin: ‘com.android.application’ repositories { mavenCentral() … Read more

Android Command line tools sdkmanager always shows: Warning: Could not create settings

Instead of passing the argument –sdk_root for each single command execution, let’s deep dive into the real cause. Starting from Android SDK Command-line Tools 1.0.0 (6200805), in contrast to Android SDK 26.1.1 (4333796), the tools directory hierarchy has been changed. Previously it was placed right inside ANDROID_HOME (which is deprecated, we will use the term … Read more