How to change from API 26 To 29+, I'm getting error when I tried changing it in project structure on 'com.android.support:appcompat-v7:26.1.0', 'com.android.support:design:26.1.0', 'com.android.support.constraint:constraint-layout:1.0.2', 'com.android.support:cardview-v7:26.1.0'
If i update following plugins I'm getting error with all my resource file. Is there any way to migrate to androidX without modifying the layout files. I need to change code from <android.support.constraint.ConstraintLayout>
to <androidx.constraintlayout.widget.ConstraintLayout>
in all resource file.
How can I upload the app to google play witch requires API 29?
This is my build.gradle
build.gradle(app level)
apply plugin: 'com.android.application'
android {
lintOptions{
checkReleaseBuilds false
abortOnError false
}
compileSdkVersion 29
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "ak.wp.meto"
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.1.0'
//retrofit, gson
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
//firebase
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'com.google.firebase:firebase-ads:11.6.0'
//glide
compile 'com.github.bumptech.glide:glide:4.3.1'
//circular imageview
compile 'de.hdodenhof:circleimageview:2.1.0'
}
apply plugin: 'com.google.gms.google-services'
build.gradle( project level)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my layout file activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
layout="@layout/toolbar_main"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<include layout="@layout/content_main" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigationView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/white"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/menu_drawer" />
</android.support.v4.widget.DrawerLayout>
In order to support API 29 ,you have to migrate your project to AndroidX, that's mandatory.Since android X uses different libraries ,so you need to change your dependencies ,and make some changes in layout files too.
But there is utility inside Android Studio to migrate your code to AndroidX. In that case you don't have to change your libraries or layouts.
Find the option to 'Migrate to AndroidX' under refactor in Android Studio.
When it's done you will get very basic errors which can be fixed easily.