Multi flavor app based on multi flavor library in Android Gradle

Finally I found out how to do this, I will explain it here for others facing same problem: If App and Library have same Flavor name(s) It’s possible since Gradle Plugin 3.0.0 (and later) to do something like: Library build.gradle: apply plugin: ‘com.android.library’ // Change below’s relative-path // (as the `../` part is based on … Read more

How to set versionName in APK filename using gradle?

I only have to change the version name in one place. The code is simple too. The examples below will create apk files named named MyCompany-MyAppName-1.4.8-debug.apk or MyCompany-MyAppName-1.4.8-release.apk depending on the build variant selected. Note that this solution works on both APK and App Bundles (.aab files). See Also: How to change the proguard mapping … Read more

Why I’m Getting Duplicate Class When Running My Android Project

The exception means, There were duplicated classes in 2 or more different dependencies and the compiler wouldn’t be able to distinguish which of them should be used at run-time and the exception was thrown. Most often, Duplicity happens when you are trying to import modules that carrying their required libraries. (transitive dependencies) You have to … Read more

Adding local .aar files to Gradle build using “flatDirs” is not working

Building upon Josiah’s answer, here’s how I got it to work. Following his instructions (under edit) (File -> New-> New Module -> Import .JAR/.AAR) and import your .AAR. Then in your project build.gradle (not the top level one, the one under ‘app’) add the following (in the dependencies section): dependencies { compile project(‘:Name-Of-Your-Project’) } Note … Read more

define LOCAL_SRC_FILES in ndk{} DSL

With experimental plugin 0.4.0, it is possible to exclude files from NDK build by pattern, e.g. android.sources { main { jni.source { srcDirs = [“~/srcs/jni”] exclude “**/win.cpp” } } } Thanks to Paul Spark! P.S. (thanks to rajveer): don’t miss Build/Clean after you change exclude! Old answer Unfortunately this is not supported by current gradle … Read more

Android Studio: Gradle – build fails — Execution failed for task ‘:dexDebug’

The right answer is, that some of your jar files does not compile. You should go into your build.gradle file in your project, and look in your dependencies. If you’re just importing some jar files, you could try to remove them and add them one at a time. This will help you determine which one … Read more

How to use the legacy Apache HTTP client on Android Marshmallow?

Android Studio was complaining that org.apache.http classes like org.apache.http.NameValuePair org.apache.http.client.utils.URLEncodedUtils were missing. So I added org.apache.http.legacy.jar which is in Android/Sdk/platforms/android-23/optional folder to to app/libs I also added this line to my app.gradle file compile files(‘libs/org.apache.http.legacy.jar’) But if you’re using more libraries, you can use this way compile fileTree(dir: ‘libs’, include: [‘*.jar’]) This resolved all my … Read more

com.google.android.gms:play-services-measurement-base is being requested by various other libraries

The actual problem is discussed in the May, 23rd release note of https://developers.google.com/android/guides/releases#may_23_2018 Basically, you need to bump all Play Services and Firebase libraries to their latest version (which may be different for each since version 15). You may use https://mvnrepository.com/ to find the latest version for each library. See also: https://firebase.google.com/support/release-notes/android#20180523

The number of method references in a .dex file cannot exceed 64k API 17

You have too many methods. There can only be 65536 methods for dex. As suggested you can use the multidex support. Just add these lines in the module/build.gradle: android { defaultConfig { … // Enabling multidex support. multiDexEnabled true } … } dependencies { implementation ‘androidx.multidex:multidex:2.0.1’ //with androidx libraries //implementation ‘com.android.support:multidex:1.0.3’ //with support libraries } … Read more

deneme bonusu veren sitelerbahis casino