如何在 Android Studio 中将 android API 26 更改为 29+?
How to change android API 26 to 29+ in Android Studio?
如何从 API 26 更改为 29+,当我尝试在 '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'
的项目结构中更改它时出现错误
如果我更新以下插件,我的所有资源文件都会出错。有没有办法在不修改布局文件的情况下迁移到androidX。我需要从 <android.support.constraint.ConstraintLayout>
更改代码
到所有资源文件中的 <androidx.constraintlayout.widget.ConstraintLayout>
。
如何将应用程序上传到 google 播放 需要 API 29?
这是我的build.gradle
build.gradle(应用级别)
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(项目级别)
// 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
}
这是我的布局文件
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>
为了支持API 29,你必须将你的项目迁移到AndroidX,即mandatory.Since android X使用不同的库,所以你需要更改您的依赖项,并对布局文件进行一些更改。
但是 Android Studio 中有实用程序可以将您的代码迁移到 AndroidX。在这种情况下,您不必更改库或布局。
在 Android Studio 中的重构下找到 'Migrate to AndroidX' 的选项。
完成后,您会遇到非常基本的错误,这些错误很容易修复。
如何从 API 26 更改为 29+,当我尝试在 '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'
的项目结构中更改它时出现错误
如果我更新以下插件,我的所有资源文件都会出错。有没有办法在不修改布局文件的情况下迁移到androidX。我需要从 <android.support.constraint.ConstraintLayout>
更改代码
到所有资源文件中的 <androidx.constraintlayout.widget.ConstraintLayout>
。
如何将应用程序上传到 google 播放 需要 API 29?
这是我的build.gradle
build.gradle(应用级别)
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(项目级别)
// 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
}
这是我的布局文件 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>
为了支持API 29,你必须将你的项目迁移到AndroidX,即mandatory.Since android X使用不同的库,所以你需要更改您的依赖项,并对布局文件进行一些更改。
但是 Android Studio 中有实用程序可以将您的代码迁移到 AndroidX。在这种情况下,您不必更改库或布局。
在 Android Studio 中的重构下找到 'Migrate to AndroidX' 的选项。
完成后,您会遇到非常基本的错误,这些错误很容易修复。