1

Flutter アプリで Android 用の deep link を実装するために、
AndroidManifest.xml と styles.xml を編集したのですが、
テーマに関するエラーが解決できず困っています。

プログラミング初心者のため、どこを修正すればよいか分かりません。
どなたか原因と解決方法をご教示いただけないでしょうか?

試したこと

  • Android Studio の Invalidate Caches / Restart(再起動)
  • Android SDK / build-tools の更新
  • styles.xml の書き換え(Theme.Light → Theme.Black)
  • AndroidManifest.xml の再編集
  • プロジェクト再ビルド

しかし、どれも解決につながりませんでした。

知りたいこと

  1. なぜ Theme.Black.NoTitleBar と windowBackground が見つからないのか
  2. Flutter プロジェクトではどのテーマを使用すべきなのか
  3. @style/NormalTheme が解決されない原因
  4. android:name="${applicationName}" が unresolved になる理由
  5. 正しい styles.xml と AndroidManifest.xml の書き方

環境

  • Flutter 3.x
  • Android Studio Koala
  • macOS
  • targetSdkVersion 33

発生しているエラー

styles.xml
Cannot resolve symbol '@android:style/Theme.Black.NoTitleBar'
Cannot resolve symbol 'android:windowBackground'

AndroidManifest.xml
Unresolved class '{applicationName}'
Cannot resolve symbol '@style/NormalTheme'

現在のファイル内容

styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>

    <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>

</resources>

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.shift_mate">

    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

    <application
        android:name="${applicationName}"
        android:label="shift_mate"
        android:icon="@mipmap/ic_launcher">

        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">

            <meta-data
                android:name="io.flutter.embedding.android.NormalTheme"
                android:resource="@style/NormalTheme" />

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="shiftmate" android:host="reset" />
            </intent-filter>

        </activity>

        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>
新しい参加者
東友輝 は新しい参加者です。さらなる説明を求めたりコメントや回答の仕方についてお願いするときは、思いやりを持つよう心がけましょう。 行動規範をどうぞご参照ください。

0

この質問に回答するには、ログインする必要があります。

質問して回答を見つけよう

質問すれば、回答が見つかるかもしれません。

質問する

関連する質問を見る

See similar questions with these tags.