How do I change android Dependencies for SDK - android

I am pretty new to releasing apps for android on google play. They changed their minimum SDK requirements to version 30. I initially compiled the code with SDK 28. I changed the compile SDK version to 30 and the target sdk version to 30. But the dependencies are version 28. How do you change the dependencies to reflect the changes? I have already downloaded SDK 30.

1.Hover over the dependencies and if they need update they will be yellow in color
2.Click on bulb sign on left and change it to its latest version and click sync now
3.Like this:-
implementation 'com.github.bumptech.glide:glide:3.12.1'
to
implementation 'com.github.bumptech.glide:glide:4.11.0'
4.Also Check your buildgradle version in build.gradele(project) file

Related

Dependency 'androidx.appcompat:appcompat-resources:1.6.1'

Dependency 'androidx.appcompat:appcompat-resources:1.6.1' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.1 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
How do I fix this android studio roblem?
I clearly had no idea what should I do
This is a dependency version contrast issue just replace your appcompact and ktx with these
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'

Can't determine type for tag '<macro name="m3_comp_bottom_app_bar_container_color">?attr/colorSurface</macro>'

I'm having a problem with running my android app:
Can't determine type for tag '<macro name="m3_comp_bottom_app_bar_container_color">?attr/colorSurface</macro>'
That is caused by 1.7.0:
implementation 'com.google.android.material:material:1.7.0'
You better stick to 1.6.0 till they fix this
implementation 'com.google.android.material:material:1.6.0'
In your build.gradle file where "dependencies" section is paste this:
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
in this section. And remove old strings with same text and other number versions. (in my case:
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
). Have worked for me.
source: https://github.com/facebook/react-native/issues/33926
Upgraded android gradle plugin to 7.2.2 and the problem is solved. Try updating Android Studio too
Rationale
To expand on the existing answers, the release notes for Material Components for Android 1.7.0 mentions that they have updated the minimum requirements for your project (emphasis mine):
New minimum requirements for your app's project:
Update to Android Gradle Plugin (AGP) version 7.2.0
Update to Gradle version 7.3.3
Update to Java 8 (version 1.8)
Update to Android Studio Chipmunk, version 2021.2.1
This is also mentioned in their (updated) Getting Started guide (again, emphasis mine):
5. Gradle, AGP, and Android Studio
When using MDC-Android version 1.7.0-alpha02 and above, you will need to make sure your project is built with the following minimum requirements, in order to support the latest build features such as XML macro:
Gradle version 7.3.3
Android Gradle Plugin (AGP) version 7.2.0
Android Studio Chipmunk, version 2021.2.1
Updating the Android Gradle Plugin
You can update the Android Gradle plugin as follows:
Gradle plugins DSL
The plugin declaration can be found in the top-level build.gradle/build.gradle.kts file:
plugins {
// Or "com.android.library"
id("com.android.application") version "7.2.2" apply false
}
Buildscript classpath
Update the AGP classpath dependency (usually in the top-level build.gradle/build.gradle.kts file):
classpath("com.android.tools.build:gradle:7.2.2")
update your build.gradle file as below:
classpath 'com.android.tools.build:gradle:7.2.1'
It will fix the issues, remember v7.3.x wont fix the issue, so stick to 7.2.1 as of now.
For Flutter User with this issue this is how you solve it::
Goto : build.gradle
change "classpath 'com.andriod.tools.build:gradle:5.6.0'"
to
"classpath 'com.andriod.tools.build:gradle:<latest version>'"
in my case :: classpath 'com.android.tools.build:gradle:7.2.1'
then goto :: android/gradle/wrapper/gradle-wrapper.properties
then change
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.3-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-<latest>-all.zip
in my case distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
In build.gradle(:app),
Updating, compileSdk and targetSdk to 33 helped me(from 32).
In order to get over with this. Upgrade to the latest gradle version as well as latest Android Studio.
I was also facing this issue and I followed these steps :
Upgraded Android Studio to Android Studio Dolphin | 2021.3.1 Patch 1
gradle version to 7.3.1 in project build.gradle
kotlin version to 1.7.20 in project build.gradle
targetSdkVersion and compileSdkVersion to 33
latest version of dependencies in app's build.gradle
And the project is perfectly working fine now.
I resolved it by replacing implementation 'androidx.recyclerview:recyclerview:1.2.1' instead of implementation 'com.google.android.material:material:1.7.0' in build.gradle(:app)
Upgraded android gradle plugin >= 7.1.0 and the problem is solved.
classpath "com.android.tools.build:gradle:7.1.0"
After wasting 2 hours and ruining my mood solution was simply upgrading your android studio version, most probably you are using an older version like Arctic fox or something like that, upgrade to dolphin or something higher. Hope it help, and yes in dolphin version it will give error of 30.0.3 but don't worry it gives you an attached link to install 30.0.0 SDK in console itself, so chill and keep developing.
first, in the gradle build file, change the implementation from 1.7.0 to 1.6.0
Next, open the colors file and change the color of the tag (#) which has 7 digits to a 6 digit tag. Because usually the default color of tags on Android Studio is sometimes 7 digits or 6 digits
I solved this by :
Adding in build.gradle:
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
adding android:exported="true" in Manifest

Gradle and latest version of libraries

Why does Gradle not show latest versions of used libraries? For example latest versions of ExoPlayer is 2.9.4, BlurView - 1.5, Android Billing Client - 1.2.1, but Gradle allows to add only 2.8.4, 1.2, 1.0 for these libraries.
As per today's date the latest gradle version is:
classpath 'com.android.tools.build:gradle:3.3.1'
After updating gradle, Try following things to see updated versions with yellow marks in build.gradle.
Invalidate Cache and Restart
or
Close and open again build.gradle
Hope it will get refreshed and display latest versions.

Gradle complaining on wrong Android support libraries versions

I want to use a GraphView in my app, and so I added implementation 'com.jjoe64:graphview:4.2.2' to my app-level gradle.build file.
However that causes an error stating that all com.android.support libraries should have the same version.
It gives com.android.support:support-compat:27.1.1 as an example (all of the libraries I explicitly use are 26.1.0).
I suppose it's a dependency of the GraphView library, but I don't know what to do next.
My target SDK version is 26 so I can't change all the other versions to 27. What can I do to use this library?
Follow below step:
1>If compileSdkVersion is 27 You have to change to 27
enter image description here
2>If you still caught error uninstall and install SDK Target version from SDK Manager.

How can I download an old version of the Android support library?

I'm targeting Android 19 (because that's what my phone is running). I want to add a notification with buttons; it seems the right approach is to use appcompat-v7.app.NotificationCompat.
However, when I add appcompat-v7 from the Android Support repository revision 22.2 (via a build.gradle dependency), it includes a file app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/res/values-v21/values-v21.xml that doesn't compile because it assumes the target is 21+.
I tried deleting that file, but it gets regenerated.
There doesn't seem to be a way to exclude a file from the build.
So, I need to get an older version of the support library or repository, that doesn't include 21 stuff.
I guess I could import all the sources directly (and leave out the v21 stuff), rather than thru the dependency? I'm not clear where to start with that.
I can use the SDK manager to get older versions of the SDK, but it only offers the latest version of the support library.
to directly answer your question it's all that one line on gradle:
compile 'com.android.support:appcompat-v7:22.2.0'
That last part is the version you're getting. 22.2.0 on the example above.
and on this link you can check the revisions numbers:
https://developer.android.com/tools/support-library/index.html#revisions
But you have a fundamentally wrong approach to your issue. You don't have to target the API for the device you have with you. You can easily and safely target the latest API, use the latest AppCompat features and bug fixes.
Lint will give you a warning every time you try to use a feature that is not from your minimumApi, regardless of the targetAPI
In your gradle build file change the dependency to be the 19 version (the version of the library should match the sdk you are compiling with):
dependencies {
compile 'com.android.support:appcompat-v7:19.1.+'
...
}
Edit: If v19 of the support lib doesn't have NotificationCompat, then you can't use that unless you compile against a later SDK. You can't include a support library with a higher version than your compiled SDK - that's the issue you are running into.
In this case change:
android {
compileSdkVersion 22
...
}
and leave the dependency set to the 22 version of the appcompat support lib

Categories

Resources