Unity 添加 admob 插件后无法构建应用程序

问题描述 投票:0回答:3

嗨,所以我正在尝试构建我的游戏应用程序 apk.. 它之前工作正常,但现在在我添加 admob 插件后,我在构建时开始收到这些错误 https://github.com/googleads/googleads-mobile-unity/releases/tag/v3.6.3

Failed to compile resources with the following parameters:
-bootclasspath "D:/Android/sdk\platforms\android-25\android.jar" -d "C:\Users\Eric\Documents\UnityProjects\Repos\HerderGame\HerderGame\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "android\support\v4\R.java" "com\google\android\gms\R.java" "com\google\android\gms\ads\R.java" "com\google\android\gms\ads\impl\R.java" "com\google\android\gms\base\R.java" "com\google\android\gms\clearcut\R.java" "com\google\android\gms\gass\R.java" "com\google\android\gms\tasks\R.java" "com\google\unity\ads\R.java" "com\Unity2D\Napmi\R.java"
warning: D:\Android\sdk\platforms\android-25\android.jar(java/lang/Object.class): major version 52 is newer than 51, the highest major version supported by this compiler.
  It is recommended that the compiler be upgraded.
warning: D:\Android\sdk\platforms\android-25\android.jar(java/lang/AutoCloseable.class): major version 52 is newer than 51, the highest major version supported by this compiler.
  It is recommended that the compiler be upgraded.
2 warnings

UnityEditor.HostView:OnGUI()

另一个错误

UnityException: Resource compilation failed!
Failed to recompile android resource files. See the Console for details.
UnityEditor.Android.PostProcessAndroidPlayer.ShowErrDlgAndThrow (System.String title, System.String message, System.Exception ex)
UnityEditor.Android.PostProcessAndroidPlayer.ShowErrDlgAndThrow (System.String title, System.String message)
UnityEditor.Android.PostProcessAndroidPlayer.CompileResources (System.String stagingArea, System.String packageName, UnityEditor.Android.AndroidLibraries androidLibraries)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
UnityEditor.HostView:OnGUI()

最后一张

Error building Player: UnityException: Resource compilation failed!
Failed to recompile android resource files. See the Console for details.

有什么想法吗?

android unity-game-engine admob
3个回答
2
投票

确保您的 java sdk 与当前版本的 android sdks 兼容/最新。为此,请检查 android sdk v.25 是否也正确。

“D:\Android\sdk\platforms ndroid-25 ndroid.jar(java/lang/Object.class):主要版本 52 比 51 更新,这是该编译器支持的最高主要版本。”我会搜索这个错误及其列出的类似错误。


0
投票

我的游戏也面临同样的问题。 所以,我意识到那是 Admob 插件。

尝试降级或更新您的 googleads unity 插件。

对我来说,解决方案是“降级 googleads-mobile-unity v7.0.0 至 googleads-mobile-unity v6.1.2

干杯!


0
投票

对于那些使用 Unity 2022.1 或更早版本的人有很大帮助。

© www.soinside.com 2019 - 2024. All rights reserved.