我已经将unity升级到2018.2.2f1,现在当我要构建apk时,此错误阻止了构建的完成:
...\Temp\gradleOut\build\intermediates\manifests\full\debug\AndroidManifest.xml:76: AAPT: error: resource drawable/app_icon (aka com.domain.projectname:drawable/app_icon) not found.
这是原始清单(不是合并清单)的一部分:
...<application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:largeHeap="true">
<!-- The MessagingUnityPlayerActivity is a class that extends
UnityPlayerActivity to work around a known issue when receiving
notification data payloads in the background. -->
<activity android:name="com.google.firebase.MessagingUnityPlayerActivity"
android:label="@string/app_name"
android:icon="@drawable/app_icon"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<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>...
活动标记内的android:icon =“ @ drawable / app_icon”引起了问题。如果删除它,则构建成功,但是应用程序在启动时崩溃。如果我将@drawable更改为@mipmap,则该应用程序仍然崩溃。来自logcat的日志也没有提供有用的信息:
Caused by: java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
at com.google.android.gms.common.internal.zze.zzw(Unknown Source)
at com.google.android.gms.common.internal.zzi.zzamc(Unknown Source)
at com.google.android.gms.common.internal.zzh.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:5389)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
任何暗示让我对这种情况有更好的了解将不胜感激。
答案 0 :(得分:0)
我也有同样的问题。崩溃时,我的日志告诉我这是由
引起的 08-21 16:34:17.202 14578 14578 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.company.gamename/com.google.firebase.MessagingUnityPlayerActivity}: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.MessagingUnityPlayerActivity" on path: DexPathList[[zip file "/data/app/com.company.gamename-1/base.apk"],nativeLibraryDirectories=[/data/app/com.company.gamename-1/lib/arm, /data/app/com.company.gamename-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
更换后,我的应用停止崩溃了
android:name="com.google.firebase.MessagingUnityPlayerActivity"
与
清单中的android:name="com.unity3d.player.UnityPlayerActivity"
。
我没有找到比删除android:icon="@drawable/app_icon"
答案 1 :(得分:0)
我将项目更新为最新版本的unity时遇到了这个问题。我花了很多时间才能找到问题所在。只需在插件文件夹的AndrdoidManifest.xml中将@drawable替换为@mipmap。