やりたいこと
unityで、プラットフォームがandroidでapkファイルをビルドしたい。
だけどエラーが起こってできない。
ビルド時に出ているエラー
①Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.9.1/userguide/command_line_interface.html#sec:command_line_warnings ②FAILURE: Build failed with an exception. ③CommandInvokationFailure: Gradle build failed. ④Build completed with a result of 'Failed' in 25 seconds (24947 ms) ⑤UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors
試していること
①gradleを新しくした。gradle6-9-1にした。gradleをダウンロードして、unityのgradleの向き先を設定。でも効果なし
②android studioってやつに、unityでエクスポートした何かのデータをimport
しかし、これはandroid studioで出来なさそう。welcome画面にある”import project”を使うらしいが、画面にない。別のやり方わからん
③スクリプティングバックエンドをILL2PPにしててみた
IL2CPPのexeが動かないエラーでダメ
④player settings>player>android>公開設定>ビルド
Custom Mail Gradle TemplateとCustom launcher Gradle Templateに☑
でもダメ
環境
unity2019.4.20
gradle6-9-1
それ以外のSDKやNDK、JDKはunityhubで入れたから、バージョンとかよくわかりません。
例外内容
CommandInvokationFailure: Gradle build failed. C:/Users/81909/Desktop/unity/2019.4.20f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Users\81909\Desktop\unity\2019.4.20f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-6.9.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx128m" "assembleDebug" stderr[ 注意:C:\Users\81909\Documents\unity\ChartMaker\Temp\gradleOut\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.javaは非推奨のAPIを使用またはオーバーライドしています。 注意:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':launcher:packageDebug'. > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > java.lang.OutOfMemoryError (no error message) * 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. * Get more help at https://help.gradle.org BUILD FAILED in 59s Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 ] stdout[ Starting a Gradle Daemon, 2 incompatible and 2 stopped Daemons could not be reused, use --status for details > Configure project :launcher WARNING: DSL element 'useProguard' is obsolete and will be removed soon. Use 'android.enableR8' in gradle.properties to switch between R8 and Proguard.. WARNING: DSL element 'useProguard' is obsolete and will be removed soon. Use 'android.enableR8' in gradle.properties to switch between R8 and Proguard.. > Task :launcher:preBuild UP-TO-DATE > Task :unityLibrary:preBuild UP-TO-DATE > Task :unityLibrary:preDebugBuild UP-TO-DATE > Task :launcher:preDebugBuild UP-TO-DATE > Task :unityLibrary:compileDebugAidl NO-SOURCE > Task :unityLibrary:packageDebugRenderscript NO-SOURCE > Task :unityLibrary:compileDebugRenderscript NO-SOURCE > Task :launcher:generateDebugBuildConfig > Task :unityLibrary:generateDebugBuildConfig > Task :launcher:compileDebugAidl NO-SOURCE > Task :launcher:compileDebugRenderscript NO-SOURCE > Task :unityLibrary:generateDebugResValues > Task :unityLibrary:generateDebugResources > Task :launcher:mainApkListPersistenceDebug > Task :launcher:generateDebugResValues > Task :launcher:generateDebugResources > Task :launcher:createDebugCompatibleScreenManifests > Task :launcher:extractDeepLinksDebug > Task :launcher:mergeDebugShaders > Task :launcher:compileDebugShaders > Task :launcher:generateDebugAssets > Task :launcher:processDebugJavaRes NO-SOURCE > Task :unityLibrary:packageDebugResources > Task :unityLibrary:extractDeepLinksDebug > Task :unityLibrary:compileDebugLibraryResources > Task :unityLibrary:mergeDebugShaders > Task :unityLibrary:compileDebugShaders > Task :unityLibrary:generateDebugAssets > Task :unityLibrary:packageDebugAssets > Task :unityLibrary:processDebugJavaRes NO-SOURCE > Task :launcher:checkDebugDuplicateClasses > Task :unityLibrary:mergeDebugJniLibFolders > Task :unityLibrary:processDebugManifest > Task :unityLibrary:bundleLibResDebug > Task :unityLibrary:parseDebugLocalResources > Task :launcher:mergeDebugAssets > Task :launcher:processDebugManifest > Task :launcher:mergeDebugJniLibFolders > Task :launcher:validateSigningDebug > Task :launcher:mergeDebugResources > Task :launcher:mergeDebugJavaResource > Task :unityLibrary:mergeDebugNativeLibs > Task :unityLibrary:stripDebugDebugSymbols WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570. Compatible side by side NDK version was not found. Default is 20.0.5594570. Unable to strip the following libraries, packaging them as they are: libMonoPosixHelper.so, libmain.so, libmonobdwgc-2.0.so, libunity.so. > Task :unityLibrary:copyDebugJniLibsProjectOnly > Task :unityLibrary:javaPreCompileDebug > Task :unityLibrary:generateDebugRFile > Task :launcher:processDebugResources > Task :launcher:mergeDebugNativeLibs > Task :launcher:stripDebugDebugSymbols WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570. Compatible side by side NDK version was not found. Default is 20.0.5594570. Unable to strip the following libraries, packaging them as they are: libMonoPosixHelper.so, libmain.so, libmonobdwgc-2.0.so, libunity.so. > Task :launcher:desugarDebugFileDependencies > Task :launcher:mergeExtDexDebug > Task :unityLibrary:compileDebugJavaWithJavac > Task :unityLibrary:bundleLibRuntimeDebug > Task :unityLibrary:bundleLibCompileDebug > Task :launcher:javaPreCompileDebug > Task :launcher:compileDebugJavaWithJavac > Task :launcher:compileDebugSources > Task :launcher:dexBuilderDebug > Task :launcher:mergeDexDebug > Task :launcher:packageDebug FAILED Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.9.1/userguide/command_line_interface.html#sec:command_line_warnings 44 actionable tasks: 44 executed ] exit code: 1 UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) Rethrow as GradleInvokationException: Gradle build failed UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown. UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0) UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <8d21067e8d9c494db25a2b2485216e63>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
1. は警告でありエラーではなく、意味は書いてあるそのままです。わからなかったらその英文でググれば日本語で説明しているものが見つかります。
2. は例外によりビルドが失敗した、という意味で、その例外の内容がログに出ているはずですが、肝心の例外情報がコピペされていません。
まずは例外の内容をログから探すことを始めてみたらどうでしょう。そこには「何がいけないのか」が書いてあるので、その意味がわかれば解決するでしょう。わからない場合は、それを「質問に追記」すれば誰か何かヒントをくれるかもしれません。
ありがとうございます。まずはログを読み解いてみようと思います
せっかくエラーメッセージを見つけたのだから、そのメッセージを検索してみてはどうでしょう。
https://www.google.com/search?q=UnityPlayerActivity.java%E3%81%AF%E9%9D%9E%E6%8E%A8%E5%A5%A8%E3%81%AEAPI%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%BE%E3%81%9F%E3%81%AF%E3%82%AA%E3%83%BC%E3%83%90%E3%83%BC%E3%83%A9%E3%82%A4%E3%83%89%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82
https://www.google.com/search?q=UnityPlayerActivity.java+uses+or+overrides+a+deprecated+API.
あなたの回答
tips
プレビュー