質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
Flutter

Flutterは、iOSとAndroidのアプリを同じコードで開発するためのフレームワークです。オープンソースで開発言語はDart。双方のプラットフォームにおける高度な実行パフォーマンスと開発効率を提供することを目的としています。

Q&A

0回答

1091閲覧

Flutter: プロジェクト作成時、Manifestファイル等のデフォルトで作成されるファイルにエラーがある

massanmesu

総合スコア36

Flutter

Flutterは、iOSとAndroidのアプリを同じコードで開発するためのフレームワークです。オープンソースで開発言語はDart。双方のプラットフォームにおける高度な実行パフォーマンスと開発効率を提供することを目的としています。

0グッド

0クリップ

投稿2021/08/29 12:18

編集2021/09/17 06:01

プロジェクト作成時に自動で生成されるファイルに数箇所のエラーがあり、commit時に警告文が出てきます。
原因がわからないことに加え、アプリは特に問題なく動作するのでずっと放置していましたが、初めての個人アプリ開発時に不具合として立ちはだかる気がしたので、今のうちに解決したいです。

エラー箇所

/Users/'myName'/AndroidStudioProjects/Flutter/'appName'/android/app/build.gradle

xml

1def localProperties = new Properties() // エラー 2def localPropertiesFile = rootProject.file('local.properties') 3if (localPropertiesFile.exists()) { 4 localPropertiesFile.withReader('UTF-8') { reader -> 5 localProperties.load(reader) 6 } 7} 8 9def flutterRoot = localProperties.getProperty('flutter.sdk') 10if (flutterRoot == null) { 11 // エラー 12 throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 13} 14 15//以下略

CodeAnalysis

1Error:(1, 27) Cannot resolve symbol 'Properties' 2Error:(11, 15) Cannot resolve symbol 'GradleException'

/Users/'myName'/AndroidStudioProjects/Flutter/'appName'/android/app/settings.gradle

xml

1include ':app' 2 3def localPropertiesFile = new File(rootProject.projectDir,"local.properties")   // エラー 4def properties = new Properties()  // エラー 5 6//以下略

CodeAnalysis

1Error:(1, 27) Cannot resolve symbol 'Properties' 2Error:(11, 15) Cannot resolve symbol 'GradleException'

/Users/'myName'/AndroidStudioProjects/Flutter/'appName'/android/app/src/main/AndroidManifest.xml

xml

1<manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 package="com.kokikudo.chatapp_with_chatroom"> 3 <application 4 android:label="chatapp_with_chatroom" 5 android:icon="@mipmap/ic_launcher">// エラー 6 <activity 7 android:name=".MainActivity"// エラー 8 android:launchMode="singleTop"// エラー 9 android:theme="@style/LaunchTheme"// エラー 10 android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"// エラー 11 android:hardwareAccelerated="true"// エラー 12 android:windowSoftInputMode="adjustResize"// エラー> 13 14//以下略

CodeAnalysis

1Error:(5, 9) Attribute android:icon is not allowed here 2Error:(7, 28) Unresolved class 'MainActivity' 3Error:(8, 13) Attribute android:launchMode is not allowed here 4Error:(9, 13) Attribute android:theme is not allowed here 5Error:(10, 13) Attribute android:configChanges is not allowed here 6Error:(11, 13) Attribute android:hardwareAccelerated is not allowed here 7Error:(12, 13) Attribute android:windowSoftInputMode is not allowed here

/Users/'myName'/AndroidStudioProjects/Flutter/'appName'/android/build.gradle

xml

1buildscript { 2 ext.kotlin_version = '1.3.50' 3 repositories { 4 google() 5 mavenCentral() 6 } 7 8 dependencies { 9 classpath 'com.android.tools.build:gradle:4.1.0' 10 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // 警告 11 } 12} 13 14//以下略

CodeAnalysis

1Warning:(10, 9) Kotlin version that is used for building with Gradle (1.3.50) differs from the one bundled into the IDE plugin (1.5.30)

/Users/'myName'/AndroidStudioProjects/Flutter/'appName'/android/app/src/main/res/values-night/styles.xml

xml

1<?xml version="1.0" encoding="utf-8"?> 2<resources> 3 <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on --> 4 <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> 5 <!-- Show a splash screen on the activity. Automatically removed when 6 Flutter draws its first frame --> 7 <item name="android:windowBackground">@drawable/launch_background</item> // エラー 8 </style> 9 <!-- Theme applied to the Android Window as soon as the process has started. 10 This theme determines the color of the Android Window while your 11 Flutter UI initializes, as well as behind your Flutter UI while its 12 running. 13 14 This Theme is only used starting with V2 of Flutter's Android embedding. --> 15 <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> 16 <item name="android:windowBackground">?android:colorBackground</item> // エラー 17 </style> 18</resources>

CodeAnalysis

1Error:(7, 21) Cannot resolve symbol 'android:windowBackground' 2Error:(16, 21) Cannot resolve symbol 'android:windowBackground'

/Users/'myName'/AndroidStudioProjects/Flutter/'appName'/android/app/src/main/res/values/styles.xml

xml

1<?xml version="1.0" encoding="utf-8"?> 2<resources> 3 <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off --> 4 <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"> 5 <!-- Show a splash screen on the activity. Automatically removed when 6 Flutter draws its first frame --> 7 <item name="android:windowBackground">@drawable/launch_background</item>   // エラー 8 </style> 9 <!-- Theme applied to the Android Window as soon as the process has started. 10 This theme determines the color of the Android Window while your 11 Flutter UI initializes, as well as behind your Flutter UI while its 12 running. 13 14 This Theme is only used starting with V2 of Flutter's Android embedding. --> 15 <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> 16 <item name="android:windowBackground">?android:colorBackground</item>   // エラー 17 </style> 18</resources> 19 20 21//以下略

CodeAnalysis

1Error:(7, 21) Cannot resolve symbol 'android:windowBackground' 2Error:(16, 21) Cannot resolve symbol 'android:windowBackground'

少し前のFlutterに必須だったnewキーワードがついてるということはFlutterのバージョンが古いのかも、と思ってupdateの確認をしましたが特に要求はありませんでした。
以上よろしくお願いします。

###開発環境

% flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel master, 2.3.0-17.0.pre.366, on macOS 11.5.2 20G95 darwin-x64, locale ja-JP) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) [✓] Xcode - develop for iOS and macOS [✓] Chrome - develop for the web [✓] Android Studio (version 2020.3) [✓] VS Code (version 1.47.3) [✓] Connected device (2 available) • No issues found!

###追記
https://tm23forest.com/contents/androidstudio-cannot-resolve-symbol
上記のサイトに従い、'Invalidate Caches / Restart'を実行し再起動、開いた履歴からではなくファイルを選択しプロフェクトを開く、という対応をしましたがファイルに全く変化はありませんでした。

追記2
今、android studioのトップページにエラーの警告があり開いたところ、どうやらGradleプラグインに例外が発生しているみたいです。Gradleプラグインは削除&再ダウンロードしても問題ないものなのでしょうか?
イメージ説明

追記3
いまだに原因が判明できず困っております。
足りない情報があれば教えてください。
些細なことでも結構ですのでコメントいただけると幸いです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問