実現したいこと
Android用のUnityプロジェクトで、DeviceOwnerを利用して端末をKiosk化(専用端末化)したい
前提
javaに関しては素人の独学なので、初歩的なことが理解できていないかもしれません。ご容赦ください
Development Buildでは動作するのですが、通常ビルドの時だけエラーが発生しています
「Development Buildだと通る理由」と「通常ビルドを通すための解決策」をご教授いただきたいです
CompanyName = "test"
ProductName = "Kiosk"
packageName = "com.test.Kiosk"
発生している問題・エラーメッセージ
* What went wrong: Execution failed for task ':launcher:mergeDexRelease'. > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Type com.test.Kiosk.BuildConfig is defined multiple times: D:\Unity\Kiosk\Library\Bee\Android\Prj\Mono2x\Gradle\launcher\build\intermediates\project_dex_archive\release\out\com\test\Kiosk\BuildConfig.dex, D:\Unity\Kiosk\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\res.androidlib\build\.transforms\ccde4124495d5408c6b48c8b1aa28a98\classes\classes.dex
該当のソースコード
Androidmanifest.xml
1<?xml version="1.0" encoding="utf-8"?> 2<manifest 3 xmlns:android="http://schemas.android.com/apk/res/android" 4 package="com.test.Kiosk" 5 xmlns:tools="http://schemas.android.com/tools"> 6 <application 7 android:allowBackup="true" 8 android:label="@string/app_name" 9 android:supportsRtl="true" 10 android:directBootAware="true"> 11 <activity 12 android:name="com.test.Kiosk.KioskActivity" 13 android:theme="@style/UnityThemeSelector" 14 android:label="KioskMode" 15 android:exported="true"> 16 <intent-filter> 17 <action android:name="android.intent.action.MAIN" /> 18 <category android:name="android.intent.category.LAUNCHER" /> 19 </intent-filter> 20 <meta-data android:name="unityplayer.UnityActivity" android:value="true" /> 21 </activity> 22 <receiver 23 android:name=".AdminTest" 24 android:exported="true" 25 android:label="device admin" 26 android:permission="android.permission.BIND_DEVICE_ADMIN"> 27 <meta-data 28 android:name="android.app.device_admin" 29 android:resource="@xml/device_admin"/> 30 <intent-filter> 31 <action 32 android:name="android.app.action.DEVICE_ADMIN_ENABLED" /> 33 </intent-filter> 34 </receiver> 35 </application> 36</manifest>
試したこと-1
4行目を
package="com.unity3d.player.UnityPlayer"
と変更したら通常ビルドも通るのですが、実機の方で起動できずにエラー落ちします
ログを確認したところ
Log
1E/AndroidRuntime(14958) 2: java.lang.RuntimeException 3: Unable to instantiate activity ComponentInfo{com.test.Kiosk/com.unity3d.player.UnityPlayer.KioskActivity} 4: java.lang.ClassNotFoundException 5: Didn't find class "com.unity3d.player.UnityPlayer.KioskActivity" on path: ~
と出力されていました
試したこと-2
パッケージ名を変更すればいいのか思い、-1に加えて.javaファイルのpackageを全てcom.unity3d.player.UnityPlayerに変更したところビルドエラーが発生しました
エラー: パッケージcom.unity3d.player.UnityPlayerは同名のクラスと競合しています

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。