• Home
  • WordPress
  • web Hosting
    • Free hosting
    • Cheap Hosting
    • comparison cloud , vps, shared, wordpress
    • managed wordpress hosting
    • managed cloud hosting
  • page Speed
  • Deals
  • Services
  • About

RAaz Kumar .com

wordpress tutorials seo hosting etc


migrating to androidx (The library & dependency matching)

 

the Errors

Your app currently targets API level 27 and must target at least API level 28 to ensure that it is built on the latest APIs optimised for security and performance. Change your app’s target API level to at least 28. Find out how.

 

Changing Dependency version to 28

implementation ‘com.android.support:support-v4:28.0.0’
implementation ‘com.android.support:appcompat-v7:28.0.0’
implementation ‘com.android.support:customtabs:28.0.0’

implementation 'com.android.support:design:28.0.0'

Sync error

This project uses AndroidX dependencies, but the ‘android.useAndroidX‘ property is not enabled. Set this property to true in the gradle.properties file and retry.
The following AndroidX dependencies are detected: androidx.versionedparcelable:versionedparcelable:1.0.0, androidx.fragment:fragment:1.0.0, androidx.slidingpanelayout:slidingpanelayout:1.0.0, androidx.core:core:1.0.0, androidx.customview:customview:1.0.0, androidx.swiperefreshlayout:swiperefreshlayout:1.0.0, androidx.interpolator:interpolator:1.0.0, androidx.loader:loader:1.0.0, androidx.drawerlayout:drawerlayout:1.0.0, androidx.viewpager:viewpager:1.0.0, androidx.collection:collection:1.0.0, androidx.localbroadcastmanager:localbroadcastmanager:1.0.0, androidx.lifecycle:lifecycle-common:2.0.0, androidx.arch.core:core-common:2.0.0, androidx.annotation:annotation:1.0.0, androidx.lifecycle:lifecycle-livedata:2.0.0, androidx.legacy:legacy-support-core-ui:1.0.0, androidx.lifecycle:lifecycle-viewmodel:2.0.0, androidx.lifecycle:lifecycle-livedata-core:2.0.0, androidx.browser:browser:1.0.0, androidx.arch.core:core-runtime:2.0.0, androidx.legacy:legacy-support-core-utils:1.0.0, androidx.documentfile:documentfile:1.0.0, androidx.cursoradapter:cursoradapter:1.0.0, androidx.lifecycle:lifecycle-runtime:2.0.0, androidx.coordinatorlayout:coordinatorlayout:1.0.0, androidx.asynclayoutinflater:asynclayoutinflater:1.0.0, androidx.print:print:1.0.0
Affected Modules: app

Step 2 open gradle.properties add & sync

android.useAndroidX=true
android.enableJetifier=true
//Jetifier helps migrate third-party dependencies to use AndroidX.

Dependency Mapping

change compile sdk 28 to 29
28 intended for android pie and below
Old New
com.android.support:support-v4 androidx.legacy:legacy-support-v4
com.android.support:appcompat-v7 androidx.appcompat:appcompat
com.android.support:customtabs androidx.browser:browser
com.android.support:design com.google.android.material:material-rc01
com.android.support:swiperefreshlayout androidx.swiperefreshlayout:swiperefreshlayout
android.support.v7.widget.Toolbar androidx.appcompat.widget.Toolbar
android.support.v7.app.AppCompatActivity androidx.appcompat.app.AppCompatActivity
android.support.design.widget.TabLayout com.google.android.material.tabs.TabLayout
androidx.core.widget.DrawerLayout androidx.drawerlayout.widget.DrawerLayout
androidx.core.view.PagerAdapter androidx.viewpager.widget
androidx.core.view.ViewPager androidx.viewpager.widget
More at android artifact mapping

implementation ‘com.android.support:support-v4:28.0.0’
implementation ‘com.android.support:appcompat-v7:28.0.0’
implementation ‘com.android.support:customtabs:28.0.0’

implementation 'com.android.support:design:28.0.0'
to

implementation ‘androidx.legacy:legacy-support-v4:1.0.0’
implementation ‘androidx.browser:browser:1.2.0’

implementation ‘androidx.appcompat:appcompat:1.1.0’
implementation ‘com.google.android.material:material:1.1.0’
implementation “androidx.swiperefreshlayout:swiperefreshlayout:1.1.0”

Step 3: Lets fix compile time errors by library class Mapping

 

3.1 Refractor >> Migrate to Android Studio

Its not accurately adds new libraries. later you need find the libraries and fix it manually.

Step 1: refractor migrate to androidx

step 2: click on do refractor

Step 3: rebuild project

 

class mapping

all mappings here

Old New
import androidx.core.widget.DrawerLayout;
import android.support.v7.widget.Toolbar;
import android.support.v7.app.AppCompatActivity;

Artifact Mappings

https://developer.android.com/jetpack/androidx/migrate/artifact-mappings

old libraries

import android.support.customtabs.CustomTabsIntent;
import android.support.design.widget.TabLayout;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.widget.Toolbar;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;

 

android x library mapping
Note: Don;t tempt to modify the code / methods. (just a library issues)
CTRL+SHIFT+R to replace

Step 4: FIx runtime errors

Step 5: Layout library Modification

Duration: few hours.
I tried for 90%  used the updated source code by someone else
import android.support.design.widget.TabLayout;
android.support to android.x
Class mappings
android.support.design.widget.TabLayout
to
com.google.android.material.tabs.TabLayout
android.support.v7.widget.Toolbar
to
androidx.appcompat.widget.Toolbar
android.support.v7
to
androidx.appcompat
import androidx.core.app.Fragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
to
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
com.android.support:support-fragment would need to be replaced there with
androidx.fragment:fragment,
import android.support.v4.app.FragmentManager;
to
androidx.fragment.app.FragmentManager
import androidx.core.app.Fragment;
import androidx.core.app.FragmentManager;
import androidx.core.app.FragmentStatePagerAdapter;
core to fragment
import androidx.core.widget.DrawerLayout;
to
androidx.drawerlayout.widget.DrawerLayout
from
androidx.core.widget.SwipeRefreshLayout;
to
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
from
import androidx.core.view.PagerAdapter;
import androidx.core.view.ViewPager;
to
androidx.viewpager.widget.ViewPager
androidx.viewpager.widget.PagerAdapter
Required type:
android.app.AlertDialog.Builder
Provided:
androidx.appcompat.app.AlertDialog.Builder
fragmentactivity cannot be converted to appcompatactivity
This seems to be an import problem.
import android.app.Fragment;
import android.support.v4.app.Fragment;
androidx.fragment.app.FragmentManager
fallback
from
import androidx.appcompat.app.AlertDialog;
to
import android.app.AlertDialog;
import androidx.fragment.app.AlertDialog;
Required type fragment activity provided appcompat activity
cast to  import androidx.appcompat.app.AppCompatActivity;
Activity <- FragmentActivity <- AppCompatActivity <- ActionBarActivity
* Activity is the basic one.
* Based on Activity, FragmentActivity provides the ability to use Fragment.
* Based on FragmentActivity, AppCompatActivity provides features to ActionBar.
adancedwebiew jaa & webfragmentja.
186
actity to fragment actiity
found
androidx.fragment.app.FragmentActivity
Required
androidx.appcompat.app.AppCompatActivity
Found
import homeagment.app.FragmentActivity;
‘WebToAppWebClient(androidx.appcompat.app.AppCompatActivity, android.webkit.WebView)’ in ‘home.jsit.landrecord.widget.webview.WebToAppWebClient’ cannot be applied to ‘(androidx.fragment.app.FragmentActivity, home.jsit.landrecord.widget.AdvancedWebView)’
Static interface methods are only supported starting with Android N (–min-api 24): androidx.browser.trusted.TrustedWebActivityDisplayMode androidx.browser.trusted.TrustedWebActivityDisplayMode.fromBundle(android.os.Bundle)
Stack trace:
 missing “compileOptions” configuration in the AndroidManifest.xml file.
build.gradle App module
android{
   compileOptions {
     sourceCompatibility JavaVersion.VERSION_1_8
     targetCompatibility JavaVersion.VERSION_1_8
   }
}
    java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
Starting in version 17.0.0
if you update your Admob library in gradle then you need to add this in your manifest.
implementation ‘com.google.android.gms:play-services-ads:19.3.0’
in manifest file
   <application>
      <!– TODO: Replace with your real AdMob app ID –>
      <meta-data
          android:name=”com.google.android.gms.ads.APPLICATION_ID”
          android:value=”ca-app-pub-################~##########”/>
  </application>
Application id: package name /app id mostly same unless you change it.
AdMob app ID: add to admob
   <application>
<meta-data
          android:name=”com.google.android.gms.ads.APPLICATION_ID”
          android:value=”ca-app-pub-xxxxxxx~xxxxxx”/>
  </application>
google ad manager instead of admob
then
        <meta-data
            android:name=”com.google.android.gms.ads.AD_MANAGER_APP”
            android:value=”true”/>
class library match
android.app.AlertDialog.Builder
inconvertible types; cannot cast ‘androidx.fragment.app.Fragment‘ to ‘com.package.name.drawer.DrawerFragment‘
androidx.core.app.fragment not found
import androidx.core.app.Fragment; to androidx.drawerlayout.widget.DrawerLayout
import androidx.core.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
androidx.appcompat
android.support.design.widget.TabLayout
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.core.widget.SwipeRefreshLayout;
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import androidx.core.app.Fragment;
import androidx.core.app.FragmentManager;
import androidx.core.app.FragmentStatePagerAdapter;
Cannot Resolve Symbol ‘App’
Select tools>-android>-SDK manager
update available click apply

Restart the IDE

“File” -> “Invalidate Caches…”, and select “Invalidate and Restart” option to fix this.

Related topics:

  1. Fragment
  2. Material Design
  3. Handling Views
  4. Activity Lifecycle
  5. Fragments Runtime

tutorials

  • Vivek Bindra Videos Transcription (business strategy)
  • git commands
  • new relic php agent install in 3 steps
  • new relic mysql install integration - 2 ways fix problems
  • new relic installation linux (infrastructure agent , php, mysql , nginx)
  • xampp tutorials 2021 installation errors fix wordpress phpmyadmin mysql apache
  • Redis performance metrics & tuning for nginx apache ubuntu & debian
  • Devops course Syllabus topics PDF AWS, Azure, cisco, redhat
  • CCNA Syllabus pdf (CCNA / CCNP vs devops vs mcsa /MCSE)
  • how to create a website free of cost on google
  • what is vpn vs proxy vs tor, http vs https, http2, tcp vs udp, kali linux sql source code injection
  • nginx server tutorials (installation, configuration, performance tuning, security)
  • MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS
  • AUdio Editing Background Noise removal (Audacity, Adobe Premiere Addition, Camtasia Filmora Windows Obs)
  • Android Studio tutorials syllabus Topics Course details #AndroidApplicationDevelopment
    • Intent
    • SharedPreferences
    • Location
    • Libraries
    • Webservices
    • Creating Activity class
    • Creating XML
    • Registering Activity in AndroidManifest.xml:
    • Steps for creating an Android application:
    • Handling button clicks
    • Identifying Views
    • Getting Text from Views
    • intent with Data
    • Database with Cursor Adapter
    • Resources Handling in Android
    • Intent with Result Data
    • Broad cast Receiver
    • Fragment
    • Handling Button click by using On Click Listener:
    • Material Design
    • RecyclerView
    • JSON
    • Rename Android Package [with images & video 2020]
    • migrating to androidx (The library & dependency matching)
    • adsense on webview , adsense & admob policies & implementation
    • Fragments Runtime
    • JSON parsing
    • Handling Views
    • RelativeLayout
    • ActionBar
    • ListView
    • Custom List View
    • Dialogs
    • AlarmManager
    • Notifications
    • Vibration
    • WebView
    • Options Menu
    • SQLiteDatabase
    • Bluetooth
    • WiFi
    • Google Maps
    • Handling Activity Back Button
    • AsyncTask
    • Runtime Permissions
    • Logging
    • Activity Lifecycle
    • Toast
    • Service
  • [INTRO] Ethical hacking / cyber Security / Penetration testing Tutorial -{updates frequently}
  • redis install ubuntu 20.04 with wordpress php redis mysql configuration
  • ubuntu tutorials installation download issues etc
  • Php tutorials
  • HTML & CSS Tutorials
  • Core Java Tutorial Free online
  • Linux sysadmin tutorials linux system administrator
  • apache server tutorial (install,config, performance tuning, security, error handling)

 

 

wordpress Pagespeed optimization

Digitalocean free $100 Credit

Cloudways Review pricing promo codes

Siteground cpu limits Pricing

Shared Hosting

Managed wordpress Hosting

Managed Hosting Cloud server

VPS Hosting

Cloud Hosting – Unmanaged

Google cloud Pricing

Aws Pricing

Azure pricing

nginx server tutorials

apache server tutorials

linux sysadmin tutorials

mysql Commands list pdf

LEMP Install Ubuntu

Mysql Performance Tuning

Nginx Performance tuning

Linux Performance tuning

Php -fpm performance tuning

Redis Performance tuning

linux server security

nginx security best practices

wordpress security plugins

 

 

wordpress

 

Top 5  WP Google Analytics Plugins

WP Backup Plugins

Wp Comment Plugins

Top wordpress Security Plugins

WP Seo Plugins

WP Caching Plugins

Best Adsense Plugins for WordPress

Wp social Sharing Plugins

autoshare social media plugins

WP speed Optimization Plugins

Speedup WordPress google Score

More Wp tuts

Server Admin Cloud

 

Installing Nginx LEMP On ubuntu

Installing apache Lamp ubuntu

nginx fastcgi cache enable

php – fpm install  & Configuration

Opcache install & Configure

php -fpm pool manager explained

Mysql Install & Configuration

Redis Object cache install & configure

 

Nginx as Reverse Proxy and Load balancer

Load Balance / auto scaling in google cloud

Linux Commands PDF

Mysql Commands Pdf

Letsencrypt tutorial

mysqldump export & import 

Pagespeed Module install & configure

nginx.conf best file

mysql.conf best file

upgrade ubuntu

© 2023 - All Rights Reserved Disclaimer & Privacy Policy