実現したいこと
Andorid13のアプリ対応にて使用していたandroidサポートライブラリが使用できなくなったため
Androidxのライブラリに変更しようと修正したところエラーとなってビルドが通らなくなってしまったので
ビルドを通したい
変更したいライブラリ
android.preference.PreferenceManager
androidx.preference.PreferenceManager
前提
Android studioにてアプリの開発を行っております。
数年更新をしていなかったため、現状Android13に上げるのに必要なライブラリの更新があります。
androidx用にbuild.gradleへ必要なライブラリを追加したところエラーとなりました。
発生している問題・エラーメッセージ
Caused by: java.lang.ClassNotFoundException: Class androidx.window.extensions.embedding.SplitInfo not found
該当のソースコード
build.gradle
1buildscript { 2 repositories { 3 google() 4 jcenter() 5 } 6 dependencies { 7 classpath 'com.android.tools.build:gradle:3.1.4' 8 } 9} 10apply plugin: 'com.android.application' 11 12dependencies { 13 implementation fileTree(include: '*.jar', dir: 'libs') 14 implementation 'com.google.android.gms:play-services-location:21.0.1' 15 implementation 'com.squareup.okhttp3:okhttp:3.11.0' 16 implementation 'androidx.preference:preference:1.2.1' 17 implementation 'androidx.constraintlayout:constraintlayout:2.2.0-alpha12' 18 implementation "androidx.core:core:1.12.0" 19 implementation "androidx.window:window:1.1.0" 20 21} 22allprojects { 23 gradle.projectsEvaluated { 24 tasks.withType(JavaCompile) { 25 options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" 26 } 27 } 28} 29android { 30 compileSdkVersion 33 31 buildToolsVersion "33.0.2" 32 sourceSets { 33 main { 34 manifest.srcFile 'AndroidManifest.xml' 35 java.srcDirs = ['src'] 36 resources.srcDirs = ['src'] 37 aidl.srcDirs = ['src'] 38 renderscript.srcDirs = ['src'] 39 res.srcDirs = ['res'] 40 assets.srcDirs = ['assets'] 41 } 42 43 // Move the tests to tests/java, tests/res, etc... 44 androidTest.setRoot('tests') 45 46 // Move the build types to build-types/<type> 47 // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 48 // This moves them out of them default location under src/<type>/... which would 49 // conflict with src/ being used by the main source set. 50 // Adding new build types or product flavors should be accompanied 51 // by a similar customization. 52 debug.setRoot('build-types/debug') 53 release.setRoot('build-types/release') 54 } 55 defaultConfig { 56 minSdkVersion 28 57 targetSdkVersion 33 58 compileOptions { 59 sourceCompatibility JavaVersion.VERSION_1_8 60 targetCompatibility JavaVersion.VERSION_1_8 61 } 62 } 63 productFlavors { 64 } 65 repositories { 66 google() 67 jcenter() 68 } 69 70} 71 72
試したこと
・android.support.v4とandroidxのライブラリは共存できないためすべてandroidxに変更した
・エラー内容がClassがないとのことなのでパスの見直しやlibへの配置などをした
回答1件
あなたの回答
tips
プレビュー