类 'androidx.compose.ui.platform.ComposeView' 由新的 Kotlin 编译器后端编译,旧编译器无法加载
这是我的 onCreate 方法:
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_delivered, container, false).apply {
findViewById<ComposeView>(R.id.compose_view).setContent {
MaterialTheme {
Surface {
Text("Hello")
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
编写版本:
accompanistVersion = "0.1.9"
composeVersion = '0.1.0-dev17'
Run Code Online (Sandbox Code Playgroud)
应用程序.gradle
buildFeatures {
compose true
dataBinding true
}
composeOptions {
kotlinCompilerVersion rootProject.kotlinVersion
kotlinCompilerExtensionVersion rootProject.composeVersion
}
// Compose
implementation "androidx.compose.runtime:runtime:$rootProject.composeVersion"
implementation "androidx.compose.ui:ui:$rootProject.composeVersion"
implementation "androidx.compose.foundation:foundation:$rootProject.composeVersion"
implementation "androidx.compose.foundation:foundation-layout:$rootProject.composeVersion"
implementation "androidx.compose.material:material:$rootProject.composeVersion"
implementation "androidx.compose.ui:ui-viewbinding:$rootProject.composeVersion"
implementation "androidx.ui:ui-tooling:$rootProject.composeVersion"
implementation "androidx.compose.runtime:runtime-livedata:$rootProject.composeVersion"
implementation "com.google.android.material:compose-theme-adapter:$rootProject.composeVersion"
implementation …Run Code Online (Sandbox Code Playgroud) 我正在使用Androidx,android jetpack导航带导航抽屉不显示后退按钮和mobile_navigation.xml中给出的标题,导航我试过用nav_view.setupWithNavController(navController)不能正常工作,工作室显示未解决的符号.我已经为项目添加了必需的依赖项
Gradle.build:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.qbitstream.salesmanagementsystem"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
def nav_version = "1.0.0-alpha04"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-rc01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-rc01'
implementation 'com.google.android.material:material:1.0.0-alpha1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation "android.arch.navigation:navigation-fragment:$nav_version" // use -ktx …Run Code Online (Sandbox Code Playgroud) android kotlin android-jetpack android-architecture-navigation
java.lang.RuntimeException:找不到com.qbitstream.salesmanagementsystem.data.AppDatabase的实现.androidx.room.Room.getGeneratedImplementation(Room.java:94)中不存在AppDatabase_Impl
我在gradle文件中添加了所有内容.我的gradle文件如下所示
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.qbitstream.salesmanagementsystem"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
def nav_version = "1.0.0-alpha04"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-rc01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-rc01'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation "android.arch.navigation:navigation-fragment:$nav_version" // use -ktx for Kotlin
implementation "android.arch.navigation:navigation-ui:$nav_version" // use …Run Code Online (Sandbox Code Playgroud) 在命令行的配置阶段无法创建opensrf用户。我得到的错误如下:/ usr / sbin / ejabberdctl:行428:4052分段错误$ EXEC_CMD“ $ CMD”