Android Studio not recognizing v7 libraries and recyclerView after the update - android-studio

I have been working on a old project targetSdkVersion 25. It uses "com.android.support:recyclerview-v7:28.0.0" dependency for recyclerView. After I have update the android studio it is not recognizing the recyclerView imports and class.

Related

The rendering library could not be initialized

After lots of time invested in android studio bumblebee 2021.1.1, android design and blueprint are not showing the design layout. Anyone is here who can help or suggest the best solution.
compileSdkVersion and targetSdkVersion also shift from any version 32 to 21.

Android Studio Designer Preview went Black after implementing Material Components library

I am new in Android Development. In the latest version of Android Studio I want to use Material Components for my app. But after implementing its gradle script my Android Studio Designer Preview went black/blank. As you can see in screenshot below.
I have implemented the following line in my build.gradle
implementation 'com.google.android.material:material:1.4.0'
After removing the material components library the preview looks as it should.
I have also tried to restart Android studio as well as my computer.
I just realised that I have used
implementation 'com.google.android.material:material:1.4.0'
instead of
implementation 'com.google.android.material:material:1.4.0-rc01'
Now the issue has been fixed.

Unable to migrate Flutter project to AndroidX

I have a Flutter project in Android Studio. I am planning to migrate to AndroidX. Whenever I do Refactor -> Migrate to AndroidX, Android Studio shows error message:
You need to have compileSdk set to at least 28 in your module build.gradle to migrate to AndroidX.
However I have already set the compileSdkVersion 28 in my app/gradle.build file.
Is there anything else I need to do?
I was able to resolve my issue:
Open the Flutter project into Android Studio
Right click on the android directory, click on Flutter -> Open Android module in Android Studio. It asked me to upgrade my gradle plugin.
Then I installed Google Play Services. Tools -> SDK Manager -> SDK Tools and check the Google Play Services.
After the Google Play Services Installed, I did Refactor -> Migrate to AndroidX.
It started working.
Note: Do the refactor from the project window you opened in the step 2.
Here is how I got rid of "compileSdkVersion 28" error. But before I solved it this way, I upgraded Android Studio IDE from 3.4.1 -> 3.5.1. I am not sure if this was really needed. So whatever version of IDE you have, see if you can use following steps to solve it.
Go to "Project Structure" - (2nd icon on left of AVD Manager icon on top right corner of IDE)
On "Project Structure" dialog under left navigation click on Project Settings->Modules
After selecting Modules, on the right pane you should see 3 tabs Sources, Paths, Dependencies
Click on Dependencies, if you are getting compileSdkVersion 28 error the SDK version under Dependencies is pointing to version lower than 28 -> Select 28 or higher
5. Click OK
Now Refactor->Migrate to AndroidX worked for me
In gradle.build (app) add this
compileSdkVersion 28
defaultConfig {
......
minSdkVersion 21
targetSdkVersion 28
......
}
And there are some implementations required to use androidx :-
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
And add these given two lines(below) to gradle.properties:-
android.useAndroidX=true
android.enableJetifier=true
I'm having exact same problem. Been trying to migrate since all the new firebase stuff is forcing it, but the current guides to upgrade are sparse. First I was trying on a backup of my project with a lot of addons and kept getting that error, then I created a brand new flutter project with all the latest (dev channel), followed every step, checked every detail, read every forum, but still getting "You need to have compileSdk set to at least 28 in your module build.gradle to migrate to AndroidX."...
Matched the steps from https://androidxhackathon.blogspot.com/2018/05/refactor-to-android-x.html too and can't get it to refactor right.
Even went to File>ProjectStructure>Project SDK and set to Android API 28 Platform.
Anyone know what we might be missing? Did you have any luck Sam?
Click on Invalidate cache/Restart from file option worked for me
Try replacing the default in dependencies {...} in app/build.gradle with this:
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
The replacement is similar to what is posted in the "Not recommended..." section from this link: https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility
If you can explain why this works, please add a comment. Thank you!
Go to "Project structure" in the Files menu. Clear out every issue you see there, like
set the android sdk, fix the problems specified
A simple solution.
follow the steps.
Create a new app --> (tick androidX in the window) --> finish
Add some lines in the android --> app --> build.gradle as follow,
update the defaultConfig
minSdkVersion 19
targetSdkVersion 28
multiDexEnabled true
Go to Refractor --> migrateToAndroidx
Do Flutter clean
Restart
Run
hope it works now ...

How to see RecyclerView and other support lib sources in Android Studio 3.0

I'm using Android Studio 3.0 and my project uses RecyclerView
compile "com.android.support:recyclerview-v7:26.1.0"
When I try to open RecyclerView class sources (with go to class dialog), I see only decompiled version of the class. Same thing happens to all other classes from support lib.
Some of my colleagues use Android Studio 3.0 and have the same problem. But others have Studio 2.3 and everything is working OK for them.
Is there any workaround to see RecyclerView and other support lib sources in Studio 3.0?

Why does gradle have 1:1 mapping with android studio versions

Recently I upgraded Android Studio 3.0 Beta 7 to Android Studio 3.0 RC 1. The dependancies in build.gradle also got changed from classpath 'com.android.tools.build:gradle:3.0.0-beta7' to classpath 'com.android.tools.build:gradle:3.0.0-rc1'
Gradle is a build tool managed by entirely separate organization, separate community. Then how come gradle make their releases with android studio?
In fact, gradle does not have 1:1 mapping with android studio versions. There is no relationship between gradle and android studio versions.
com.android.tools.build:gradle is a gradle plugin for Android developed by Google team.From here, you can see the plugin requires gradle version.For example, if the plugin version is 2.3.0+, you should use gradle whose version is 3.3+.In addition, you can check gradle version in rootProject/gradle/wrapper/gradle-wrapper.properties
In your case, you can also downgrade 'com.android.tools.build:gradle:3.0.0-beta7' to 'com.android.tools.build:gradle:3.0.0-rc1' and it can works. However different plugin version, different performance.

Resources