5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

flutterfire configureがERROR: Package name for Android app cannot be emptyとなる場合の対処法

Last updated at Posted at 2024-06-09

環境

  • OS
    • windows
  • IDE
    • AndroidStuido

対象コマンド

flutterFire configure

対象エラー

 Which Android application id (or package name) do you want to use for this configuration, e.g. 'com.example.app'?
 
 i Firebase android app  is not registered on Firebase project your_project.
⠼ Registering new Firebase android app on Firebase project your_project.
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase apps:create android your_project (android) --package-name= --json --project=your_project
ERROR: Package name for Android app cannot be empty

エラー詳細

ERROR: Package name for Android app cannot be empty
どうやらパッケージ名が空らしい。

確認箇所

1. android/app/src/main/AndroidManifest.xml

  • 私はmanifestタグにpackage名がなかったので追加
  • android:labelをパッケージ名とそろえる
android/app/src/main/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.your.orgname.my_app_name"> // 追加

    <application
        android:label="com.your.orgname.my_app_name"

2. android/app/src/debug/AndroidManifest.xml

  • manifestタグにpackageを追加
android/app/src/debug/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.your.orgname.my_app_name">

3. android/app/src/profile/AndroidManifest.xml

  • manifestタグにpackageを追加
android/app/src/profile/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.your.orgname.my_app_name">

4. android/app/build.gradle

  • namespace
  • applicationId
android/app/build.gradle
android {
    namespace = "com.your.orgname.my_app_name"

    
    defaultConfig {
        applicationId = "com.your.orgname.my_app_name"

5. android/app/src/main/kotlin/com.your.orgname.my_app_name/MainActivity.kt

  • package インポート
android/app/src/main/kotlin/com.your.orgname.my_app_name/MainActivity.kt
package com.your.orgname.my_app_name
import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity()

参考

Flutterでパッケージ名がcom.exampleになっているのをiOS/Androidで修正する箇所まとめ

5
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?