facebook twitter hatena line email

「Unity/公開/Android」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(Androidを公開する)
("android:exportedは使用されていません"とエラーとなるとき)
 
(同じ利用者による、間の22版が非表示)
行11: 行11:
 
#"Use a〜"を選択Keystoreのパスを入力する
 
#"Use a〜"を選択Keystoreのパスを入力する
 
#Buildするとapkができるのでそのままplay.consoleへ登録する
 
#Buildするとapkができるのでそのままplay.consoleへ登録する
 +
 +
==UnityException: Can not sign the application Unable to sign the application; please provide passwords!エラーが出る場合==
 +
keystoreのパスが空欄など
 +
 +
 +
==UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.エラーが出る場合==
 +
*sdkのpathに日本語が入ってる
 +
*playから公開用apkを既にインストールしており、updateに失敗する(この場合は端末に入ってるアプリを消せば良い)
 +
 +
==Please set the Bundle Identifier in the Player Settings. The value must follow the convention 'com.YourCompanyName.YourProductName' and can contain alphanumeric characters and underscore. Each segment must not start with a numeric character or underscore.のエラーが出るとき==
 +
Bundle Identifierに"-"などが含まれていると上記エラーとなる
 +
 +
==Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for details.のエラーが出るとき==
 +
http://dl.google.com/android/repository/tools_r22.0.5-macosx.zip
 +
少し古いtoolsをdlしてsdkの下のtoolsを更新する
 +
 +
参考:http://nn-hokuson.hatenablog.com/entry/2017/09/05/202327
 +
 +
==trouble writing output: Too many field references to fit in one dex file: 71337; max is 65536. You may try using multi-dex. If multi-dex is enabled then the list of classes for the main dex list is too large.エラーのとき==
 +
 +
AndroidのBuildオプションのBuild SystemをGradleにする
 +
 +
参考:https://documentation.onesignal.com/docs/troubleshooting-unity
 +
 +
==NDK is missing a "platforms" directory.エラーのとき==
 +
詳細エラー:
 +
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
 +
 +
SDKManagerから"sdk tools"タブをクリックし、NDKをインストールする
 +
 +
=="デバッグを無効にする必要"とでる場合==
 +
以下エラーの場合
 +
アップロードできませんでした
 +
デバッグ可能な APK または Android App Bundle をアップロードしました。セキュリティ上の理由により、Google Play に公開するにはデバッグを無効にする必要があります。詳しくは、デバッグ可能な APK または Android App Bundle についての説明をご覧ください。
 +
Build Setting/Development Buildをoffにする
 +
 +
== 64 ビット要件に準拠してない場合==
 +
以下メッセージが出る
 +
このリリースは Google Play の 64 ビット要件に準拠していません。
 +
ProjectSettingのAndroidのConfiguration/ScriptingBackendをIL2CPPにし、ARM64をチェック
 +
 +
=="android:exportedは使用されていません"とエラーとなるとき==
 +
以下メッセージが出る
 +
unity 'android:exported' プロパティ セットは使用されていません。このファイルは Android 12 以降にはインストールできません。
 +
 +
android:exportedを宣言していない場合にエラーが出るようなので、
 +
以下を、android:exported="true"を追加する
 +
 +
Assets/Plugins/Android/AndroidManifest.xml
 +
<pre>
 +
<?xml version="1.0" encoding="utf-8"?>
 +
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
 +
<manifest
 +
    xmlns:android="http://schemas.android.com/apk/res/android"
 +
    package="com.unity3d.player"
 +
    xmlns:tools="http://schemas.android.com/tools">
 +
    <application>
 +
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
 +
                  android:theme="@style/UnityThemeSelector"
 +
+                  android:exported="true"
 +
                  >
 +
            <intent-filter>
 +
                <action android:name="android.intent.action.MAIN" />
 +
                <category android:name="android.intent.category.LAUNCHER" />
 +
            </intent-filter>
 +
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
 +
        </activity>
 +
    </application>
 +
</manifest>
 +
</pre>
 +
外部アプリから呼び出しを、NGとする場合は、android:exported="false"とすればよい。
 +
 +
どうしても無理そうなら、API Android11(31)以降からこのエラーが出る感じだったので、API Android10(30)へ戻す。
 +
 +
参考:https://xrdnk.hateblo.jp/entry/2021/11/05/115104

2022年1月14日 (金) 06:07時点における最新版

Androidを公開する

以下を参考に実機で動かせるようにする

unity/実機/Android [ショートカット]

  1. File/BuildSettingsを選択
  2. Androidを選択
  3. PlayerSettingsを選択
  4. Inspector/端末マーク/PublisingSetting
  5. "Create〜"を選択しKeystoreを作成
  6. "Use a〜"を選択Keystoreのパスを入力する
  7. Buildするとapkができるのでそのままplay.consoleへ登録する

UnityException: Can not sign the application Unable to sign the application; please provide passwords!エラーが出る場合

keystoreのパスが空欄など


UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.エラーが出る場合

  • sdkのpathに日本語が入ってる
  • playから公開用apkを既にインストールしており、updateに失敗する(この場合は端末に入ってるアプリを消せば良い)

Please set the Bundle Identifier in the Player Settings. The value must follow the convention 'com.YourCompanyName.YourProductName' and can contain alphanumeric characters and underscore. Each segment must not start with a numeric character or underscore.のエラーが出るとき

Bundle Identifierに"-"などが含まれていると上記エラーとなる

Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for details.のエラーが出るとき

http://dl.google.com/android/repository/tools_r22.0.5-macosx.zip 少し古いtoolsをdlしてsdkの下のtoolsを更新する

参考:http://nn-hokuson.hatenablog.com/entry/2017/09/05/202327

trouble writing output: Too many field references to fit in one dex file: 71337; max is 65536. You may try using multi-dex. If multi-dex is enabled then the list of classes for the main dex list is too large.エラーのとき

AndroidのBuildオプションのBuild SystemをGradleにする

参考:https://documentation.onesignal.com/docs/troubleshooting-unity

NDK is missing a "platforms" directory.エラーのとき

詳細エラー: If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

SDKManagerから"sdk tools"タブをクリックし、NDKをインストールする

"デバッグを無効にする必要"とでる場合

以下エラーの場合

アップロードできませんでした
デバッグ可能な APK または Android App Bundle をアップロードしました。セキュリティ上の理由により、Google Play に公開するにはデバッグを無効にする必要があります。詳しくは、デバッグ可能な APK または Android App Bundle についての説明をご覧ください。

Build Setting/Development Buildをoffにする

64 ビット要件に準拠してない場合

以下メッセージが出る

このリリースは Google Play の 64 ビット要件に準拠していません。

ProjectSettingのAndroidのConfiguration/ScriptingBackendをIL2CPPにし、ARM64をチェック

"android:exportedは使用されていません"とエラーとなるとき

以下メッセージが出る

unity 'android:exported' プロパティ セットは使用されていません。このファイルは Android 12 以降にはインストールできません。

android:exportedを宣言していない場合にエラーが出るようなので、 以下を、android:exported="true"を追加する

Assets/Plugins/Android/AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    xmlns:tools="http://schemas.android.com/tools">
    <application>
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
                  android:theme="@style/UnityThemeSelector"
+                  android:exported="true"
                   >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
    </application>
</manifest>

外部アプリから呼び出しを、NGとする場合は、android:exported="false"とすればよい。

どうしても無理そうなら、API Android11(31)以降からこのエラーが出る感じだったので、API Android10(30)へ戻す。

参考:https://xrdnk.hateblo.jp/entry/2021/11/05/115104