- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要在使用 Android 导航和动态功能的应用程序中添加对 androidx.fragment:fragment-ktx:1.3.0-beta01 的依赖项。我需要调用 setFragmentResult
的依赖项,但应用程序将停止工作,但出现以下异常
"no class definition found"
在运行时。请帮助...
更新
这是我的应用程序构建 gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
android {
compileSdkVersion 29
defaultConfig {
applicationId "it.kfi.lorikeetmobile"
minSdkVersion 25
targetSdkVersion 29
versionCode 2
versionName "1.0b"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
/*javaCompileOptions {
annotationProcessorOptions {
arguments = [
"room.incremental":"true",
"room.expandProjection":"true"]
}
}*/
}
//kotlin DSL
// configurations.all {
// resolutionStrategy {
// force("org.antlr:antlr4-runtime:4.7.1")
// force("org.antlr:antlr4-tool:4.7.1")
// }
// }
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
/*dataBinding {
enabled = true
}*/
kapt { generateStubs = true }
buildFeatures {
dataBinding = true
viewBinding = true
}
dynamicFeatures = [":jay", ":stock", ":meddler", ':goods', ':flash', ':inventory', ':harry', ':louis', ':avery']
buildToolsVersion buildToolsVer
//kotlin DSL
/*configurations.all {
resolutionStrategy {
force("org.antlr:antlr4-runtime:4.7.1")
force("org.antlr:antlr4-tool:4.7.1")
}
}*/
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
api 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_ver"
api "androidx.navigation:navigation-ui-ktx:$nav_version"
api "androidx.navigation:navigation-fragment-ktx:$nav_version"
api "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
//ROOM
kapt "androidx.room:room-runtime:$room_version"
//kapt "android.arch.persistence.room:compiler:$room_version"
kapt "androidx.room:room-compiler:$room_version" // For Kotlin use kapt instead of annotationProcessor
// optional - Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:$room_version"
//implementation "androidx.room:room-coroutines:$room_version"
// optional - RxJava support for Room
implementation "androidx.room:room-rxjava2:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture
implementation "androidx.room:room-guava:$room_version"
// Test helpers
testImplementation "androidx.room:room-testing:$room_version"
//PAGING
//implementation "androidx.paging:paging-runtime:$paging_version"
implementation "androidx.paging:paging-runtime-ktx:$paging_version"
kapt "com.android.databinding:compiler:3.1.4"
api 'com.squareup.retrofit2:converter-gson:2.9.0'
api 'com.squareup.retrofit2:retrofit:2.9.0'
api 'com.squareup.okhttp3:logging-interceptor:4.9.0'
api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation project(path: ':avatarLib')
implementation project(path: ':ScanditCaptureCore')
implementation project(path: ':ScanditLabelCapture')
implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc03"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.paging:paging-runtime-ktx:$paging_version"
implementation "androidx.fragment:fragment-ktx:1.3.0-beta01"
}
更新 2
如果我将依赖项从实际使用它的动态功能移动到主应用程序 (app gradle),应用程序不会启动,我会收到以下异常:
无法开始 Activity
ComponentInfo{it.kfi.lorikeetmobile/it.kfi.lorikeetmobile.ui.MainActivity}:android.view.InflateException: Binary XML file line #12: Binary XMLfile line #11: Error inflating class fragment
....我不知道该怎么办
最佳答案
看起来您需要将实现“androidx.activity:activity-ktx:1.1.0”
添加到您的依赖项列表中才能工作
关于android - androidx.fragment :fragment-ktx:1. 3.0-beta01 添加依赖导致运行时异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65093431/
我回到我的 Android 项目来完成它的工作,突然我收到此错误消息 “无法解析 androidxAffected 模块:app” “错误:无法解析:androidx。受影响的模块:应用程序” 这是我
我今天尝试使用 Android Studio 中的“重构 -> 迁移到 AndroidX”选项将我当前的项目迁移到 AndroidX,每当我尝试编译我的应用程序时,我都会收到一个 Program ty
当我尝试构建应用程序时,它在构建选项卡上给了我这个错误 More than one file was found with OS independent path 'META-INF/androidx
我在尝试构建 Android 应用程序时遇到以下问题。我遇到了一些关于强制或使用手动依赖项解决策略的 android 帖子。这似乎并没有解决问题。 有人问过类似的问题:Similar stack ov
我刚刚通过 Android Studio 菜单选项 Refactor -> Refactor to AndroidX 迁移到 androidx 我收到以下错误: android.view.Inflat
我用 kotlin 开始新的 android 应用程序项目。我的 sdk gradle 配置是 compileSdkVersion 29 和 buildToolsVersion "29.0.1" 我试
我迁移到 AndroidX,然后如果我尝试使用 API 29 将项目运行到模拟器中,我会收到错误。 API 28 及之前的模拟器/真实设备没有问题。 java.lang.RuntimeExceptio
我正在开发 Android MVVM 应用程序。我只是手动切换到 androidx 库。这是我的 build.gradle 中的库: implementation 'com.google.code.g
在迁移到 AndroidX 并将所有 AndriodX 包更新到最新版本后,构建将失败,在 obj 中的构建生成的 XML 文件中显示三个类似的错误文件夹: \obj\Debug\100\lp\117
从 更新导航组合依赖后2.4.0-alpha03 至 2.4.0-alpha05 在尝试在可组合屏幕之间导航(例如从 taskComposable 导航到 listComposable 屏幕)后,我遇
我刚刚通过 Android Studio 菜单选项 重构 -> 重构到 AndroidX 迁移到 androidx 我收到以下错误: android.view.InflateException: Bi
我创建了一个 Android 应用程序,并从 Gallery 添加了“Navigation Drawer Activity”,我删除并重命名了菜单项。当我单击抽屉 Activity 中的任何菜单项启动
我正在制作一个项目,但是当我编译我的项目并在 Android Studio 上启动应用程序时,我的应用程序崩溃了。 在我的 Logcat 错误中 Process: com.passionategeek
完整的堆栈仅包括 android 核心代码: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean and
将项目迁移到 AndroidX 后出现以下错误:程序类型已经存在androidx.concurrent.futures.DirectExecutor 我的应用Gradle如下: configu
我想在 Play 商店中更新应用程序的版本,但在测试中我开始收到此错误。 Superclass androidx.core.app.f of androidx.activity.ComponentAc
AndoirdX 升级后出现错误。 android.databinding.tool.util.LoggedErrorException: failure, see logs for details.
将项目迁移到 AndroidX 后我遇到了这个崩溃 Unable to start activity ComponentInfo{oackagename/com.paymob.acceptsdk.P
我的导航 Controller 中有此错误,我已经更改了 XML 中的声明,但没有帮助,我更改了 Fragment 为 FragmenContainer,但没有帮助。谁能帮我解决这个错误? 日志: E
我创建了一个水平回收器 View ,其中加载了项目。之后,我需要选择该项目并执行点击事件。到这个存档(代码在下面可用),现在我想改变点击项目的颜色,剩下的项目应该被取消选择。如果我没有正确查询,请道歉
我是一名优秀的程序员,十分优秀!