'-Xopt-in' is deprecated and will be removed in a future release, please use -opt-in instead

'-Xopt-in' is deprecated and will be removed in a future release, please use -opt-in instead
👉 Issues with Gradle Kotlin DSL and `-Xopt-in` deprecation : KT-51708 hatena-bookmark


tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
   kotlinOptions {
     allWarningsAsErrors = false
     freeCompilerArgs += [
         "-Xopt-in=kotlin.RequiresOptIn",
         "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
         "-Xopt-in=kotlinx.coroutines.FlowPreview",
         "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi",
         "-Xopt-in=kotlin.Experimental",
     ]
   }
 }


'-Xopt-in' → '-opt-in'


tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
   kotlinOptions {
     allWarningsAsErrors = false
     freeCompilerArgs += [
         "-opt-in=kotlin.RequiresOptIn",
         "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
         "-opt-in=kotlinx.coroutines.FlowPreview",
         "-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
         "-opt-in=kotlin.Experimental",
     ]
   }
 }

単純に gradle ファイル内、文字列の置換で完。

コード内アノテーションで利用の人はそのままでいいんかな。

👉 Opt-in requirement marker annotation on override requires the same marker on base declaration  hatena-bookmark
👉 AGP Upgrade Assistant で 7.2 移行時にCause: manifestData.`package` must not be null hatena-bookmark
👉 @Composable Scaffold で This material API is experimental and is likely to change or to be removed in the future. hatena-bookmark


AGP Upgrade Assistant で 7.2 移行時にCause: manifestData.`package` must not be null

初回は、自動認識でダイアログから進むことになると思うが、

手動でやるなら以下から。


[Tools]

  ↓

[AGP Upgrade Assistant]

このステップでコケる。

Move package from Android manifest to build files

Declaration of a project's namespace using the package attribute of the Android manifest is deprecated in favour of a namespace declaration in build files.

なんすかねこれ。

 

Gradle sync failed: Cause: manifestData.`package` must not be null

Issue Tracker にありました。

AGP namespace property and app id suffix and Safe Args plugin don't work together

Using the new namespace property in build.gradle instead of the package attribute in AndroidManifest.xml while also using a custom applicationIdSuffix breaks androidx.navigation.safeargs plugin.

👉 Gradle sync failed: Cause: manifestData.`package` must not be null - Issue Tracker
👉 AGP namespace property and app id suffix and Safe Args plugin don't work together [232107688] - Visible to Public - Issue Tracker hatena-bookmark

どうやら、namespace の新記述は、

androidx.navigation.safeargs と同時に使えないようです。

使っているか、コード内を探してみました。


[Edit]

  ↓

[Find]

  ↓

[Find in Files ...]

androidx.navigation.safeargs

...

どうやら、ツールの書き換え内容は以下の様子。

👉 AndroidManifest の package 属性による名前空間宣言が廃止される - BattleProgrammerShibata hatena-bookmark

2行だけなので直接書き換えて namespace 記述は以前の形に戻す。と。

暫定的な対応なので、以下のようにFix版リリース時に注意が必要です。

👉 java.lang.IncompatibleClassChangeError: The method 'java.lang.Class java.lang.Object.getClass()' was expected to be of type interface but instead was found to be of type virtual hatena-bookmark


Gradle タスクリストが見えない件【Android Studio】

見えなくなりましたね、

これ Task のリスト。

gradle task list

その理由。

Gradle task list is large and slow to populate in Android projects. This feature by default is disabled for performance reasons. You can re-enable it in: Settings | Experimental | Do not build Gradle task list during Gradle sync.

Androidプロジェクトでは、Gradleのタスクリストが大きく、作成に時間がかかります。パフォーマンス上の理由から、この機能はデフォルトで無効になっています。以下で再有効化することができます。


Preferences

↓

Experimental

↓

Do not build Gradle task list during Gradle sync.

Do not build Gradle task list during Gradle sync

👉 Missing [app | android | Tasks | androidDependencies] in the gradel panel [185420705] - Visible to Public - Issue Tracker hatena-bookmark
👉 Gradle tasks are not showing in the gradle tool window in Android Studio 4.2 - Stack Overflow hatena-bookmark

使わないほうがいいんでしょうね。

将来的になくなる機能なのでしょう。

 

タスク一覧表示する

コマンドランチャー的なものが表示されるようになってるのですが、困るのは、オプション部分をはっきり覚えてないので入力ができないことです。

「tasks」 と入力するのが良さげです。

gradle tasks

クリックして選択はできませんが、タスクオプションの一覧は表示されるので、それを見たりコピーして入力できるようになります。


Android tasks
-------------
androidDependencies - Displays the Android dependencies of the project.
signingReport - Displays the signing info for the base and test modules
sourceSets - Prints out all the source sets defined in this project.

Build tasks
-----------
assemble - Assemble main outputs for all the variants.
assembleAndroidTest - Assembles all the Test applications.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildKotlinToolingMetadata - Build metadata json file containing information about the used Kotlin tooling
buildNeeded - Assembles and tests this project and all projects it depends on.
bundle - Assemble bundles for all the variants.
clean - Deletes the build directory.
compileDebugAndroidTestSources
compileDebugSources
compileDebugUnitTestSources
compileReleaseSources
compileReleaseUnitTestSources

Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.

Firebase Crashlytics tasks
--------------------------
injectCrashlyticsMappingFileIdDebug - Injects a mapping file id into the app, used by Crashlytics for deobfuscation.
injectCrashlyticsMappingFileIdRelease - Injects a mapping file id into the app, used by Crashlytics for deobfuscation.
uploadCrashlyticsMappingFileDebug - Uploads mapping files to Crashlytics for crash deobfuscation.
uploadCrashlyticsMappingFileRelease - Uploads mapping files to Crashlytics for crash deobfuscation.

Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'Sample'.
dependencies - Displays all dependencies declared in root project 'Sample'.
dependencyInsight - Displays the insight into a specific dependency in root project 'Sample'.
help - Displays a help message.
javaToolchains - Displays the detected java toolchains.
outgoingVariants - Displays the outgoing variants of root project 'Sample'.
projects - Displays the sub-projects of root project 'Sample'.
properties - Displays the properties of root project 'Sample'.
tasks - Displays the tasks runnable from root project 'Sample' (some of the displayed tasks may belong to subprojects).

Install tasks
-------------
installDebug - Installs the Debug build.
installDebugAndroidTest - Installs the android (on device) tests for the Debug build.
uninstallAll - Uninstall all applications.
uninstallDebug - Uninstalls the Debug build.
uninstallDebugAndroidTest - Uninstalls the android (on device) tests for the Debug build.
uninstallRelease - Uninstalls the Release build.

Verification tasks
------------------
check - Runs all checks.
checkJetifier - Checks whether Jetifier is needed for the current project
connectedAndroidTest - Installs and runs instrumentation tests for all flavors on connected devices.
connectedCheck - Runs all device checks on currently connected devices.
connectedDebugAndroidTest - Installs and runs the tests for debug on connected devices.
deviceAndroidTest - Installs and runs instrumentation tests using all Device Providers.
deviceCheck - Runs all device checks using Device Providers and Test Servers.
lint - Runs lint on the default variant.
lintAnalyzeDebug - Run lint analysis on the debug variant
lintAnalyzeRelease - Run lint analysis on the release variant
lintDebug - Print text output from the corresponding lint report task
lintFix - Runs lint on the default variant and applies any safe suggestions to the source code.
lintFixDebug - Fix lint on the debug variant
lintFixRelease - Fix lint on the release variant
lintRelease - Print text output from the corresponding lint report task
lintReportDebug - Run lint on the debug variant
lintReportRelease - Run lint on the release variant
test - Run unit tests for all variants.
testDebugUnitTest - Run unit tests for the debug build.
testReleaseUnitTest - Run unit tests for the release build.