“JCenter is at end of life” android lint warning, what is the replacement?

There’s a documentation section describing the problem: JCenter deprecation and end of service. You can find the link by expanding the inspection description (Ctrl+F1). The documentation states: JFrog, the company that maintains the JCenter artifact repository used by many Android projects, recently announced the deprecation and upcoming retirement of JCenter. According to the announcement, JCenter … Read more

OpenCv with Android studio 1.3+ using new gradle – undefined reference

After few weeks of pain, I succed. Here is my correct code for Android studio 1.3.1, OpenCv 2.4.11. First you should do this OpenCV in Android Studio (don’t use paths which contains white space, both for project and opencv extraction folder) then, for opencv to be native: gradle-wrapper.properties: distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip build.gradle(application): classpath ‘com.android.tools.build:gradle-experimental:0.2.0’ build.gradle(module): apply plugin: … Read more

Getting Error “Gradle DSL method not found: ‘compile()'” when Syncing Build.Gradle

In almost all cases, your dependencies should be put into the individual module’s build.gradle files rather than at the top most level build.gradle file. In your case, that means the dependency should be added to the app module’s build.gradle file: dependencies { compile fileTree(dir: ‘libs’, include: [‘*.jar’]) compile “com.android.support:support-v4:18.0.+” } And you should remove the … Read more

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

Error: File path too long on windows, keep below 240 characters

You could also try changing your build directory for your project since that is where most of the path issues will arise. In your root build.gradle file allprojects { buildDir = “C:/tmp/${rootProject.name}/${project.name}” repositories { … } } Android Studio will pick up on the change and still show your new build location in the Project … Read more

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