Mayumi-Nakabayashi / withTone

2 stars 0 forks source link

fix(Android): アプリが起動できない不具合を修正 #120

Closed ken-ty closed 11 months ago

ken-ty commented 11 months ago

ぱっと直せなそう。。

やったこと

Android でビルドしようとして失敗した。以下の原因だった。

参照ライブラリ数が多くてビルドが失敗

https://qiita.com/hayashi-ay/items/a7a06b6f1fb0a8a25dcf をみて解決

以下エラーが発生。firebase_auth などのパッケージ追加後に Android のビルド確認してなかったと思われる。

BUILD FAILED in 4s
[!] App requires Multidex support
    Multidex support is required for your android app to build since the number of methods has exceeded 64k. See https://docs.flutter.dev/deployment/android#enabling-multidex-support for more information. You may pass the --no-multidex flag to skip Flutter's multidex support to use a manual solution.
    Flutter tool can add multidex support. The following file will be added by flutter:
        android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java
cannot prompt without a terminal ui
Exception: Gradle task assembleDebug failed with exit code 1
Exited

AdMob の設定がうまく読み込めない

WIP

参照ライブラリ数を修正後、ビルド通ったが画面がすぐに落ちてしまった。

Launching lib/main.dart on Pixel 7a in debug mode...
main.dart:1
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
E/AndroidRuntime(28604): FATAL EXCEPTION: main
E/AndroidRuntime(28604): Process: com.withtone.withtone, PID: 28604
E/AndroidRuntime(28604): java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
E/AndroidRuntime(28604):
E/AndroidRuntime(28604): ******************************************************************************
E/AndroidRuntime(28604): * Invalid application ID. Follow instructions here:                          *
E/AndroidRuntime(28604): * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
E/AndroidRuntime(28604): * to find your app ID.                                                       *
E/AndroidRuntime(28604): * Google Ad Manager publishers should follow instructions here:              *
E/AndroidRuntime(28604): * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
E/AndroidRuntime(28604): ******************************************************************************
2
E/AndroidRuntime(28604):
E/AndroidRuntime(28604):    at android.app.ActivityThread.installProvider(ActivityThread.java:7513)
E/AndroidRuntime(28604):    at android.app.ActivityThread.installContentProviders(ActivityThread.java:7019)
E/AndroidRuntime(28604):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6790)
E/AndroidRuntime(28604):    at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
E/AndroidRuntime(28604):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2132)
E/AndroidRuntime(28604):    at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(28604):    at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(28604):    at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(28604):    at android.app.ActivityThread.main(ActivityThread.java:7918)
E/AndroidRuntime(28604):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(28604):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(28604):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/AndroidRuntime(28604): Caused by: java.lang.IllegalStateException:
E/AndroidRuntime(28604):
E/AndroidRuntime(28604): ******************************************************************************
E/AndroidRuntime(28604): * Invalid application ID. Follow instructions here:                          *
E/AndroidRuntime(28604): * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
E/AndroidRuntime(28604): * to find your app ID.                                                       *
E/AndroidRuntime(28604): * Google Ad Manager publishers should follow instructions here:              *
E/AndroidRuntime(28604): * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
E/AndroidRuntime(28604): ******************************************************************************
2
E/AndroidRuntime(28604):
E/AndroidRuntime(28604):    at com.google.android.gms.ads.internal.client.zzek.attachInfo(com.google.android.gms:play-services-ads-lite@@22.0.0:15)
E/AndroidRuntime(28604):    at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@22.0.0:1)
E/AndroidRuntime(28604):    at android.app.ActivityThread.installProvider(ActivityThread.java:7508)
E/AndroidRuntime(28604):    ... 11 more

https://developers.google.com/admob/android/quick-start?hl=ja#import_the_mobile_ads_sdk

上記を参考に修正。

ビルド時に警告が発生する

https://qiita.com/Riscait/items/74c46f3deeb38e70f902 を参考に修正 WIP

Launching lib/main.dart on Pixel 7a in debug mode...
main.dart:1
注意:一部の入力ファイルは推奨されないAPIを使用またはオーバーライドしています。
注意:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。

その他

119 のマージ後にマージする。

sodateya commented 11 months ago

解決しました

僕のせいですごめんなさい!!!! https://github.com/Mayumi-Nakabayashi/withTone/pull/119#issuecomment-1761070708

ken-ty commented 11 months ago

引き継いでご対応ありがとうございます!!

LGTM です👌