我正在阅读关于Android的房间库.我看到他们改变包装android来androidx.我不明白.请有人解释一下.
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
即使这也适用于android包装.
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
androidx而不是android.android android-architecture-components android-jetpack androidx
我已经成功配置了android-P SDK环境.当我尝试使用android设计支持库时,我面临项目构建错误.项目配置是:
IDE:3.2 Canary 17目标API:28编译API:28
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.app.navigationpoc"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
    implementation 'com.android.support:design:28.0.0-alpha3'
    implementation 'com.android.support:cardview-v7:28.0.0-alpha3'
}
并且构建失败的错误是:
清单合并失败:来自[androidx.core:core:1.0.0-alpha3] AndroidManifest.xml:22:18-86的属性应用程序@ appComponentFactory值=(androidx.core.app.CoreComponentFactory)也出现在[com.android] .support:support-compat:28.0.0-alpha3] AndroidManifest.xml:22:18-91 value =(android.support.v4.app.CoreComponentFactory).建议:在AndroidManifest.xml:6:5-40:19中添加'tools:replace ="android:appComponentFactory"'来覆盖.
android android-studio android-design-library android-9.0-pie
什么是Jetifier?例如,要使用androidx打包的依赖项创建一个新项目,这个新项目需要将以下行添加到gradle.properties文件中:
android.enableJetifier=true
那是什么意思 - "启用jetifier"?
当我按下Android Studio中的播放按钮时,我的应用程序会编译,但会显示此错误(编辑):
错误:程序类型已存在:android.arch.lifecycle.LiveData
我试过删除.gradle文件夹,然后去Build > Clean Project和Build > Rebuild Project.但是,它不起作用.我也尝试删除源代码,然后再次克隆git并将文件夹导入Android Studio.但是,它仍会产生该错误.
这是我的应用程序app/build.gradle:
Error:Program type already present: android.arch.lifecycle.LiveData
android android-studio android-gradle-plugin android-livedata