Facebook SDK エラー解決レコードへの Unity アクセスについて
問題の説明:
パッケージング エラー「Temp\gradleOut\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java は古い API を使用または上書きします。」
1. この間、パッケージ化のために Android Studio にパッケージをエクスポートしてバグを確認し、そのままインポートしてパッケージ化することを試みました。
FAILURE: Build completed with 3 failures.
1: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':unityLibrary:checkDebugManifest' (type 'CheckManifest').
- In plugin 'com.android.build.gradle.api.AndroidBasePlugin' type 'com.android.build.gradle.internal.tasks.CheckManifest' property 'manifest' has @Input annotation used on property of type 'File'.
Reason: A property of type 'File' annotated with @Input cannot determine how to interpret the file.
Possible solutions:
1. Annotate with @InputFile for regular files.
2. Annotate with @InputDirectory for directories.
3. If you want to track the path, return File.absolutePath as a String and keep @Input.
Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#incorrect_use_of_input_annotation for more details about this problem.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':unityLibrary:compileDebugShaders' (type 'ShaderCompile').
- In plugin 'com.android.build.gradle.api.AndroidBasePlugin' type 'com.android.build.gradle.tasks.ShaderCompile' property 'sourceDir' is annotated with @InputFiles but missing a normalization strategy.
Reason: If you don't declare the normalization, outputs can't be re-used between machines or locations on the same machine, therefore caching efficiency drops significantly.
Possible solution: Declare the normalization strategy by annotating the property with either @PathSensitive, @Classpath or @CompileClasspath.
Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#missing_normalization_annotation for more details about this problem.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
3: Task failed with an exception.
-----------
* What went wrong:
Some problems were found with the configuration of task ':unityLibrary:transformNativeLibsWithMergeJniLibsForDebug' (type 'TransformTask').
- In plugin 'com.android.build.gradle.api.AndroidBasePlugin' type 'com.android.build.gradle.internal.pipeline.TransformTask' property 'allSecondaryInputs' is private and annotated with @Internal.
Reason: Annotations on private getters are ignored.
Possible solutions:
1. Make the getter public.
2. Annotate the public version of the getter.
Android エンジニアではない私には、エラーレポートがまったく理解できず、「com.android.build.gradle.api.AndroidBasePlugin」に関するものであることだけを知っていましたが、AS が次のことを示唆していることに気づきました。必要と思われるいくつかの構成をアップグレードします。
[外部リンク画像の転送に失敗しました。ソース サイトにはリーチ防止メカニズムが存在する可能性があります。画像を保存して直接アップロードすることをお勧めします (img-RGcVC7Aj-1688017256810) (C:\Users\gy\AppData\Local\Temp\)エンタープライズ WeChat スクリーンショット_1687940470251.png)]
何か魔法のようなことが起こり、アップグレードをクリックするとパッケージ化が成功し、その後、彼がアップグレードしたのは gradle で定義された依存関係のバージョンであることがわかりました。
2. Gradle Android プラグインのバージョンをアップグレードする必要があります。
3.4.0 => 4.2.0
このとき、gradleの依存関係を変更する必要があります。gradleファイルを変更するには問題解決が必要です。UnityのカスタムGradleにはいくつかの種類があります。変更を誤ると不具合が発生する可能性があります。エラー: [引数の
メソッド
[外部リンク画像の転送に失敗しました。ソース サイトにはリーチ防止メカニズムが存在する可能性があります。画像を保存して直接アップロードすることをお勧めします (img-vvtR12aI-1688017256811) (C:\Users\gy\AppData\Roaming\Typora\) typora-user-images\ image-20230627143844398.png)]
2 番目の変更方法: UnityEditor ファイル配下の Gradle ファイルを直接変更する
[外部リンク画像の転送に失敗しました。ソース サイトにはリーチ防止メカニズムがある可能性があります。画像を保存して直接アップロードすることをお勧めします (img-66sOBv1Y-1688017256811) ) (ファイル:/// C:/Users/gy/Documents/WXWork/1688850302849244/Cache/Image/2023-06/Enterprise WeChat スクリーンショット_16879176944369.png)]
パッケージに感謝し、感謝します!
バッグを取り付けた後、NMDがクラッシュしました。
[外部リンク画像の転送に失敗しました。ソース サイトにはリーチ防止メカニズムが存在する可能性があります。画像を保存して直接アップロードすることをお勧めします (img-sRkflf41-1688017256811) (C:\Users\gy\AppData\Roaming\Typora\) typora-user-images\ image-20230628170748477.png)]
2023/06/28 16:38:56.105 4912 4979 エラー Unity ファイル '/data/app/~~9dlUytlV0Q8idFcjL1iVkA==/com.lmd.dev.xproject-x4dpKkGPp7G8SwWpLHuc4g==/base.apk/assets/bin/Data/ ea726188743d68d45b5a458307e424f8' が壊れています! それを削除して、もう一度 Unity を起動してください。
問題の解決を続行します。
インターネット上で Fascebook がこの問題をどのように処理するかに関する情報が見つかりません。Facebookの初期化中にエラーが発生したようで、ネット上にある様々な対処法もおかしなものばかりです。
再パッケージして同じエラーを報告し、解凍してリソースファイルを見てみると文字化けが多かったのですが、Facebooksettingという文字がありました このファイルはAppIDなどの情報と場所を記録したアセットですこのファイルは Resources の下にあり、たまたまオンラインで入手できます。資産に問題があるという人もいれば、Resources フォルダーに問題があるという人もいます。すべてを 1 つずつ試すしかありません。重要なのは、手動でパッケージ化してもエラーが発生しないことです。
シーン '' の 'FacebookSettings' に添付されたスクリプトが見つからないか、有効なスクリプトが添付されていません。
私の場合、スクリプトのメタファイルが競合した状態でチェックインされていることがわかりました。チームは SVN を使用しているため、左右のコピーと作業用コピーがすべてそこにありました。メタファイルを手動で修正したところ、うまくいったようです。おそらくメタ ファイルを削除して Unity で再生成させることもできますが、GUID が変更される可能性があるため、手動で行うことにしました。
いくつかのスクリプトを削除した
が、それらのスクリプトを使用したいくつかのプレハブを削除しなかった後に、このエラーが発生しました。これらのプレハブはどこにも使用されていないにもかかわらず、ビルド中に警告が生成されました。プレハブに不足しているスクリプト参照がないか確認し、それらを削除します (またはスクリプト コンポーネントを削除します)。
同じ名前の ScriptableObject アセット ファイルと cs ファイルがあります (FB のパッケージはデフォルトでこのような名前が付けられており、デモ パッケージは正常にリリースされているため、これは疑わしいです)。同じようなエラーが発生しましたが、次の ScriptableObject クラスがありました
。項目ですが、ファイル名は Items.cs でした - このエラーが発生しました。ファイルの名前を Item.cs に変更する必要がありました。
手動でパッケージ化した後、コンソール パネルに AndroidMenifist ファイルを再生成するように指示するログがあることに気付き、パッケージをクリックして FBSDK を正常に初期化しました。 。