After facing a several issue as mentioned in the question , i successfully updated targetSdkVersion and compileSdkVersion of my projects to 28 , and here i will write all the steps i followed and the changes i did.
1 - updating my android studio to the latest version
2 - updating my gradle plugin version , gradle version (5.4.1 )
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
.........
}
3 - migration to androidx libraries
4 - updating all 3rd libraries (Firebase , google play services , Picasso ,.....) to the latest version
implementation 'com.google.firebase:firebase-appindexing:19.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.f0ris.sweetalert:library:1.5.1'
implementation 'com.google.firebase:firebase-messaging:20.0.1'
..........
..........
5 - Updating google-services plugin version to the latest version
dependencies {
........
classpath 'com.google.gms:google-services:4.3.3'
}
6 - Adding google() repository in project gradle
repositories {
jcenter()
google()
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com'
}
google()
}
}
7 - Adding Java 8 as compileOption in app gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
For the changes , it really depends on the widgets and the library you are using , but in general some important point should be mentioned :
1. Enabling requests to all types of connections HTTP and HTTPS
Add usesCleartextTraffic to AndroidManifest.xml
<application
...
android:usesCleartextTraffic="true"
...>
Indicates whether the app intends to use cleartext network traffic, such as cleartext HTTP. The default value for apps that target API level 27 or lower is "true". Apps that target API level 28 or higher default to "false".
2 - Deprecation and method change
Some method will be mentioned as deprecated or even not found , so make sure will inspect every line of your code to update or rewrite the suspected method
3 - Widgets properties deprecation
As written above ,some widgets could be concerned with the update done before , so make sure to inspect your layout for deprecation or issues
NB:
If there is something to notice or add here , it would be great . hope it would help someone else in the future .