Android Studio: how to generate signed APK using Gradle?

There are three ways to generate your build as per the buildType. (In your case, it’s release but it can be named anything you want.) Go to Gradle Task in right panel of Android Studio and search for assembleRelease or assemble(#your_defined_buildtype) under Module Tasks Go to Build Variant in Left Panel and select the build … Read more

How to change app name per Gradle build type

If by “app name”, you mean android:label on <application>, the simplest solution is to have that point at a string resource (e.g., android:label=”@string/app_name”), then have a different version of that string resource in a src/debug/ sourceset. You can see that in this sample project, where I have a replacement for app_name in src/debug/res/values/strings.xml, which will … Read more

No resource found that matches the given name: attr ‘android:keyboardNavigationCluster’. when updating to Support Library 26.0.0

I was able to resolve it by updating sdk version and tools in gradle compileSdkVersion 26 buildToolsVersion “26.0.1” and support library 26.0.1 https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-1

ViewModelProviders is deprecated in 1.1.0

I use lifecycle-extensions 2.2.0 version: implementation “androidx.lifecycle:lifecycle-extensions:2.2.0” It should work, using ViewModelProvider constructor. // With ViewModelFactory val viewModel = ViewModelProvider(this, YourViewModelFactory).get(YourViewModel::class.java) //Without ViewModelFactory val viewModel = ViewModelProvider(this).get(YourViewModel::class.java) 2020/5/15 Update I found another elegant way to achieve this, Android KTX can help implementation “androidx.fragment:fragment-ktx:1.2.4” val viewmodel: MYViewModel by viewModels() val viewmodel: MYViewModel by viewModels { myFactory … Read more

Configuration on demand is not supported by the current version of the Android Gradle plugin

No need to downgrade! Disabling configure on demand requires two steps: Remove org.gradle.configureondemand from gradle.properties. In Android Studio, For Mac go to the Preferences > Build, Execution, Deployment > Compiler and uncheck the configure on demand. For Linux/Windows go to the File > Settings > Build, Execution, Deployment > Compiler and uncheck the configure on … Read more